playing in new editor window makes it work perfectly thanks, its just the pie window that is there automatically where it’s messed up
Awesome Then it’s probably an issue with the widget handling some odd aspect ratio incorrectly. Thanks for letting me know anyway. I’ll just double check on the common resolutions before submitting the next update.
**Update 5 (v1.5) [Compatible with v4.9 & v4.10 of Unreal Engine] project files now available on the Unreal Engine Marketplace. This update focuses primarily on optimization of Tower AI & simplification of the Tower Spawning system. Listed below is a brief overview of the code changes included in this update: **
-
The threat detection & handling logic for Shockwave Tower, Laser Tower, Sniper Tower, Machine Gun Tower & Trap classes have been optimized with a new & simplified workflow.
-
The Game Director class & it’s dependents, including the Behavior Tree have been completely phased out. The Tower Spawn Handler class now handles dynamic nav path validation when spawning Tower Bases. The nav path spline creation/updates logic have been moved to the Enemy Spawn Point class, while the Player Respawn logic now resides in the Game Mode class.
-
The Tower Spawn Handler code has been modified to always retrieve grid data directly from the Grid Arrays instead of occasionally using the data from Tower actors, in order to maintain consistency.
-
Changes to the grid data will be made directly to the Grid Arrays in the Game State class, instead of updating the temporary Grid Arrays within Tower Spawn Handler.
-
The collision responses for both Holographic & Actual Towers have been updated to focus only on the absolutely necessary parameters.
-
Local variables replace Global variables within functions & construction scripts of Towers & Tower Spawn Handler.
-
Added fix to a v1.4 bug responsible for hiding Tower Build HUD when Timed Waves were deactivated.
-
Replaced a potentially expensive operation from Wave Handler with more optimized workflow.
-
Replaced unnecessary casting operations with equivalent object references passed in as input parameters during class initialization events.
-
Improvements to visual design of Tower Spawn/Range Display.
-
Grid Data Structs updated to increase readability.
-
Minor code simplification for Player Character class.
That covers all the changes to be introduced in v1.5. This update along with the previous update cover most of the pressing issues regarding code optimization & bug fixes. Starting with the next update, the FPS Tower Defense Toolkit will be receiving additional features again.
[All relevant code changes within blueprints have been marked with the bool variable ‘Version1.5’ as well as comments designated with the prefix ‘Version 1.5’]
Documentation plus changes to be made in the Content Browser: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=349197&viewfull=1#post349197
Hey Stormrage256, Excellent looking kit & excellent customer communication. Always appreciate seeing a dev that’s willing to assist with a package after purchase. I’m currently working on a VR tower defense type game in Unity, but am thinking about switching over to UE4 after seeing this kit. I have a few questions before making the switch
- Do you use pooling for enemies, turrets, ect…? Basically, is everything pretty well optimized even for use on mobile?
- I’m currently using your common tower with hub rotation on Y axis and Weapon rotation on X/Z axis. Is this something that is included in your tower scripts or something you could easily implement?
- Referencing question 2, I see that you can place the build grids at any rotation (AWESOME). This is something that would greatly affect the towers rotation based on the common towers I explained. For example: I place a tower with common script on a plane with an angle greater than 0, now it’s all screwed up. Is this something that would be easy to implement?
- Is everything based on ray casting from a certain transform from the main camera, towers, enemies, etc? (Maybe there is be public drop down for adding multiple fire points?) This would be great if I’m going to be using the kit for for my game. For VR there is usually a ray cast from the main camera used for looking at and selecting objects, UI, etc…
For reference, you can check the current Unity asset I’m using: Unity Asset Store - The Best Assets for Game Making
I think that about covers it. Thanks for creating this and I look forward to hearing back
Hi ROMAD, thanks for your feedback. I have checked out the videos for the aforementioned toolkit as well, & it’s been an inspiration for me to keep working on new updates. I do not have plans for adding custom pathing, but I would definitely love to look into other features like perk system, global abilities, etc.
-
It does not use any sort of object pooling at the moment & hasn’t been optimized to be used on mobiles. Part of the reason is that I did not anticipate anyone coming up with the idea to use it on mobiles, since without VR, FPS games don’t typically work that well on mobiles. But now that you’ve mentioned it, I’ll keep that in mind when working on the future updates. I cannot promise it without creating a working prototype first, but I’ll let you know if it’s making it into the toolkit soon.
-
By common tower, are you referring to the Attack Tower parent class? If so, it does not directly have any inbuilt function to turn around since not all the turrets require this effect. Examples include aoe towers like shockwave and boost. However, if you check out the Sniper Tower, you’ll notice that it’s turret while attached to the tower at one end, is free to move in any direction. You can find this feature in the ‘Turn to Acquire Target’ function. Now since what you want is slightly different as you need the tower itself to rotate while limiting the degrees of freedom of the turret, it will require some minor changes. You can copy & implement the logic from screenshot below to achieve the required result at your end. If it feels satisfactory, you could just copy the function & function call logic to the tower parent itself.
[See attached Image]
Since the machine gun & sniper tower both have somewhat similar turret rotation, it’s kind of redundant. So I’ll replace the sniper tower turret rotation with the logic that you suggested so that it’s available out of the box. It should make it into the 6th update.
-
I will test out the above sniper tower code on an inclined plane and let you know if it needs any changes.
-
Yes the tower placement, grid detection, target health display on HUD, firing projectiles, etc are all based on ray casting from the main player camera. So if the camera is pointed directly at an enemy unit, the HUD displays its health. Similarly point it a grid generator and you get a holographic tower displayed at the focused grid cell, etc. I’m not sure if I understood what you meant by multiple fire points. Could you elaborate on that?
As for your third question, the default behavior for placement of towers on inclined grid generators is as depicted:
[Moved to attachment view]
As you can see, the towers/tower bases themselves are not rotated to match the rotation of the underlying grid generator, except in the xy plane. This makes sure that the towers are always in an upright position similar to what you would see in a game like Sanctum 2.
If what you intend to implement is about having the towers rotating with complete 360 degrees freedom, changing the spawning code to set the correct alignment is easy.
[Moved to attachment view]
However adjusting the tower plus turret rotation based on this & enemy AI location would require some more complex vector math.
Update 5 just went live on the marketplace. For more details, check out: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=445592&viewfull=1#post445592
FPS Tower Defense Toolkit: How to change tower meshes during tower upgrades
The most straight forward way to change the tower mesh would be to just access the Tower actor & replace it’s mesh when upgrading the tower stats. This can be done by extending the ‘UpgradeTower’ interface function implementation in the ‘BP_AttackTowerActual’ blueprint with the code to replace the static mesh used for the tower. Here’s a sample screenshot depicting the required modifications:
As for making animations for the same, I’m not very good with animations, but the above logic can be extended to call a new function that animates the tower. It might also require changing the base Tower mesh from a static mesh to a skeletal mesh. This way, it should be possible to have a tower raise it’s turrets or light up and do other sorts of cool stuff when they’re upgraded.
I’ve added a FAQ section at the end of the first post of the thread, based on the questions that I usually get from people. I hope to keep it updated regularly with new & relevant information. Here’s the quicklink: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=349194&viewfull=1#post349194
Wow, you’ve been busy, thanks for the lengthy reply. Everything looks/sounds great, should be switching over soon. “Multiple fire points” meaning the current tower is using multiple cannons and will be firing from multiple barrel ends. I’m used to, in Unity, being able to add the tower, select how many fire points, their transform (end of each barrel) and enter attributes, etc… I’m sure it’s easy enough in UE4. Look forward to seeing this mature, keep up the great work.
Cool, that shouldn’t be hard to implement. Let’s just take the example of Machine Gun Tower. By default, it has one turret named ‘TowerGun’ & an arrow component at the barrel end named ‘BulletDirectionArrow’. The arrow component is added as a child to the tower gun & always points in the direction of the turret. As a result, it will automatically update it’s direction based on the tower gun orientation.
[Image moved to attachment view]
You could add another tower gun plus arrow component alongside the original one.
Then within the ‘FocusTowerGunOnActiveTarget’ function, just add code to update the rotation of the new tower gun similar to how it’s done for the second tower. This will be useful if you want both tower guns to independently focus on the same target unit. If that’s not required, ignore this step.
Next step is to add an extra spawn projectile node similar to the existing one, but at the second tower arrow, within the ‘AttackActiveTarget’. With that you should be able to have multi turret towers working.
As an extra measure, you could add an extra line trace for the second tower gun while doing the vision check in the ‘FindTarget’.
FPS Tower Defense Toolkit Basics: Tower Manager
The ‘BP_TowerManager’ is one of the core actors in the FPS Tower Defense Toolkit & is primarily responsible for the management of towers at runtime. It handles the following functions:
- Build/Upgrade/Destroy towers.
- Keeps track of all Towers in the level through the “Towers” array.
- Enables players to have Towers Focus Fire on a single target.
- Dynamically updates Grid Data based on Tower placement.
- Enables setting of default Towers available to the player for each level using “BaseTowerModels” array.
- Stores info about the physical attributes of Tower Holograms in the ‘HoloConstructorData’ array.
FPS Tower Defense Toolkit Basics: Enemy AI
The FPS Tower Defense Toolkit has 3 different types of enemy AI bots: Core Bomber, Melee & Ranged. They’re derived from the parent class ‘BP_EnemyAI_Parent’, which houses the core logic for all types of enemy bots. These include moving toward the power core, turning to face a target, handling damage receive events as well as update calls to wave handler when the bot is destroyed.
-
Core Bomber: The Core Bomber bot is a slow moving unit with a large pool of hit points. It does not possess any threat detection logic. Apart from moving toward the Core, it’s only other functionality is to self destruct to do massive damage to the Core, which is handled through the custom event ‘Event Attack Active Target’.
-
Melee: The Melee bot has an intermediate level of speed & hit points when compared to the Core Bomber & the Ranged bot. It’s ‘Vision Check’ function continuously searches for the player character & determines if it’s within range using a combination of distance, angular & line trace checks. Once within the range of the player, it will move on to attack the player. If the player leaves it’s vision range, it reverts to it’s original state & moves on to attack the Core
-
Ranged: The Ranged bot is a fast moving offensive unit with ranged attacks. It has low hit points compared to the other bots. Like the Melee bot, it uses a ‘Vision Check’ function to search & attack the player if it’s within range. In addition to that, the Ranged bot can also mark the player as a target, if the player keeps attacking it from directions that are not within it’s direct vision range. This feature is handled by the function ‘Detect Target When Attacked’.
The Enemy AI Bots use the default nav mesh based pathfinding to dynamically alter their paths at runtime based on the placement of tower based around the level. They do not use any sort of crowd movement or inter bot collisions, but instead use randomized approach vectors from the Enemy Spawn Point towards the Power Core. This makes sure that the bots do not always end following the exact same paths even if the general path direction remains the same & hence prevents crowding at the exact same point near the Power Core.
I just want to say awesome job Stormrage256. Not only with the toolkit but the great support you are giving. I was thinking about purchasing it and after reading how well you respond to questions I’m going to pull the trigger. I’m new to Unreal Engine 4, coding and game design altogether so I figured getting a toolkit like this will help me learn blueprints by being able to see how everything works together and just jump in and play around with it.
Thanks for your generous feedback, scynoth. I hope that this will be a fun experience for you.
If you have any doubts or suggestions regarding the toolkit, feel free to contact me either through this forum or through the support mail @ rohitmohan.k@outlook.com.
I’ll probably get this once it has been updated to 4.11.
I think it would be a definite buy for many if it includes some basic vr and motion control support for menus and combat.
Hey Magneto, thanks for your suggestions. I will see if I can include the option to toggle between the normal Loadout HUD & a 3D Widget menu for the same. But since I don’t own a VR device or motion controller, VR specific features may not make it. But apart from the device specific requirements like input handling, if you have any ideas about the type of features you need in VR, I might be able to look into them to see if there can be a way to have them coexist with existing workflow. So any suggestions on that regard are welcome.
I’m almost done working on the next update. Since it’s going to bring about a lot of changes, I’m thinking of making it a v4.11 exclusive so that people who want the previous versions can download the v4.10 project files. So you can expect the v4.11 update soon after the official Engine update.
Sounds great if it’s not too much trouble. The vr stuff is still very new but we should know more in a few weeks time.
I was wondering about the possibility of allowing the player to remote control one or more turrets manually, either in game or possibly for a different kind of game mode?
Is it possible to easily change the scale of everything to a smaller play area?
Are flying enemies possible with the current setup?
Also is it possible to move the turrets around via matinee?
Sorry for all the questions.
-
Letting the player remote control towers is actually a cool idea. The closest thing that I can think of is the game Star Wars Republic Commando. In that game, when the player presses F while the targeting reticule is focused on an enemy, all his squadmates in range will start firing at that unit. Is that what you had in mind? Like highlight an enemy & all towers that have this unit in range would immediately stop it’s current course of action & set this enemy unit as the highest priority?
-
Yes, changing the scale of the system is quite easy. You can check out this earlier post to see how to accomplish the same in the toolkit: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=439776&viewfull=1#post439776
-
I have never really tried out implementing a flying unit, it’s just one of those things that kept getting backlogged to future updates. The toolkit does not come with any default flying units, as all the units are using character movement components. But if you already have a basic idea in mind about the type of implementation you would require for a flying unit, I should be able to answer that question more clearly. If not, I’ll do some research on common flying AI implementations this weekend & let you know.
-
Unfortunately, my knowledge about using Matinee is pretty much non existent. So to be honest, I’m afraid I cannot give any accurate answer for that.
Please don’t apologize for asking questions. Some of the important features that made it into the toolkit like the idea of multiple wave spawning systems & traps were made possible because some one asked/suggested about them. Plus it really helps to realize new possibilities that I have never thought of like the remote controlled turrets you just mentioned, & possibly increase the quality of the toolkit.
-
Yeah that’s it. Although a free fire mode would be cool as an option for a single turret as well so it shoots where ever you point at regardless of how far. Im thinking of a weak and somewhat inaccurate option for emergencies with fire converging on location you point at.
-
Good to know thanks.
-
Anything simple will do for what i have in mind. If i can place a path in the air for some enemies to follow that would be great. Might be possible with an invisible floor?
-
No problem was just wondering.
Thanks.