In the past few years, I’ve been thinking a lot about how to generate asset IDs ergonomically for game projects. My goals are:

  • Serialize the asset IDs.
  • Use the asset IDs at runtime, to identify and load assets.
  • Be able to say the asset IDs out loud.

This is super useful for client-server games, but can still be useful for offline games e.g. saving player progression. Also useful for streamlining team communication for e.g. outsourcing or bug tracking.

YouTube video IDs are a good example of capturing a huge number of assets with a compact number of characters. In the physical world, license plates are an excellent example of IDs that you can memorize and say out loud.

My requirements for an ID scheme:

  1. Reasonably high cardinality e.g. 2 million or more assets
  2. Reasonably easy to say out loud
  3. Should not easily, accidentally support inappropriate words

My requirements for an ID generator:

  1. Should be able to run completely in-process, no calling out to another process
  2. No collisions
  3. New IDs should be easy to re-generate manually, if needed

So for instance, the ID space should support just over 2 million assets. More is better, obviously. And if an ID is already in use and a user forcibly re-generates the ID, then it’s OK for the existing ID references to become invalid. The goal is to not have to re-generate unless it’s some emergency, in which case manual labor to remap an ID or fixup a saved ID feels OK.

UUIDv4 is a great default ID generator due to its ubiquity and being able to generate unique IDs client-side, but they have a number of shortcomings that don’t meet my requirements. Several newer ID generators have attempted to shore up some of the shortcomings of UUIDv4, but none of these really meet my requirements well.

I’ve determined I’ll need to make my own generator, but since I haven’t gotten to doing that yet, I wanted to aggregate the list of generators I’ve found for inspiration first. I’ll eventually follow this up with a post that describes my super clever solution!