Thanks for all the feedback, for some direct responses:
On 7/7/2017 at 4:31 PM, Khatharr said:
Yea, I am familiar with over engineering and am definitely guilty of doing that from time to time in my day job but under engineering is something that can also lead to bad things like a system that requires a lot of effort to work it or major / total rewrites. Just trying to find a good balance for my initial implementation so that whichever way I go over (which I am sure I will), it might be an easier refactor later down that road if that needs to happen.
9 hours ago, Xai said:Rutin's answer is how Bethesda handles this with the fallout and skyrim engines ... just loot at: http://www.ign.com/wikis/fallout-3/Item_Codes for an example. Everything's "item id" is just a 32 bit integer, which they write as 8 HEX digits (0-9 or A-F) so that you can recognize they are a game id at a glance.
I know about how game I have played in the past do handles thing like this however I am know that games like startbound has a string id or string to int id mapping (since you can do things like `/spawnitem wheat` in their in-game console) and pretty sure rim world is also similar based on the modding docs (http://rimworldwiki.com/wiki/Modding_Tutorials/Weapons) where none of the items seem to have an int or hex based id (closes thing that looks unique is `defName` which is a string).
---
I did some performance testing with a database of about 9000 base items loaded and when attempting to just use an int id in code to access data 10000 times, it took `0.00005` seconds and when when using a dictionary to get the int id, it takes `0.005` seconds. So while it is certainly a lot slower (by a factor of 100), I think this is an extreme case and I can't see any real reason I would ever need to try to access more then 100 items at a time (which is still an extreme case I think) so I think I am going to go with this pattern for the time being. I am always doing the conversion from string to int as the first thing and then using the int going forward so I am minimizing the amount of string -> int conversions.