Memory cost of different attribute types?
Ignis
Member Posts: 72
Do any of you super-technical GS users have an idea how much memory/storage the different types of game attributes demand? As far as I know, "boolean" is the least-taxing, then "integer" is probably the 2nd-lowest, and perhaps "index" is at the highest end.
I mainly ask because, as I mentioned in a previous post, I want to learn as many game optimizing tactics early in the going, so when I naturally complicate my games and add more features, I can take performance issues into account and design accordingly.
I mainly ask because, as I mentioned in a previous post, I want to learn as many game optimizing tactics early in the going, so when I naturally complicate my games and add more features, I can take performance issues into account and design accordingly.
Comments
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Having said that, i don't use booleans, i don't trust em. (they break with spelling errors)
While I find it hard to trust *any* variables, Booleans, once rehabilitated, are alright in my book.
Just keep 'em away from me...
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I don't know what the performance hit is though. It seems like it would be next to nothing, no?
integer:32bits
float:32 or 64bits
index:32bits but half wasted since an index is just an integer that can't go negative.
text:8bits per character
8 bits in a byte. 1024 bytes in a kilobyte. 1024*1024 bytes in a megabyte.
your memory is mostly used by gfx and sound and logic. Not attribs.
mrfunkleberry... apologies, there was no need for my comment... I like your reply :-)
Back in the early days of game/graphics programming, you tried to use integers when and where possible. For translations and such, it was quite common to waste memory storing pre-computed floating-point based equation results in a lookup table (e.g. value of sine and cosine across the degrees of a circle) to avoid the cost of processing those floating-point based equations on-the-fly during game/demo runtime. It may have wasted valuable memory (so little back in the day) but it vastly improved performance.