FPS Tower Defense Toolkit

I’ve e-mailed Unreal 4’s billing team for a refund, really lazy on whoever’s part for not checking if the assets are compatible as advertised which has been a problem for me in the past with graphical assets I bought from other artists on the UE4 marketplace.

I’ve been using up a lot of time updating my game to different engine versions and sticking with 4.8 until I can start on a new project. One of the worst things about UE4 is asset compatibility and packaging a project that somehow fails time and time again because of an asset that wasn’t properly compatible.

Thanks for the feedback killian22. I’m trying to get this issue fixed with the Marketplace team.

Fixed the forward compatibility issue mentioned by killian22. Now both v4.8 as well as v4.9 project files can be downloaded and used separately from the Marketplace. Ofcourse the 4.8 version of the toolkit will only contain the features added up to the first update. The 4.9 version contains all the features that have been added in all the 3 updates.

Apart from that, I’ve started working on the 4th update. This update will add new and different types of wave generators as well as improvements for the existing wave handling system in the toolkit.

Update 4 (v1.4) [Compatible with v4.9 & v4.10 of Unreal Engine] now available on the Marketplace. This is the biggest update so far and includes many new features as well as code optimizations and bug fixes. Here are the major list of changes:

  • The Wave Handler now supports up to three different types of wave generation systems: a Unit Based generator that provides complete control over the waves by specifying the wave data on a unit-by-unit basis; a Group Based generator that facilitates grouping of AI bots to enable more automated design; and a Threat Based generator that can pick and spawn from a specified set of enemy types based on the Threat level for the corresponding wave.

All three types of wave generators now support multiple repeating wave cycles that increase the strength of AI bots with each new cycle. Endless wave mode supported as well.

  • The threat detection for AI bots have been completely revamped with an improved and more accurate system.

  • The Detour Crowd based collision avoidance system has been discarded in favor of a new system which focuses on randomizing the approach vector of AI bots from spawn points to the Core. Inter AI collision was removed as the Detour crowds could not handle the increased amount of AI traffic, owing to the new wave generator systems.

  • The Enemy Spawn Points are now equipped with spawning volumes to generate randomized spawning locations within the volume. Supports both runtime generation as well as pregenerated spawn locations.

  • Added a new Core regeneration mechanic so that the player can heal the Core between waves using tower points.

  • The Widgets have all been optimized to run completely on event driven updates instead of relying on the previous implementation of continuous binding functions.

  • The Wave Handler now supports Timed Waves that work in conjunction with the default system of manual activation of waves by the player.

  • Other changes include v4.10 support, general code optimizations and bug fixes.

Preview Video:


Documentation for the changes at: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=349197&viewfull=1#post349197

Any news on when v4 will go live on the marketplace?

Hey MiniDigger, nice to see you here. v4 just went live on the Marketplace. Both 4.9 and 4.10 versions contain all the new updates mentioned above.

Two questions.

  1. I want to make the grid sizes smaller. Having big blocks as in the default really limited tower placement, can the grid sizes be made smaller?Or towers require more or less grid space?
  2. I can’t figure how how to configure the wave spawner - any chance you could make something that explains it? There was one or two variables I couldn’t even find.

Thanks very much for making this and providing it on the marketplace.

Hi SlightlyLive, yes you can make the grid sizes smaller. When you open up the toolkit, you may notice that there is an actor in the level named BP_GridManager. I’ve exposed the Grid Cell Size variable in that class so that users could change the grid size for all Grid generators from one place, instead of having to go to each Grid Generator. So the first step is to change this variable as per your requirements. For example, I’m going to change it from 400 to 200 units as shown below:

Upon changing the grid cell size, you may notice that there is no visible change to the grid generators in the editor. In order for that to happen, you will have to first recompile the BP_PlanarGridGenerator blueprint so that their construction script gets executed again with the new parameters. Now all grid cells have been recalculated based on the new grid cell size you set earlier. However, the grid cell mesh does not know about this and creates this clumped up effect seen here:

So that leads us to the next step, which involves updating the build scale of the grid cell mesh. Open up the SM_GridCell mesh, go to Build Settings, and then set its Build Scale parameter to be slightly less than your (Grid Cell Size)/100. We’re doing this because the default mesh is a square plane with a side length of 100 units. Also having a smaller size than the grid cell ensures that there is no overlap (in display only) between adjacent meshes.

Now that should take care of the Grid Sizes. But your Towers would still retain the size relative to your old Grid Size as they are not dependent on the Grid Size. You would probably be using your own tower meshes, but for prototyping, you could repeat the last step and change the Build Scale for tower meshes as well.

And that’s all there is to it. You can try it out in the editor for yourself and prototype different grid cell sizes before creating the meshes for your game.

As for your second question, I’ll make something that describes the process of creating and customizing your own waves. But if you have any doubts in particular about the wave system, I could help with that right away.

I’ve written a brief description of the wave spawning system in the toolkit. You can check it out here in an earlier post in this thread: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=349206&viewfull=1#post349206

My video creation skills are pretty bad, so I usually go ahead with doing a write up about the topics. But if the information mentioned above doesn’t clear your questions, then please let me know. I could also create demo videos to showcase the process. Meanwhile, I hope that you will find this helpful. Let me know if you have any doubts or suggestions regarding the same.

Thank you all very much for the in-depth responses. I’ll pour over what is here as soon as I can, and I really appreciate the help.

