Game Pocket Monsters with NebulaGraph
- Visit Nebula Playground: Game_monsters
- Click on the search icon in the upper left corner and select the corresponding query method
- There are 3 ways to import data.
Method 1: VID query, and then click "Random Import" button, you can import some random vertex, such as the following show VID, and then click Add. monster001 monster002 monster003 monster025 monster026 monster133 monster134 monster135 monster136
Method 2: tag query, select tag and index, add a quantity limit, such as 50, click the plus sign, add a filtering condition condition, and then click explorer.
Method 3: Subgraph query, enter a vid, such as monster001, fill in 2 steps, choose monster_type for edge type, choose BOTH for direction, then click explorer.
- By this time the vertices should be displayed, you can double click them, or use the right sidebar to expand the conditions for edge expansion.
Details
Game business scenarios often encounter relationship problems, characters and characters, characters and monsters, pets, NPCs, props, etc.
With the traditional form of tables, it is impossible to find the required relationships intuitively, here we take the game as an example, using publicly available data to provide everyone online experience NebulaGraph graph database.
The structure of this game dataset, as shown in the figure:
Tag: monster, property, person
Vertex: 151 monsters, 9 properties, 13 characters
Edge: property relationship, damage doubling, damage halving, attribution, evolution relationship
Let's start by looking up something related to a famous 025 yellow monster.
- Go to the studio graph exploration screen.
- The top left corner confirms that we are currently in the Game_Monsters space (the space of the game dataset)
- Click on the search icon in the upper left corner and select the corresponding query method
- Enter vid: monster025
- Click to Add
You can find out the vertex of the yellow charged monster number 025. (VID is monster001 - monster151)
Double click on the point to automatically expand all related points
For example, you can see the vertex of a certain monster with a longer tail and a charged partner, 026, of the evolutionary relation 025.
At the same time click on the attribute display button, check the box to select the attributes we need to display, you can see the vertex in the figure corresponding to the value of the attribute. For example: name, attack power, defense power, etc.
In the result of the query, we can also see that there is a vertex for the attribute, and the tag for the monster attribute, with the same name.
How to build the data structure often needs to be designed by the user
Clicking on this attribute vertex will automatically expand it, at this vertex we can visually view all the monsters with electric attributes, each vertices shows the corresponding attribute value, and intuitively find all the monsters of the electric family.
With the right sidebar, we can also view the exact Tag of the current canvas.
Now, let's look up the character relationships
By vid query enter
person1
person2
person3
person4
person5
person6
person7
person8
person9
person10
person11
person12
person13
From the results, you can see 8 big city dojo directors, former champions, and 4 major divas
Double click on a person's vertex to see the monsters he has
Clicking on each monster allows us to quickly expand the relationship and find the attributes that are incompatible with each other
Double click on the restraining attribute to quickly expand a group of monsters with that attribute, and select the monsters you have to double the damage on the boss's monsters, or select the monsters that halve the damage for defense.
This is a typical way to use graphs for quick game strategy search, and they have a huge advantage over the traditional table format in terms of correlations.
We hope this public data demo is helpful for you to win the game.
If you are interested in the example, click Quick Start and try it out for yourself.
Reference:
Figure Exploration, Nebula Explorer Manual nGQL, CRUD manual