Download

Tower Defense Starter Kit

Hi, I’ve provided some possible solutions below your post in the FPS Tower Defense Toolkit support thread.

Hello.
I discovered project structure couple days but can not find any way for rebuild widgets in to 3D widgets. Any suggestions please? I will be very grateful.Thanks.

Hello, all widgets used in the toolkit are stored in the main UI folder. Apart from the widgets listed under the subfolder ‘TowerConstructor’, all the remaining widgets are used either to display In-Game HUD or menu selection screens. You can display all of them through 3D widgets instead, but that will require the use of in-game actors with attached Widget Components. If you have not worked using widget components before, I’d suggest first going through the basics through some tutorials. Else, you can check out the ‘BP_GridCellDetector’ blueprint under the Gameplay Actors Folder as it uses a widget component to display the Tower Constructor (basically the set of buttons that allow you to create new towers when you click on a grid cell) UI elements in 3D space. Using a similar setup, you can essentially display other widgets as well.

Once you get that working, you can replace the code that adds 2D Widgets on to screen by something that spawns actors with 3D widgets. This is done through the ‘UpdateHUDState’ function in ‘BP_GameInstance’ blueprint. You can remove the existing logic (marked in red below) & instead spawn 3D widget actors to display the required UI elements.

Thanks for quick reply. I’m really appreciated. I’m very new in Unreal Engine but learning fast. I know how to make 3D widgets. But my main trouble is to make “Loadout menu” appeared in 3D space instead of 2D.

Well, the Loadout menu & Tower Selection Menu are displayed using the Update HUD State function I mentioned in the previous post. So basically you will need to disconnect the ‘Add New Widget To Viewport’ nodes for these two cases & instead add the code to remove the ‘Active HUD Widget’ so that you can remove any existing 2D UI elements already on the scene.

Now you will need to create a new actor with two widget components: one for the loadout menu & one for the tower selection menu. Set their’Receive Hardware Input’ parameter to true. Add widget interaction components for both of them as well.

Now search for ‘UpdateHUDState’ function calls across all blueprints, & whenever you detect a call to display either the Loadout Menu or Tower Selection Menu, just get the aforementioned actor & ask it display the appropriate menu through the 3D widget. So for example, when you want to display the tower selection, you ask the actor to hide the loadout menu widget component & make the tower selection one visible (check screenshot below).

Also wherever you see a cast from ‘Active HUD Widget’ to either the Loadout Menu/Tower Selection Menu widgets, replace the input parameter of the cast with the corresponding 3D Widget reference as shown in the example below:

This should get you started in the right direction. Of course, there are more things to do, like having the widgets always face the player. Also, unlike the default scenario where 2D widgets are removed & added to the viewport, there’s probably the matter of reinitializing the 3D widgets manually (since we’re only hiding/making them visible) when you move back & forth between loadout & tower selection menus, etc. But before moving on to that scenario, I think it would really help to have a better understanding of the following widget classes & their workflow: Widget_LoadoutMenu, Widget_TowerSelectionButton, Widget_TowerSelectionMenu, & Widget_HorizontalSelectionList.

The v2.2 update of Tower Defense Starter Kit has gone live on the marketplace.

v2.2 Change Log:

  1. Added support for using basic weight distributions to control the spawn probabilities for different types of AI classes. For an in-depth read, check out the dev log at: https://unrealpossibilities.blogspot.in/2018/02/tower-defense-starter-kit-v22-dev-log-1.html.

  2. Introduced a data-driven approach to spawning AI bots, with all core AI attributes accessible via a new Data Table. Check out the dev log for detailed information regarding the design at: https://unrealpossibilities.blogspot.in/2018/02/tower-defense-starter-kit-v22-dev-log-2.html.

  3. Replaced the Exit Point HP system with a decrementing Player Score model (similar to Kingdom Rush).

  4. Added a Player State class to handle player score calculations.

A free gameplay demo for the v2.2 edition of Tower Defense Starter Kit (Windows) can be downloaded from: Dropbox - File Deleted

