Data Tables, Array of Structs? - Best practice for managing data in a game?

In a real-time game where the is a large (>100) number of AI actors. Each AI actor has a large (>20) set of constantly changing variables associated with it, representing concepts like health, stamina, speed, morale etc.

Looking at array of structs, there still appears to be issues, otherwise using them may have been a clear winner.

What would you suggest as the most efficient/best practice method which will allow us to:

  1. Store and save these variables using the savegame system.

  2. Present this data to the player in the form of table, which is orderable by any one of the variables.

  3. Rapidly access and update this data within the game.

These concepts are critical to any game which contains a large amount of editable data. Any real-time or turn-based form of strategy, management or builder game has these in common.

Apologies if it’s something which should be obvious - I have sacrificed a lot of time and an untold number of Chrome tabs searching for an answer, so at the very least if we can present a solution here it will be easily retrievable by others who come looking.

Thanks in advance for any answers!

I’m personally using nested arrays (arrays of structs that are themselves arrays). Like you’ve mentioned there are still issues with such arrays, but I’ve found a workaround that works for me until Epic finds an official solution. I’ve replied to the AnswerHub post you linked to, but I’ll post my answer here as well. Depending on what you want to do it might not be the ideal way of doing things

Thanks for the reply - I really appreciate it.

As far as making sorted tables is concerned, do you have any recommendation? It seems silly that everyone should have to write functions for “sort this array of structs by the highest/lowest integer” or “get me the top 5 structs by variable X” when they’re so universally relevant.

The way i do it in my game is mysql database connected through php for dynamically changing data this handles login, inventory, player profiles, user settings etc. Then for what i call constant data i use datatables. Eg things that wont or dont need to change like item names, unit names etc. Then once i get in game i transfer all the data i need for the actual game into arrays or structs so i can alter and change it as needed . Once the game ends or player logs out i call my custom save game/data function/ events which only takes things that have changed in the game and alters the database. The datatables never get altered unless for instance i add a new item, unit, building, spell etc to the game .

I think rama has made a custom bp node that makes sorting arrays easier in his victory plugin. And ue4 are looking into the bug already. Another future possibility is being able to dynamically alter datatables as i believe hidden in c++ code there are functions to write data but it hasnt been implemented but if i read correctly it has been requested as an engine update and may become.viable in the future unless a forumer figures it out first and posts it up.

Easiest way is to make struct, then create array out of it. If needed make multiple arrays, then create functions to save, get or add elements.

But you asked about best way:
Best way is to make custom blueprint node in C++ that handles it all. Then expose it.