Gamesys: Here Be Monsters – Updates and Hello, Neo4j
The Burning Monk reveals how Neo4j helps catch Bigfoot and makes the Alluring Goat
One of the more mature and most widely used graph database today is Neo4j, and whilst graph databases are most frequently associated with social data (friends, followers, etc.) thanks to the prominence of companies that are operating in that space, but they’re actually very powerful and scalable ways to store and query any form of highly connected and/or complex data in general and have use cases beyond modelling social data, including fraud detection and network management.
Disclosure : my employer, Gamesys, already uses Neo4j for a number of social features in our real money gaming business so the choice of using Neo4j was an obvious one since we already have both operational knowledge as well as site license within the company. I didn’t go through a careful venting process to decide which graph db to go with.
If you represent every item in the game, ever location, recipe, monster, fish, etc. as nodes on a graph and linking them with relationships such as:
- item A drops item B as loot
- item A is available at location X
- monster A can be lured by item B
- monster A can be caught by item B
you end up with something along the lines of:
This diagram illustrates the highly connected and complex nature of the data we’re dealing with, the result of us making a game where everything you can do and every item you find has a purpose and can be used for something else.
Each node and relationship also has a set of metadata associated with it, for instance the can_catch relationship contains the probability (or catch rate) whilst the Musket-teer Trap node contains the buy/sell price as well as stats of the trap and many more.
This diagram is also by no means an unconnected subset of the overall graph, for simplicity sake I have omitted many types of relationship and connected nodes. Visualizing the 5000+ nodes and around 25000 relationships in Gephi (using a Neo4j plugin), with the colour and size of the nodes representative of the number of connections it has, this is what the internal data model for Here Be Monster looks like from afar: