Download

What's the best way to store lots of parameters for many different but similar units and skills?

I’ve been working on a turn-based strategy game, and have a base unit class with many classes that inherit from that. The child classes are the actual turn-based units, and they share many similar properties such as movement range, health, etc. I’ve been looking into some ways to store all of this data so it is easily readable and modifiable, and structs of these properties seem to be a good avenue to explore. Is there a way to store a database of structs in the editor? I suppose I could create an array of structs and save that in a class, but perhaps there’s a better way.

Thanks for your help!

Perhaps DataAssets or DataTables are what you want. They are a way to manage struct-like data that you want to have easy access to. Data Driven Gameplay Elements | Unreal Engine Documentation

Say if you create a data asset class MyDataAsset and an instance of that Data1, your unit can have a MyDataAsset variable and you can select Data1 from a dropdown. Then at run-time you can access the values of Data1 via your variable.

To share values between units, you can have inheritance between DataAsset. To do this, create a blueprint off of MyDataAsset to set parent values. Then make a data asset from that blueprint.