Dungeon Defenders tutorial series:
Enemy Spawning | Treasure Chests | Minimaps | Pathing | Rewarding and Customising Items
Enemy Spawning | Treasure Chests | Minimaps | Pathing | Rewarding and Customising Items
Setting up enemy spawning and customising your waves in Dungeon Defenders
INTRO
I've decided that because there are a fair few options when setting up enemy waves in Dungeon Defenders (DD) I created a quick simple guide covering the basics for those who might be confused.
For this I will use the DD_LevelTemplate provided by Trendy with a setup that already works. while you can create your own, this template has all the required kismet setup for you to start working on a level, which will easily save you some time.
I'll take a quick look at how to set up an enemy spawner and how you can adjust the amount of enemies and which types spawn from one .
THE KISMET
So if you load up kismet by clicking the green K on the toolbar you'll be presented with the kismet window, which should look something like the image below.
You need to locate the Prefabs sequence, a sequence is just a type of folder allowing you to easily organise kismet events and keep them neatly arranged, you can do this by finding it in the window and double clicking it or expanding the sequences for DD_LevelTemplate in the bottom section, once you're in the prefabs section, there are again 4 sub sequences here. The one we want to use to control the enemy units is Prefab_PerLevelWaveSpawners_Seq, so jump into that one. Now the next section has some kismet that triggers more sub sequences.
For this tutorial i'll be working with one door, as such I've gone and removed all the sequences except SpawnArea3, which on the template map is the centre door. So you can either choose to leave the others there or remove them, it won't affect anything. Once you're inside the SpawnArea3 sequence you should see the following.
PROPERTIES
The left most variable contains all the information for the type of enemy to spawn, which waves they start, or stop, spawning on. Along with whether to have a delay between spawning them or not. With this variable selected the bottom of the kismet window will show you it's properties.
- EntryName - Not required
- Time Of Wave - The time into the wave the selected enemy type spawns
- Enemy Template - The type of enemy you wish to spawn
- Player Enemy Num Multipliers - Multiplier to wave size depending on players in the game
- Number Of Enemies - The number of enemies on the initial wave they spawn
- Spawn Interval - The time between groups/mobs of the enemy type spawning
- Enemy Num Scaling Exponent - Appears to be exponential growth multipler to wave size, uncertain.
- Minimum Master Wave for this Group - Minimum wave to be reached before spawning these enemies
- Maximum Master Wave for this Group - Maximum wave to be reached before spawning these enemies
- Maximum Number of Enemies for this Group - Exactly as it sounds. 10 enemies will max out at 10 for that spawn entry.
- Minimum Number of Players for this Group - How many players in the game before this group is spawned
- Maximum Number of Groups Override - As enemies increase they will multiply by groups. This is a max of how many times it can multiply.
- Disable Group Duplication? - Disables the above function allowing for more control of the exact number of enemies in
- Wave Modulus for Inclusion - Included waves. For example: If the value is 2, the waves this entry will be active is 2,4,6,8, so on. If 5, 5,10,15,20 and so on.
- Wave Modulus for Exclusion - Same as above but for excluding waves. If 2, enemies will show up on 1,3,5,7,9 and so on.
- Difficulty Set Offset - Enemy level (-1 = easy, 0 = medium, 1 = hard, 2 = insane)
- Num Enemy Difficulty Multipliers - Value multiplied to amount of enemies either increasing or decreasing enemy count
- Enemy Element Override - Force enemies to spawn with a elemental resistance
- Group Duplication Time of Wave Multiplier - Not used
- Use Custom Mission Index Requirement? - This I am not 100% sure but I believe it works like this. Your normal level is index 0 while the challenge on that map may be index 1. This is not really used but that would be the use for it.
- Custom Enemy Tag - Not used
- Mix Additional Enemy Archetypes - Additional enemy types to spawn in that entry, this is used for Mix Mode, but is not used as you can specify the types of enemies allowed in Mix Mode through other means.
- Mix Allow Random Enemy Template? - Used the above templates, yes.
- Mix Difficulty Offset Random factor - As above but for difficulty not enemy type
- Mix Disable? - Enable if you do not want this spawn entry to be used in Mix Mode.
- Mix Disallowed Enemy Archetypes - What it will not spawn in Mix Mode.
- Mix Disallowed Enemy Classes - This is so that there is never a mistake in Ogres being in the Mix Mode randomizer.
- Mix Don't Randomize? - This will completely disable this spawn entry for consideration in Mix Mode.
- Mix Number of Enemies Random Factor - Based on how many enemies are in the entry, this is how random (default 150%+-) that value can be in enemy numbers.
- Mix Percent Chance for Elemental - Chance that in Mix Mode the spawn entry will spawn an elemental immune enemy.
- Mix Time of Wave Random Factor - NRandomizes the "Time of Wave" aspect of the spawn entry.
- Obj Comment - Comment next to variable in kismet
- Output Obj Comment To Screen? - Send object comment to screen when triggered, not needed
- Suppress Auto Comment? - Not needed
- Var Name - variable name to be referenced by named variable
Thanks to Tsuda from TrendyEnt for helping me complete the property definitions above!
THE WAVES
So now that we have those covered, or most of what is required for basic enemy spawning, lets get around to creating our own waves.
I've gone ahead and removed the current enemy wave entries, you can do the same if you wish, by clicking the red 'x' on the right side of the rows listen under enemy wave entries, or just add more onto the current list.
To add a new mob click on the green '+' on the right side of the Enemy Wave Entries row, you will either see a new entry appear in your list below, this will be an incremental number on the last one, if it's new it will start at 0.
The first thing to do when creating a new mob/wave/enemy group is to decide on the enemy type you wish to spawn, you can create multiple mobs to spawn multiple enemy types from one door, but lets start of with just one.
First we need to find the enemy we want, to do this open up the content browser and under the My collection click on Enemies, if for some reason you don't have this you can find them in the package 'DunDefArchetypes'
What we are looking for here are archetypes named like 'EnemyOrc' or 'EnemyWyvren' not 'EnemyOrcAIController'. For this i'll go with a simple goblin. Unfortunately for some reason the DDK doesn't allow you to place the selected object in the content browser into the kismet properties of the enemy wave entries. So we need to right click the selected object and select 'Copy Full Name to Clipboard' which for the goblin gives us 'DunDefGoblin'DunDefArchetypes.EnemyGoblin' we then need to paste this into the 'Enemy template' section under our added wave entry.
Now lets go down the list and modify some values to get our own wave as we want. We'll skip to Number of Enemies, now remember that Dungeon Defenders modifies wave sizes based on difficulty, player count and more. So the value you put in here won't necessarily be the size you get in game. But for a starting wave lets put down 6 for now. Instead of having them spawn 0.5 seconds apart, on each spawn point, let's up the Spawn Interval to 3 (seconds)
Now feel free to close down kismet or minimize it to test. If you're using the LevelTemplate you might need to add a floor to the map, either BSP or a static mesh so you have somewhere to stand! then right click on the floor and hit play from here. And check out your enemy wave, remember that your difficulty and other kismet settings elsewhere will modify the actual enemy count so it might not be the number input.
Anyway, that was simple!
So how about we add another wave of enemies that doesn't spawn until wave 2? Going back to your kismet variable where you created the last setup, click on the green '+' again to add a new wave entry, click on it to expand it, then go to your content browser and find a new enemy type to spawn on wave 2. Again copy it's name to the clilpboard and paste it in, this time im going to use a Dark Elf, the full name being ' DunDefDarkElf'DunDefArchetypes.EnemyDarkElf''
Set up how many enemies you want to spawn then put your 'Time of Wave' to something like 12 so they don't spawn instantly in round 2, that way you cans end out many goblins to soak damage and let stronger enemies get closer to do some damage.
Now set the 'Minimum Master Wave for this Group' to 2, and for fun lets change their elemental resistances by selecting the dropdown next to 'Enemy Element Override' and choosing lightning.
Now as before close out of kismet and play the game from editor and fight to wave 2 and see what happens!
You can also add multiple wave entries of the same enemy type. Which allows you to control the speed at which then spawn or when different size mobs spawn. Along with using the difficulty you can have multiple enemy levels of one type. Do note however that the game will only show the highest level icon in game over the spawn doors.
Again remind you that the amount of enemies you put is the first wave, so although we only put 2, with the multiplication of enemies that I have in my kismet results in 8 spawning on wave 2.
MORE SPAWNS
Now by default the Template level has 2 spawn points, for each door, what if you want a third? Not that it's required but it can be useful if you door is quite wide or has 2 ways out etc. It's a very simple change, first we need to create a new spawn point, now Dungeon Defenders uses kismet to spawn enemies onto notes in the world, these aren't visible at runtime and can be put anywhere. Simply select one fo the current notes for the door being used, hold down alt and drag it along a move axis to create a copy, now at the bottom of your editor window you should see the name of the selected object. If not you can hit F4 for properties and it's name is shown at the top of the window. In this case it is Note_12, now hop back to your kismet window and locate the Object list that has a not icon with two notes in it currently, click on this and in its properties add a new object with the green '+'. Here type Note_12 (or the correct name for yours) and hit enter the DDDK will corrent it with the full name, now your enemies have a new spawn point.
ADJUSTING WAVE INCREASES AND OTHER VARIABLES
Now let's take a quick look at enemy wave sizes changing per wave based on values in kismet. On the top level of your kismet sequences the template level has a commented group of variables called 'Global Wave Scaling variables -- Edit These'
These values can all be edited to adjust the waves of your level. Some will require to be told things like trigger volumes around spawn doors (which makes sure doors don't close if a player is inside the spawn. Some are right and left doors as these are all controlled by a sub sequence again and this allows you to quickly keep them all in one spot.
For your wave enemy count you can adjust:
EnemyNumMultiplier
EnemyNumbersIncreasePerWave
GroupIncreasePerWave
WaveGroupNumMultiplier
For enemy difficulty increase you can change:
EnemyDifficultyIncrease
EnemyDifficultyIncreasePerWave
You can change the time limits for building with:
FirstWaveBuildTime
MinimumBuildTime
BuildTime
BuildTimeDecreasePerWave
And you can also adjust the wave at which the map starts on, very useful for testing specific waves in the editor with:
waveNumber
ORGANISING KISMET WITH NAMED VARS
To save yourself time and making organising your kismet much easier, you can, as trendy have, use named variables in all your sub sequence spawners, which will allow you to call variables for the wave spawning on the top level of kismet where all your editable values are kept.
This way you can place them all together and if you wish place your minimap texture into kismet to visualise which spawner is where.
To do this, open up kismet and jump into your spawning sub sequence, currently you have the 'Enemy Wave Entries' variable connected up to the 'Dungein Defense Scale Enemy Wave Entries' action via the 'Wave Entries (In)' node.
What we want to do is first, name this variable. To do this, select it and at the bottom of the properties box you can see 'Var Name' In hear type a name that will refer to it's point in the map or something you can remember. In this case I'll use 'CentreDoor' as my variable name.
Now we'll create a new Named Variable here. This will allow us to reference the Wave Entries variable from another place in our kismet. And means we can use the same variable for multiple doors if we want, but for most cases doors will want to have different enemies to challenge the players more.
To create the variable, right click and select 'New Variable > Named Variable'
Select your new Named Variable then in the properties set the 'Expected Type' drop down to 'DunDef_SeqVar_EnemyWaveEntries'
And set the 'Find Var Name' to the same as the variable you just named, in this case, 'CentreDoor'. If the Kismet can locate the variable name you've entered the red cross should turn to a green tick.
To connect this var to the 'Wave Entries (In)' node you must first break the connection between the currently connected variable. You can do this by either right clicking the node it is connected to on the action box or the variable and select 'Break All Links'. Now you can connect this variable to your 'Wave Entries (In)' node.
Now we need to move the 'Enemy Wave Entries' variable to the top level of kismet, to do this, simply select it and hit Ctrl+X for cut, go to the top level and hit Ctrl+V to paste it back.
Now if you would like to place your minimap texture in kismet to make it visually clearer which spawner goes where, create a New Comment (Wrap) from the right-click menu, go into its properties box. Here you can set a Fill Texture or Fill Material, as minimaps use textures we'll use one of those, you'll most likely have your own texture imported into your map package, but for the purposes of this tutorial I'll be using a default one which if you wish to test can be found in the 'DunDefMiniMaps' package in the content browser. Once you've selected your texture in the content browser, jump back to kismet and click the green arrow on the right side of the 'Fill Texture' row to assign it.
You'll notice that it's very transparent to resolve this expand 'Fill Color' and set your Alpha (A) to 255, or click on the colour box and set the alpha in the popup 'Select a Color' dialogue to 1.
You can also name your comment box by changing the 'Obj Comment' especially useful if you plan on having multiple modes for challenges where you want a different spawn setup.
Using the bottom right of the comment box, you can click and drag to resize it as you wish, alternatively type your desired values in to the 'Size X' and 'Size Y'.
Once you've completed the comment box and your image is scaled as you wish, you can drag your variables on top of the comment box, relative to the spawn positions in the map.
THAT'S IT!
I hope this quick tutorial has helped you with spawning your own wave setups, if not feel free to check out the official DD forums.