ShikenNuggets / GadgetEngine

Yet another 3D game engine. But it's *my* 3D game engine :)
https://gamesbycarter.wordpress.com/2022/06/22/gadget-engine-c/
Other
2 stars 0 forks source link

Hashed String IDs #17

Closed ShikenNuggets closed 4 months ago

ShikenNuggets commented 4 months ago

Game engines need lots of strings, but comparing and passing around raw char arrays or std::string's can be very inefficient. Instead, we can hash the string to a 64-bit integer (32-bit also works but 64-bit significantly reduces the chance of a conflict) and use that as a reference, only getting the raw string when it's actually needed (displaying to user, debug ouput, etc).

ShikenNuggets commented 4 months ago

StringID is an adequate implementation of this concept. Currently it is not possible to generate StringIDs at compile time, but the core implementation is complete, so that will be done as part of a separate task: https://github.com/ShikenNuggets/GadgetEngine/issues/11