Variable Question

Could i have around 1 million individual variables in my game without any downside?

That’s a vague question, but generally yes: 1 million of integers is only 4mb of memory, and generally memory is the only thing that limits you.

1 Like

Oh okay thats nothing, even if i have a few arrays and etc. Would you happen to have a list of memory useage per variable type?

Thanks

Would you happen to have a list of memory useage per variable type?

Since the engine based on c++, any basic c++ theory is fully applicable here. Complete answer may be found here, simplified is here.

Data structures like dynamic arrays or maps will also have a small memory overhead on top, size of classes is a sum of all underlying variables, etc.

But note that generally memory is almost never a question if you not going to do something really crazy (lets say anything below 10^7~10^8 instances is ok; not talking about networking or AActors, they have its own overhead). Usually the real question is execution time, and most relevant algos are aimed at reducing time, even if it’ll cost some memory on top.

2 Likes