GitHub Sponsor Patreon Discord Support

xxHash

xxHash Logo

Available for free on GitHub!

We’ve integrated xxHash into our Open 3D Engine (O3DE) toolchain as a high-performance, non-cryptographic hash function that powers some of our most critical systems, including GameplayTags, Lexicon Localisation, and Ogham Storyteller.

So, why xxHash? And how can it help your projects?


What is xxHash? #

Developed by Yann Collet, xxHash is an extremely fast hash algorithm designed for performance-critical applications. Unlike cryptographic hashes (like SHA-1 or MD5), xxHash prioritises speed and determinism over security, making it perfect for:

  • Asset caching (e.g., converting file paths to unique IDs)
  • String interpolation (e.g., generating deterministic IDs for game objects)
  • Data validation (e.g., checking if a configuration or save file has changed)
  • Fast lookups (e.g., using hashed strings as dictionary keys)

In O3DE, our xxHash Gem exposes C++, Script Canvas, and Lua, giving you three hash variants:

FunctionOutputUse Case
Hash32AZ::u32Legacy 32-bit hashing
Hash64AZ::u64Modern 64-bit (preferred for most cases)
Hash128AZ::Uuid128-bit hashing (returns a UUID)

Use Examples #

GameplayTags #

In our GameplayTags system, xxHash converts string-based tags (e.g., "FireDamage", "Player.Ally") into deterministic 64-bit integers. This allows for:

  • Fast comparisons (no string matching overhead)
  • Memory efficiency (storing tags as u64 instead of strings)
  • Cross-platform consistency (same tag = same hash on Windows, Linux, Android, etc.)

Lexicon Localisation #

Localisation systems often struggle with string lookups. With xxHash, we generate unique IDs for localisation keys (e.g., "Dialogue.Greeting.English"). This enables:

  • Instant lookups in large localisation tables O(log n)
  • Determinism xxHash’s determinism ensures the same string always hashes to the same value, while the system uses u64 human scripters can keep using the human friendly string key.
  • Seamless integration with O3DE’s reflection system

Ogham Storyteller #

In our Ogham Storyteller tool, xxHash helps track narrative states (e.g., "Quest.Started", "Character.Met.Blacksmith"). By hashing these states, we:

  • Avoid string comparisons in logic checks
  • Serialise narrative progress efficiently
  • Support branching stories without performance hits
  • Enable Condition logic and Operations on dialogue entries and dialogue links

Rate This Article!