In the project that I am working on, I am constantly required to store data that will be used in the game. An example of this is that we have several categories for items, I had to store an array for each item category, which I did using a struct:
After I made the struct, I went into the character blueprint, and added the struct as a variable, in order to access it’s values. The problem with this is what happens if the struct’s variable happens to change? If there were a way to just access default struct values, they would be great, but I am not aware of any way to do this. I could of course use data tables, but AFAIK support for those in blueprints is very limited. I love using structs, but am required by the engine to make a variable for that struct in order to access its values.
Something I’d like to be able to do is do some sort of ‘Find Item’ function to find data that corresponds with that particular item, which AFAIK can’t be done with structs.
Are there any obvious ways to store data like that in the picture that I don’t know about? (I plan on doing this to account for data for hundreds of items)
You can do everything with data tables. Support is fine, documentation is the poor part.
I do all of my stuff with data tables. The tower defence game I am working on I use data tables for all of the towers and all of their stats etc. I use data tables for their combinations and upgrades. I use data tables for spawning the enemies along with all of their stats.
It’s great for balancing as it’s all done inside a spreadsheet and I just setup macro’s within the spreadsheet itself to calculate things on there and concat fields to get appropriate names from the other fields.
Another bonus is that since the data table is just an array it’s values are instantly in my blueprints and I don’t have to do any other work to have new towers. It took me a couple of days to have 2 towers working fully in my game, and then another couple of hours to have 80 different towers.
I am considering just putting my entire game up on the marketplace fully complete as these pieces are probably pretty useful for people.
Zoltan…you seem to have the spreadsheet tactics down pretty well. Any chance you can do some screenshots to show some examples of how a table could be set up? I think it could be useful to a lot of game makers but it seems to be one of the least covered items out there.
I took a look at data tables, and made one to test with, but what is the deal with the macro’s in order to get the data setup for UE4? .JSON files work fine to edit and re-import, but CSV files fail during the import process. Could you shed some light on this?
So the first picture is from an earlier version of my “TOWERS” datatable. You create all of these rows “EXCEPT FOR THE FIRST NAME ROW” as a custom struct. This holds all of the information about all of my towers. I have even more details in it in a later version where towers have special effects such as slow, burn, poison etc.
In the second picture is the event that I call when a tower is spawned in the game. I am doing some randomization things that you can ignore here but basics are find a tower name and then get the details for the tower with that name from the data table. I then set all my variables for the tower from this. So in my blueprints all that I have is a single “Tower” blueprint and all of it’s stats are set from the data table. Makes it very very easy to add or remove towers and change things without needing to worry about multiple different blueprints.