Saturday, March 3, 2018

FPS Tower Defense Toolkit Tutorial: How to create a new level

1. First, ensure that the default Game Mode & Game Instance class parameters in the Project Settings are set to BP_GameMode & BP_GameInstance classes respectively.

2. Now create a new map, open it, & lay down the floor meshes. Add a Nav Mesh Bounds Volume & extend it to encapsulate all the floor meshes. This will enable AI bots to traverse across the level.

3. Add a Lightmass Importance Volume around the core game space.

4. The next step is to add instances of BP_EnemySpawnPoint to act as spawning volumes for the enemy waves. As can be seen in the next screenshot, I've added a couple of spawn points in my level:

5. Now add a BP_PowerCore actor to the level in order to provide the primary target for the enemy AI bots.

6. The toolkit uses modular grid generators to act as platforms for tower placement. But before adding them to the scene, first, add a BP_GridManager actor. The Grid Manager determines the size of individual grid cells across all grid generators in the level through it's publicly exposed variable 'GridCellSize'.

7. With the grid cell size specified, it's now time to add the grid generators. Drag & drop instances of BP_PlanarGridGenerator into the level. The overall size of the generator in the X & Y (local space) directions can be specified through the 'GridCountX' & 'GridCountY' variables as shown below:

8. Now add an instance each of BP_ProjectileManager & BP_ObjectPoolManager into the level. If you plan to use the pooling system, just set 'PoolPlasmaProjectiles?' to true through the details section of the actor. Since this system uses a fixed size pooling system, also make sure to specify the pool size through the 'PoolSizePlasmaProjectile' variable.

9. The next step is to add an instance of BP_EnemyAIManager. It will tackle the responsibility of keeping track of potential targets for the enemy AI bots. While the target acquisition and response logic are handled directly by the bots themselves, the Enemy AI Manager aims to provide them with all the necessary information in that regard.

10. Now comes two of the most important classes required for the functioning of the toolkit: the Tower Manager and Wave Spawn Controller. Add the BP_TowerManager actor first. There's no need to make any changes to its default parameters, but if you're interested in knowing more about the class, check out the concept overview post for the same at:

Next, add an instance of either BP_BatchedWaveSpawnController or BP_WeightedWaveSpawnController to the level. While most of the default parameters will work right out of the box without any need for customizations, you will have to add references to the enemy spawn points within the publicly exposed array 'BatchedWaveSpawnDataArray', if you're going for the former model. Just make sure to specify the 'SpawnPoint' parameter for each wave by linking it to one of the spawn points added to the level in Step 4.

For further reading about the wave spawning systems, see:

11. Now onwards to the final step. All that's left to do is to add level bounds so that actors like projectiles that can move across the level gets destroyed once they cross a certain threshold. Add six BP_LevelBounds actors along the outer periphery of the level, making sure that they form a cuboid shape to encapsulate the entire level.

With that, you should have a fully functional level at your disposal. If you have any queries regarding the workflow, feel free to let me know in the comments section.

If you're interested in the toolkit, you can purchase it through the Unreal Engine Marketplace: