Popular Post Dragofer 1418 Posted February 24, 2019 Popular Post Report Share Posted February 24, 2019 (edited) Wiki: Systematic Method for Adding Pathfinding to Uneven Terrain During some recent browsing of the forums I came across not one but two members posting about the difficulty of applying monsterclip to uneven terrain. I realised I could share my approach to making such terrain passable for AI, which Ive first used for the beach segment of One Step Too Far. Concept This will create a grid of monsterclip floor brushes. The top surface of each brush is raised or lowered to match the height of the terrain at that location. Steps are added wherever theres a great difference in height between two adjacent brushes. The map boundary is traced by brushes created on an 8-unit grid. 1. Preparing the grid Start by making a large monsterclip brush that covers your whole terrain. Its height should span from the bottom of the map area to above even the sky, so that itll be easy to click on from above. Go to your preferences and ensure your clipper tool does not use caulk. Switch into top-down view and use the clipper tool to cut this brush up into blocks so that you get a grid. A good size would be 192x192 units per block, but you could use smaller or larger blocks if your terrain is highly uneven (i.e. boulder landscape) or quite flat, respectively. Delete any blocks that do not touch your terrain. If you have a structure with worldspawn brushes within the terrain, like my mansion here, then enable the filter for entities and use the clipper to remove those parts of the monsterclip brushes that overlap with the house. 2. Using the grid Disable the filter for entities, set your DarkRadiant grid size to 8, go into side-view to select the protruding tops of all your monsterclip brushes, hit v to swap to vertices mode and lower all the top vertices just enough that the highest point of your terrain is still covered in monsterclip. Now use the resize tool to lower the top surface of each block so that it intersects with your terrain. This doesnt have to be very exact because you get around 30 units tolerance in both vertical directions. If you see that a brush is completely covered by impassable entities you can delete it. 3. Making steps between the blocks Some blocks may be considerably higher than their neighbouring blocks, so that steps must be added. Not all AI can handle 16-unit steps, so itd be best to use 8-unit steps for this method. Start by hiding everything except monsterclip: enable the filter for monsterclip, select & hide your whole map, then disable the filter for monsterclip. Now use the camera view to identify where steps are needed and add them as shown. 4. Monsterclipping the perimeter Unhide your map and create a tall brush that spans from your lowest block surface to the top of the map area, which you then delete again. This will inform DarkRadiant how tall you want brushes to be that you create while youre in top-down view. Switch to top-down view and trace your terrains boundary, i.e. trees, rocks, walls with monsterclip brushes on an 8x8 grid. Use the camera view to ensure that these objects are completely behind monsterclip: AI can get stuck on any pieces that might stick out, such as branches. Objects on the terrain such as rocks and trees can be monsterclipped normally. Remember that AIs need over 32x32 units of space, so you should fill up any alcoves that are 32 units or smaller. Testing If youd like to test this you can have an AI chase you row-by-row, then column-by-column while you fly backwards with noclip enabled. The AI should always follow you in a straight line. Result This has applied highly quadrangular monsterclip to an organic environment that should fit well to TDMs 32x32 unit pathfinding system. As the approach is systematic, all areas should be covered correctly. This may be initially more labour-intensive than doing the monsterclip by eye, but in the making of One Step Too Far I kept finding small pockets all over the place where the pathfinding hitched before making the switch. Edited February 27, 2019 by Dragofer 8 Quote FM: One Step Too Far | FM: Down by the Riverside | FM: Perilous Refuge Dragofer's Stuff | Dragofer's Scripting | A to Z Scripting Guide Link to post Share on other sites
RPGista 603 Posted February 25, 2019 Report Share Posted February 25, 2019 Very cool, specially useful seeing this applied to such an organic and irregular terrain, which is always hard to wrap your head around when you are getting started and is just getting used to working with orthogonal geometry. Awesome work, it would be great to have this in the Wiki. 1 Quote Link to post Share on other sites
grayman 2974 Posted February 25, 2019 Report Share Posted February 25, 2019 Well presented, Dragofer! 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.