Back Home

Pathing in Dungeon Defenders


Dungeon defenders makes use of the automatically generated path finding system in the Unreal Engine, you can just shove a Pylon in to your map and it should, in theory, map out what AI can and cannot walk over/through. However, because it does this by itself, you get limited control over it, which is where the use of 'PathBlockingVolumes' comes into effect. Almost every time you make a map you'll need to make use of these, so where as the path finding system no longer requires the tedious placement of path nodes, it does require the tedious placement of blocking volumes if you have a complex map, or wish to control the AI movement around your map.

For this tutorial I've meshed the same map I used for the minimap tutorial. It's pretty basic, but should allow me to cover everything you need to know about the pathing system.


By default your enemies will spawn and because there is no pathing, will try to walk in a direct line towards your crystal(s). Resulting in them walking off edged and to their death.

The easiest part of setting up paths is putting a pylon in your level, this is the actor that lets the engine 'explore' your level, determining what is what is and isn't an obstacle.
So, right-click in the level and select 'Add Actor > Add Pylon'. It's best if you place this in the middle of your map, for some people a single pylon will path the whole map, others who have larger maps may require extra volumes, something i'll cover later in this tutorial.

Important: Make sure that your Pylon is touching the floor! If there is too much of a gap between the pylon and the floor, the engine won't be able to "see" the floor and path as a result.

If you hit F4 with the pylon selected to open up the properties window, expand the 'MeshGeneration' section, by default the value is 2048. This is the scale of the cube around the pylon. The cube is the limit for exploring by the pylon, if you have parts of the level outside of this area that enemies will use you need to expand this.
If you're not sure if it's big enough you can see the cube outline in any viewport.
There is an engine limitation to the maximum size of the 'Expansion Radius', and that value is 7168, if you enter a higher value it will lower it.

But what if you map is too big for this? Maybe it only includes a section of your map? Well thankfully there is something we can do about this. We need to create a volume that will include our whole map. Now while my small map can be contained in the default size, i'll show how to set these up anyway.

For this we need to make a new volume, so reset your builder brush, by right-clicking on the 'Cube' icon. I chose 2048 for all my values, you can chose what applies to your level.

Now if we switch to geometry mode we can modify our builder brush, first we'll extrude some faces out, which will give us greater control of the area our volume covers. To do this select a face by clicking on it in the perspective viewportthen in the new dialogue box that should have popped up when you switched to geometry mode select the 'Extrude' option and extrude it out, you can change the Distance and segments if you require.

With faces extruded you can then select vertices or faces by clicking them and moving them with the move widget. To select multiple vertices, i.e. all 4 on one face you can hold down Ctrl+Alt then click and drag over the desired vertices, which when highlighted will turn a brighter red. Doing this with your multiple extruded vertices allows you to create more complex shapes for volumes or brushes.
Once you have then completed your volume and made sure that it encompasses the entire level where enemies will require pathing, right-click on the 'Add Volume' icon on the left hand tool bar, which will provide you with a list of all the volumes you can add, we want to place a 'NavMeshBoundsVolume' so select it, and now you can move your builder brush away, of hide it with the shortcut 'B'. And now you can go exit out of 'Geometry Mode' and go back to 'Camera Mode'

Now we need to assign this volume to our pylon to let it know that it should 'explore' these additional sections. To do this, go to the Pylon's properties window. Expand the 'MeshGeneration' section and on the right end of the 'Expansion Volumes' click the green '+' to add a new item to the list, now in your new empty item field we need to insert the 'NavMeshBoundsVolume' we just built.

As we're going to select this in the world we first need to lock the current properties window, otherwise when we select a new object the editor will load its properties into the window, so at the top right of the properties window click the lock icon to lock it, which will allow us to editor properties but keep it assigned to the object selected currently.

Now select your 'NavMeshBoundsVolume' and in the properties window for the Pylon where you added your new item, click on the green arrow on the right side of the row to insert the currently selected object.

Now on the top editor toolbar, hit the 'Build Paths' icon or if you want 'Build All', let the engine do it's work. And once done you should be presented with some rather bright coloured shapes. If not, then hit the 'P' key to show/hide paths in the editor.

