Download

Connect large ammount of variables from game instance directly to widget UI or not?

I am making a tactical game with hundreds of variables with their data saved in Game Instance, which will be used in UI`s and various blueprints. Is it performance safe to connect all of those directly to UI widgets?

For example, I have 30 countries with their current happiness and economy etc. values stored in game instance (10 per country so 300+ total and prolly more eventually). Float and name variables mainly. Can I just connect those to their positions in widget menu without worrying about performance issues later? Or should I create local variables inside the UI itself when the UI is created, and only taking the global information from the game instance variables when the UI is displayed/upgraded?

If there is no huge performance gap in using the game instance for all, I rather go that way since then I dont have to juggle with the variables that much inside every blueprint/widget. But if there is I better start using that practice sooner than later.

Well this turned problematic. With 400ish variables in game instance, I even cannot select them to assign them in the menu widget, since the pulldown window breaks/bugs out flickering like a mad and you cant scroll it enough to find the variable I need.

Edit. Ah, I can still start typing the variable name and after writing few letters the menu is shorter and doesnt bug anymore. The menu breaking like that shows that this is probably not their intended way to manage things, even though it is simplest.

Maybe create a number of data structures. One basic one that all the countries can use. Then another for the World or Map variables. Then maybe one to hold the turn mechanics… It should be easier to find and mange them, save/load with the structures.

Yes, that could help. Now I have similarly folders in game instance for different variables, but when selecting them from widgets or casting to another actors, the folder structure is not available, which becomes messy.
This is not something I have needed to do in past projects, Ill have a look at the data structures tomorrow. If anyone happens to have a resourceful link/guide/hint where to get started, much appreciated.

You could also use Arrays, Lists, Enumerators, Data Tables and other types variable storage depending on your needs.

Data Table Explanation : https://www.youtube.com/watch?v=nt1hlJO-DPo

Data Structure Explanation : https://www.youtube.com/watch?v=2-tCCtkX1sk