All changes within the blueprints are tagged with the boolean variable ‘Version2_2’ [screenshot example below] in order to easily identify the alterations made in this update. Comments are also added to describe the major changes.

v22.jpg

Thanks a lot!. Will work in this way.

I saw your conversation with another member about tower upgrade paths but they had solved it themselves and so I may have missed it but I didn’t see specific information on a linear upgrade path where the mesh actually changes with the upgrades. It sounds like this would be done through the towertype enum. I’ve not worked with enums much but it seems like I would need to add the new stats for my upgraded tower into the enum and then hijack the upgrade function to change the towertype instead of just upgrading the existing towers stats. Am I on the right path?

Well, that depends on whether you just want upgraded towers to have a new mesh or to have a completely new tower with different functionalities (that is, anything that requires code changes). If you could provide that information, I could point you in the right direction.

As for the enums, they’re basically just a list of labels that you can use to categorize things. Unlike say, storing the names in a text array which allows anyone to type in random words, having the tower names in an enum means that you will have a well-defined list to work on, wherever you decide to use them. So, rather than the stats themselves being tied to the enum, the enum is used as an identifier to determine which stats info belong to which tower. All this information is held within the Tower Data Array in BP_GameInstance class.

Essentially each tower is able to be upgraded 2 times so 3 meshes total. Base mesh and each upgraded one. The upgrades will affect the tower stats but will not have new abilities.

For example take a cannon that deals splash damage. Initial build has a small cannon with splash damage area of 3. Upgrade it and new mesh appears as a larger cannon and splash damage area is set to 5.

Does that hat explain what I am looking for clearly?

**Stormrage256, i tried to make as you wrote. So my problems is:

  1. I didn’t find any UpdateHUDState cast to LoadOut or Tower Selection except in Widget_TowerSelectionButton.
  2. Some strange problems with connect Get All Actors of Class to Display Tower Selection. There is no Display Tower Selection function, LoadOut only.
    Here is the link to screencast: https://drive.google.com/file/d/1dWZ…ew?usp=sharing
    Thanks.**

About the splash damage, do you want to explicitly set the area for each upgrade level individually? I’m asking this because the toolkit uses a multiplier parameter to build on top of the base attributes whenever a tower gets upgraded. If you don’t want to use multipliers, then it would be better to have all of those upgrade information together with the upgraded mesh data in a new struct.

  1. I just checked it out, and you’re right. Those are the only ‘UpdateHUDState’ function calls that you need to worry about.

  2. I forgot to mention it the last time. I added those events to the new 3D widget actor to test it out. The ‘Get All Actors of Class’ function was used to get this actor. Here is a sample screenshot:

3dmenutrans.jpg

So you can make something like these, and call them. Also when you’re using ‘Get All Actors Of Class’ first grab it’s ‘Out Actors’ output, then get it’s first element to get the instance of the 3D Widget actor. Then call these new events through that. You can check out the screenshot from the earlier post for reference.

Stormrage256, it works! But now I put 3Dwidget in to scene and run program. After selecting level and game mode level loaded but with non working widget.

May be Loadout menu must called from here too?
Got some error

Alright, now that you’ve got the first part working, just make sure that the ‘Receive Hardware Input’ for the widget component is set to True. Also, you can try out a larger Draw Size to display the entire menu.

Then, if you haven’t added a widget interaction component, attach one each to the widget components. Then ensure that it’s settings match what’s shown in the screenshot below (you can change interaction distance based on how far away the widget can be from the camera):

Yes, you’ll have to call it from there as well. Later on, once you get everything working, you could try spawning the widget actor from there, & then store a reference to it. This way you won’t have to call the more expensive ‘GetAllActorsOfClass’ operation every time, & instead just use this reference variable to access the actor. When the game starts, you can destroy the 3D widget actor & clear its reference.

**Many thanks, Stormrage256. Now i see tower select menu appeared first, maybe I connect something incorrect. 20pm here so i will continue tomorrow. Thanks again.have a good time. **

Stormrage256, so can not understand why Tower selection menu appeared instead of Loadout

So i’m stack on calling Loadout menu here