How RocksDB + Xapian Power the New Game Object Explorer #4
trieck
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🧩 How RocksDB + Xapian Power the New Game Object Explorer
In the latest release of BG3 Mod Studio (1.0.9), I added something I’ve wanted since the beginning:
a hybrid backend that combines RocksDB (structure) with Xapian (semantic full-text search) to power the new Game Object Explorer.
It turned out to be one of my favorite parts of the entire project.
🗄️ RocksDB → The Structural Backbone
RocksDB stores a complete object graph of the game using constant-time key/value lookup.
root:→ all top-level object categorieschild:<UUID>→ prefix scan returns all childrenparent:<UUID>→ enables backtracking to reconstruct hierarchyThis means the tree control can expand instantly, even with tens of thousands of objects.
No global scans.
No loading the entire graph.
No slow traversal.
Just direct structural access.
🔍 Xapian → The Semantic Layer
Xapian handles full-text search across all objects.
With a boolean term like:
TYPE:GameObjectsthe search automatically filters down to valid game objects.
Xapian provides:
Importantly: Xapian does not know anything about the hierarchy.
It only knows which objects match the query.
🧠 Combining Them
When no search is active:
root:objectschild:<UUID>prefix scansThis is the “hierarchy-first” view.
When a search query is active
We search Xapian using the user’s query.
From the top 1,000 search results, we extract the unique set of root types
(e.g.,
character,item,scenery, etc.).These determine which top-level graph branches will appear.
We populate the tree with these root-type nodes.
Each search result carries its own type, so we know exactly which root
categories must be created.
These root-type nodes serve as the attachment points for all reconstructed
hierarchy paths.
For each search result, fetch the corresponding RocksDB object via its UUID key.
For each RocksDB object, iteratively collect all of its parents
by following the
parent:<UUID>chain until no parent remains.This produces an ordered list from
leaf → parent → ... → root-type.Iterate the parent list in reverse (root-type downward), and for each node:
under the corresponding root-type node.
This reconstructs the complete hierarchy path.
Finally, insert the actual search result object into the tree
under its last existing parent node.
🌱 Semantic Matches Can Produce Non-Semantic Children
Once the search results are obtained, the Explorer treats each matched object as an
expandable node within the hierarchy. This has an important consequence:
A search match may have children that do not themselves match the search
query in any way.
These children appear because:
This means:
The resulting tree therefore contains:
they contain no relevant keywords.
This produces a search experience that preserves both meaning and structure:
you get the objects you asked for, plus the surrounding context required to
navigate them naturally within the game’s data model.
✨ Why This Architecture Works Well
The combination of RocksDB and Xapian provides a clear separation of concerns:
This design allows the system to remain fast, scalable, and easy to reason about.
RocksDB supplies the precise parent/child relationships, while Xapian identifies the relevant objects based on content.
Together, they produce a responsive and intuitive interface for navigating large game data sets.
Beta Was this translation helpful? Give feedback.
All reactions