I have a few more questions. I’m really enjoying digging into this project. So,

  1. Is it possible to make enemies perceive towers as a threat? Ideally I’d like to have enemies ignore towers in terms of having navigation and when they approach the tower, instead of navigating around, they’d attack the tower until it’s dead and continue onwards. I guess this question has multiple components - tower health, tower threat to enemies, towers excluded from navigation considerations.
  2. Is it possible to have towers placed without the requirement of the the tower base? I’d like to place towers directly on the map without them sitting on the base.
  3. Is it possible to have tower placement not snap to the grid?

Like I said, I’ve spent hours with this so far and I’m really enjoying it. Thank you very much.

Hey SlightlyLive, glad to hear that you’re enjoying working on the toolkit. I’ll need some time to think over what’s the best way to implement the 1st & 3rd questions. So before that I’ll just start ahead with the 2nd one.

  1. The toolkit doesn’t have that functionality by default. I had thought about adding that as a functionality, but then realized that it would make the tower spawn handler really bloated. However that being said, there is a relatively easy way to implement what you’re asking. As you might have already noticed, there is a ‘BP_TrapActual’ class to add traps, which are directly added on the floor. You could use the trap spawning functionality ‘SpawnTrapHolographic’ & ‘SpawnTrapActual’ functions in the Tower Spawn Handler class] to place Attack Towers instead of Traps.

The fastest way to make a working prototype using this method is to set the ‘BP_TowerHoloClassRef’ & ‘BP_TowerActualClassRef’ to some Attack tower class when you input ‘6’ to select traps. You can do it as shown below from the ‘BP_FPSTDCharacter’ blueprint.

For example, I set both the Tower Holo & Tower Actual classes to ‘BP_LaserTowerHolo’ & ‘BP_LaserTowerActual’ respectively, when I select the Trap. So instead of placing traps, it places Laser Towers on the floor.

That should take care of the Tower spawning system. Next, in order to set the Tower cost right, set the Tower cost to Laser Tower Cost & Tower Type to Laser Tower, in the first screenshot, just prior to setting the holo and actual class variables. Now, all that should be left is to take care of destroying the tower. So inside the ‘DestroyActualTower’ function in Tower Spawn Handler class, where it handles the Attack Tower blueprints, change the ‘Cast to BP_TowerBaseActual’ to ‘BP_AttackTowerActualParent’, and that should do the trick. You can replicate the same process for all other Towers as well, by redirecting all the ‘SwitchOnTowerType’ to the Spawn Trap logic.

Regarding your third question, it might be possible to do what you’re asking with Collision overlaps. The reason why I’m using grid is to avoid doing that check and instead rely on stored data to determine whether a tower already occupies the place where you’re trying to spawn a new tower. If you want to do it without grid, you could change the collision response Holo Tower meshes to have them overlap with Attack towers and other solid objects in the level.

Now, when you look around the level, the Holo tower will begin and end overlap with objects that are on it’s way. Using this knowledge, you can allow the user to spawn a new tower if the holo tower is not overlapping with anything. On the other hand, if it’s overlapping with something, you do not allow the player to spawn a new tower.

Alright, now on to your first question. First of all, you would have to add a Health attribute in the Tower Actual parent class. Then add an ‘EventAnyDamage’ to register damage and thus ultimately destroy tower if it’s health goes down to zero. You probably wouldn’t have to do make any changes to navigation as such, but the AI threat detection and response behavior would have to be altered. I have a couple of ideas on how to implement that:

  1. You could use the existing threat detection system, built around the ‘VisionCheck’ function in the ranged & melee AI Bots. By default this function keeps checking if the player is within it’s range using a mix of distance, angular & line trace based checks. If you want to add towers to the list of potential targets, then at level start, get all towers in the level and add it into an array that can be accessed by your AI Bots at runtime. Keep updating this array everytime the player adds a new tower or when an existing tower is destroyed. Now that we have the towers, you could loop through the array and do vision checks to all these towers along with the one you do to detect the player. As soon as a bot detects a tower or player, stop it’s movement and vision check, and have it start attacking the target. As soon as the target is destroyed, it can continue on it’s path.

  2. You could use the AI Perception component built into the blueprints. Add the player character and all towers as AI Perception Stimuli Source. This will mean that the bots will use their AI perception to listen to the stimuli sources and detect them automatically when they’re within the specified sight range. Once the bot detects something, use the same logic as mentioned above in the first point.

I hope that covers all your questions. Let me know if you have any doubts anywhere.

Are there any known errors with the HUD? It isn’t working for me (4.9.2), the health and enemy health bar are just emtpy grey boxes and the wave number and ammo counter and r to reload don’t show up at all

There is one known HUD issue in v4.9 which completely hides the Tower Build HUD, when you untick ‘TimedWaveStarts?’ from the Wave Handler. This can be fixed by making the missing connection in the Tower Build HUD as shown:

[Image moved to attachment view]

This fix will be included in the next update, which will be submitted within a week. But from what you’ve said, the bug you encountered might be different from this. Could you please try this out and let me know if it makes any difference?

fc628e434a019f7328c6befcdabfdb85b7a087d5.jpeg

See above - the HUD is cut out and not showing correctly at all, even after that fix

Alright, thanks for posting the images. May I know the screen resolution that you’re using so that I can test it out. I think that the widget might be getting compressed so that only part of it becomes visible.

I am running my screen at 1080p, and UE4 is in windowed mode

Would you suggest trying to run the game fullscreen?

You could either try out fullscreen in standalone. Or you could just check if the resolution used for ‘Play in New Window’ under the ‘Play’ section in Editor Preferences is something different from 16:9. Also in either case, could you verify if the Tower Bases/Tower points value are changing when you spawn towers in the level?