What you're seeing now is how the engine has built the paths, enemies will now be free to walk on the green floor, the engine has split it up into polygons, the purple line indicates a connection between polygons that connects two green ones together, and AI can walk across these. Red is what the Ai will see as an impassable obstacle. They should never walk through this on their own accord, but can be pushed out as the result of gameplay. Yellow is just where you're camera is looking through a red surface onto a green one.

What you have right now works, you could release your map with this. Unless you want some Wyvrens to fly in and annoy people, which i'll discuss later.

The only downside to this pathing is that enemies will still try to take the shortest route to the closest crystal. This can result in a whole mob of enemies walking along a left edge of a route rather then being split across it. They may not even go to the crystal because it is very slightly closer. These things can be fixed though.


What we can do to avoid some problems is to place 'PathBlockingVolume's throughout the level. These only affect the pathing of a level, making invisible walls that AI cannot pass. Using them we can force AI on a specific route, or split them up. The template level included with the DDDK has 2 note spawn locations per spawn. This is very useful, it allows us to split the mob exiting the spawn into two groups, that we can send different directions which can force enemies to split their defences up.

Using your builder brush and methods discussed earlier with 'Geometry Mode' place a thin cuboids along one of the routes in your map, make sure it runs into the spawn point and has a note either side of it. Next, right-click the 'Add Volume' icon on the left toolbar and add a 'PathBlockingVolume' This will mean that we can send this mob two ways. You can also adjust your spawns if you wish to have more notes so you can split mobs up even more.

Now you can hit rebuild paths and see the results, you now should have a gap in your paths.

Because there is now a 'obstacle' between the two notes enemies that spawn on one won't be able to get across to the other side. This method allows you to force the route that mobs take, you can build a completely empty level, but use continuously connected path blocking volumes to route enemies exactly where you want.

Another method you can use is to place very thin columns of PathBlockingVolumes along a route, this forces the mob to split up and walk around them. It also makes them seem more "alive" as they don't walk in perfect straight lines. If you do use this method however, make sure you test it! If they're too large, or too close your mobs can end up getting stuck and walk back around, which doesn't always look very good when an Orc decides to give up and turn around!

When doing maps much more complex then this, you're bound to have meshes all over the place sticking out, taking up walkway spaces. The path finding isn't 100% perfect, so there will be times where you have to place path blocking volumes so mobs don't get stuck on items, or routes aren't too thin. And that there isn't a place where they can somehow walk off the edge.


Stair cases, are a rather interesting pathing issue. If you're going to use CSG stair cases each step will have its own collision. The easiest fix to this is to either use a Static mesh that has a sloped collision around the steps, I believe all of Trendy's stair cases meshes are built this way. Or if you wish to use CSG you'll have to create a Blocking volume to follow the stairs so that it becomes sloped. If you want to use a spiral/curved staircase you'll find making collisions is rather hard, and you'll need to use 'Geometry Mode' to set a brush up correctly for it, normally spiral/cuved CSG stair cases are more trouble then they're worth. Instead look into using multiple linear stair cases and rotating them around.

In some cases Blocking volumes on stairs aren't required. The maximum distance in height between steps is 32, more then this and the path exploring will only attempt it, in most cases it wont path the stair case at all. If it does it'll be messy.

In some cases throught your level you may have to apply similar practise with blocking volumes to makre sure the level gets pathed properly.


Now while you can spawn wvyrens on these paths, they don't really fly in, they just stay above the paths, where as they are designed to be a specialised enemy that can avoid all blocking on the ground and have to be shot at.

To path these you're going to need something known as a 'FlightPathNode' these are a much more 'oldskool' style of pathing, where you need to place multiple nodes throughout the level that determines the route the AI will take.

To find these open the Content Browser and switch to the 'Actor Classes' at the top. Expand 'NavigationPoint > PathNode > VolumePathNode' where you'll find 'FlightPathNode'

You can now with this selected right-click in your level and 'Add FlightPathNode Here' You should place the first one close to your Wyvren spawn note, so that it can find the path. Now you can Alt+Click/Drag to duplicate the Node which saves you having to right-click all the time. Duplicating nodes does require you to rebuild paths so that the engine knows they are different nodes, so keep that in mind.

Now using your move widget create a "path" though the air with your nodes, you can place as many as you want, there is a maximum limit distance between nodes, and again so they don't fly in a straight line and become easy pray to towers you can zig-zag the path or create multiple routes, as when you rebuild paths they will connect to each other.

