Structure vs Objects. Which to use to organize a lot of datas?

Hey there,
in my project there is a very tall amount of datas (10.000 - 100.000 Objects / set of data).
First I organized everything as Objects. There were a lot of Objects with several variables and these objects had references to a lot of other objects witch also had several variables and references. And so on.

But when the “game” get starts, the computer is very slow - it stucks and sometime it crashed. (It is not problem of graphic - i use most simple/primitive Graphik)

I don’t understand, why performing the “game” causes such problems - because graphic is low and in the begin, the datas will not computed - they are just disposed.

Then I changed everything - i used structures instead of objects. But when I finished after a week, i experienced, that there is not a cognizable difference in the performance of the computer. The computer still have problems to run the “game” - it runs very slow und it stucks.

Now I wonder should I choose the way “using objects” or should I choose the way “using arr of structs”?

I found the hint "An actor currently takes up about 1016 bytes while an object takes up about 56 bytes. " - this shows, that using objects needs clearly less ressources than actors. But - I didn’t find any informations to compare structs and objects.

Do anyone have an idea - which needs less ressources - (a tall number of) Objects oder (a huge Array of) structures :man_shrugging:

Using structures which contains maps of structures which also contains maps of structure seems to be a terrible idea. It is a horrible effort to change a value in such a structure - a lot of make- and break-Methods (and set member of) have to be used. So I wonder wheather it would be better to change the way again - using objects again instead of using structures.

It would be great If someone could give some hints,
best regards :sunglasses: :four_leaf_clover: :+1:

Generally, the best way of arranging data and one that has proved to be successful in my last data driven levels project is first group data into structures (or a single structure if there isn’t many categories), and then create a DataTable of that DataStructure. Your data will be then stored in rows and each row’s data can be called and used during runtime. Keep in mind that you can’t edit the data stored in DataTables during runtime.

1 Like