Make sure your path nodes have enough room around obstacles, otherwise you might end up with wyvrens getting stuck in places.

Once rebuilt toggling Paths (P) should show/hide your path connections. If for some reason after a rebuild normally hitting save corrects them showing up. Remember to place paths so that wyvrens can fly between crystals if they need to, and a node above the crystal is a good idea so they can actually get to it to attack.

Now for some wonderful reason flight node collision cylinder is 12000 units in radius, which is way too big. This should be scaled down, so select ALL of your flight path nodes. Do this by selecting a single one, right clicking on it and going 'Select > Select All FlightPathNode Actors' now hit F4 to bring up all the properties.

Expand 'Collision' and then 'Collision Component' and set the 'Collision Height' to a value of '1000' along with a value of '750' for 'Collision Radius' (These are values used by TrendyEnt.

Now expand the heading 'VolumePathNode' and check the box 'Restore Collision Cylinder'

It would be a good idea that the 'Note' actors you are using to spawn your Wyvrens are inside the collision cylinder of the flight nodes. You can see cylinders when the nodes are selected.

As of August 2012, Trendy Ent have made all of the game content to be avaliable to modders, this means you can now add Djinn and Goblin Copters into your levels. Do note though, that these work differently to Wyvrens and have some unique requirements to work.

The following information is provided by Tsuda from Trendy;
Copters Connection Set is directly related to the Connection Set on the Drop-Off point. Set them to the same set and they will work accordingly.

For reference I use this scheme:
ConSet 0 - Wyvern
ConSet 1 - Djinn
ConSet 2 - Copter

As for the Djinn, Instead of using a note to spawn the enemy, try spawning them on a FlightPathNode instead. Sometimes they have a hard time getting to the start of the network when they do not start literally on top of it. Make sure all FlightPathNodes for Djinn specifically (do not share ConnectionSets across enemy types) are all set to the same value, additionally, even though they do not attack cores, make sure those flight path grids are complex enough to reach all areas of the map including the crystals.

Do note that like Assassins, Djinn will not attack or move from their spawn points unless there is a tower on the field.


This section is going to be incredibly short, you don't need any path nodes as such for players, but what you do need are Player spawn points, 4 of them.

To add a 'PlayerStart', right click where you want to place it, select 'Add Actor > Add PlayerStart'. You can now duplicate this 3 times, or add another 3. Make sure that you have 4 points for all the players!

If you want you can rotate the direction of player starts, which will affect the wal the player looks when they spawn, when you look at the sprite in the world there is a arrow, the direction this points is the direction the player will face on spawn.

Once added, hit rebuild and you're good to go!


There are a few other things you can do when pathing your AI. Instead of using 'PathBlockingVolumes' you can make use of 'NavMeshWeightVolume' this doesn't block enemies, but makes the AI believe that the section with the 'NavMeshWeightVolume' is a longer route, the volume is configureable via properties. The larger the value placed in the properties under 'Weight' the further the distance will seem to the AI. It doesn't block AI, although if an enemy is pushed, shot or hit into the volume it will continue to follow a path.

If you open the 'World Properties' through the 'View > World properties' menu and then expand the 'World info' you should see a section called 'My Map Info' if you have this but nothing expands then you can add 'DunDefMapInfo' with the blue down arrow on the right side. Once expanded you'll see a heading 'NavMesh' This contains multiple values, things such as maximum height for pathing and many other options. As these are advanced options, they aren't something that has to be modified, they do help with the use of higher step heights and drop offs, but nothing you can't avoid without following the tutorial and utilizing blocking volumes.

There are some unique properties when it comes to blocking volumes you may also find useful when doing paathing or general collisions in a level, these are the My Collision Group values, I am sure there are more than this but these seem to do most things you would need.
0; blocks all
2; blocks players not projectiles
4; blocks players and enemies but not projectiles
6; blocks players not projectiles
8; blocks enemies only not projectiles

If you are having issues with pathing, or just want to know more about some of these advanced generation options, TrookLue on the Dungeon Defenders forum has gone through the trouble of letting you know what most of these options do and ways to improve your pathing. I highly recommend checking out his thread, located right here!

If you want to set up wave billboards for your enemy spawns, head on to my Minimap tutorial!


I hope this quick tutorial has helped you with pathing enemies, if not feel free to check out the official DD forums.

HTML hit counter -

Back Home