SlideShare a Scribd company logo
1 of 126
Download to read offline
Modelling Game Economy
with Neo4j
Yan Cui (@theburningmonk)
1MILLION USERS
ACTIVE
DAILY
250MILLION DAY
PER
REQUEST
noSQL = MongoDB
stolefrom
loves loves
enemy
enemy
A Good
Man Goes
to War
appeared in
appeared in
appeared in
appeared in
Victory of
the Daleks
appeared in
appeared in
companion
companion
enemy
appeared in
appeared in
planet prop
species
species
species
character
character
character
episode
episode
source : http://db-engines.com/en/ranking_categories
Graph DBs are great for
modelling complex domains
Leonhard Euler
invented Graph Theory in 1736
Leonhard Euler
invented Graph Theory in 1736
(that’s 275 years before Edgar Codd
formulated the relational model)
Find a walk through the city that would cross
each bridge once and only once.
Eliminate features to leave just the land masses
and the bridges.
Land masses became vertices, and bridges
became edges.
location
500+ Spots
location
episodic
Season 1 London
Season 2 Nan Jing
location
episodic
multi-player
herebemonstersgame.com
iPad
buddies
location
episodic
multi-player
RPG
4000 Items
800 Recipes
1500+ Quests
100+ Monsters
game
balancing
item
Pricing
item
Pricing
item
Pricing
item
Pricing
I’ll just change this one thing…
manual game
balancing is SLOW
it is REPETITIVE
ERROR-PRONE!
SUBJECTIVE
there must be a
better way...
Hello, Neo4j
catchin
location bait
attraction rate
catch rate
as a graph in Neo4j
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
nodes & edges can have!
arbitrary properties
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
Strength = 502!
Speed = 201!
Intelligence = 184
Strength = 420!
Speed = 210!
Technology = 240
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
CatchRate = 0.774
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
Buy Price = 20BN!
Sell Price = 482 Gold!
Sellable = true!
…
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
DropRate = 0.1
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
Yowie
Yeti
can_catch
can_catch
Apprentice’s Workshop
can_m
ake
Goat
Honey
Yeti Fur
requires
loots
makes
Alluring Goat Recipe
requires requires
Beeswax
loots
Bee Hiveharvests
McDonald’s Farm
sells
loots
Goat’s Milk
harvests
London
exists_in
Peryton Fawn Decoy
requires
Peryton Fawn Decoy
makes
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
Yowie
Yeti
can_catch
can_catch
Apprentice’s Workshop
can_m
ake
Goat
Honey
Yeti Fur
requires
loots
makes
Alluring Goat Recipe
requires requires
Beeswax
loots
Bee Hiveharvests
McDonald’s Farm
sells
loots
Goat’s Milk
harvests
London
exists_in
Peryton Fawn Decoy
requires
Peryton Fawn Decoy
makes
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
Yowie
Yeti
can_catch
can_catch
Apprentice’s Workshop
can_m
ake
Goat
Honey
Yeti Fur
requires
loots
makes
Alluring Goat Recipe
requires requires
Beeswax
loots
Bee Hiveharvests
McDonald’s Farm
sells
loots
Goat’s Milk
harvests
London
exists_in
Peryton Fawn Decoy
requires
Peryton Fawn Decoy
makes
Bigfoot
Alice Lake
exists_in
Alluring Goat
can_attract
Bigfoot Toenail Clippings
Musket-teer Trap
loots
can_catch
Omar Lake
exists_in
Yowie
Yeti
can_catch
can_catch
Apprentice’s Workshop
can_m
ake
Goat
Honey
Yeti Fur
requires
loots
makes
Alluring Goat Recipe
requires requires
Beeswax
loots
Bee Hiveharvests
McDonald’s Farm
sells
loots
Goat’s Milk
harvests
London
exists_in
Peryton Fawn Decoy
requires
Peryton Fawn Decoy
makes
game
balancing
(revisited)
impact analysis
What if I increase
the price of
“White Bread”?
CRAFTS
RECIPE ITEMITEM
IS_USED_IN
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
Node-[rel]->Node
CRAFTS
RECIPE ITEMITEM
IS_USED_IN
Node-[rel]->Node
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
RECIPE
White Bread
IS_USED_IN
ITEM
CRAFTS
MONSTERATTRACTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
ITEM
LOOTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
IS_USED_IN
RECIPEIS_USED_IN
CRAFTS
RECIPE
White Bread
IS_USED_IN
ITEM
CRAFTS
MONSTERATTRACTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
ITEM
LOOTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
IS_USED_IN
RECIPEIS_USED_IN
CRAFTS
MATCH!
(wb:BaseItem { Name:"White Bread"})!
-[rel:CRAFTS | IS_USED_IN*1..]!
->(i:BaseItem)!
RETURN i, rel, wb
RECIPE
White Bread
IS_USED_IN
ITEM
CRAFTS
MONSTERATTRACTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
ITEM
LOOTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
IS_USED_IN
RECIPEIS_USED_IN
CRAFTS
RECIPE
White Bread
IS_USED_IN
ITEM
CRAFTS
MONSTERATTRACTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
ITEM
LOOTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
IS_USED_IN
RECIPEIS_USED_IN
CRAFTS
RECIPE
White Bread
IS_USED_IN
ITEM
CRAFTS
MONSTERATTRACTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
ITEM
LOOTS
RECIPE
IS_USED_IN
ITEM
CRAFTS
IS_USED_IN
RECIPEIS_USED_IN
CRAFTS
scarcity analysis
How scarce is
“Durian”
compared to
“Dragonfruit”?
EXISTS_IN
FRUIT TREE SPOTFRUIT
FORAGES
MATCH! !
(fruit)<-[:FORAGES]-(tree)-[:EXISTS_IN]->(spot)!
WHERE! !
fruit.Name=‘Durian’ OR!
fruit.Name=‘Dragonfruit’!
RETURN fruit, tree, spot
MATCH! !
(fruit)<-[:FORAGES]-(tree)-[:EXISTS_IN]->(spot)!
WHERE! !
fruit.Name=‘Durian’ OR!
fruit.Name=‘Dragonfruit’!
RETURN fruit, tree, spot
Node<-[r1]-Node-[r2]->Node
EXISTS_IN
FRUIT TREE SPOTFRUIT
FORAGES
Node<-[r1]-Node-[r2]->Node
MATCH! !
(fruit)<-[:FORAGES]-(tree)-[:EXISTS_IN]->(spot)!
WHERE! !
fruit.Name=‘Durian’ OR!
fruit.Name=‘Dragonfruit’!
RETURN fruit, tree, spot
Durian
Dragonfruit
quest lines
AWARDS
QUEST ITEMITEM
REQUIRES
UNLOCKS
What quests come
after “Year of the
Horse”?
MATCH!
(q1:Quest { Name: “Year of the Horse” })!
-[:UNLOCKS]!
->(q2:Quest) !
RETURN q1, q2
How do you model
quest progression?
1. Price Items
2. Enrich Model
3. “Price” Quests
monster hierarchy
Catch me
No, catch ME
IS_USED_IN
CAN_ATTRACT
ITEMMONSTER
LOOTS
RECIPE
CRAFTSITEMMONSTER
MATCH!
(monster1:Monster)-[:LOOTS]->(loot)!
-[r:IS_USED_IN | CRAFTS*0..]->(bait)!
-[:CAN_ATTRACT]->(monster2)!
RETURN monster1, monster2
MATCH!
(monster1:Monster)-[:LOOTS]->(loot)!
-[r:IS_USED_IN | CRAFTS*0..]->(bait)!
-[:CAN_ATTRACT]->(monster2)!
RETURN monster1, monster2
Monster 1Monster 2
Quest 1 Quest 2
Unlocks
Unlocks
Requires
Monster 1Monster 2
Quest 1 Quest 2
Unlocks
Unlocks
Requires
successful
catch
= loot + gold
∑(Bait Price * Attraction Rate)
Input = Output
( ∑(Loot Price * Drop Rate) + Gold ) * Success Rate
IS_USED_IN
CAN_ATTRACT
ITEMMONSTER
LOOTS
RECIPE
CRAFTSITEMMONSTER
NEW monster !
= More competitor for bait!
= Lower attraction rate for all monsters
Graph DBs are great for
modelling complex domains
impact analysis
fraud detection
social networks
recommendation
engine
graphdatabases.com
Thank you!
@theburningmonk
theburningmonk.com
github.com/theburningmonk

More Related Content

More from Yan Cui

How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
Yan Cui
 

More from Yan Cui (20)

How to win the game of trade-offs
How to win the game of trade-offsHow to win the game of trade-offs
How to win the game of trade-offs
 
How to choose the right messaging service
How to choose the right messaging serviceHow to choose the right messaging service
How to choose the right messaging service
 
How to choose the right messaging service for your workload
How to choose the right messaging service for your workloadHow to choose the right messaging service for your workload
How to choose the right messaging service for your workload
 
Patterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfPatterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdf
 
Lambda and DynamoDB best practices
Lambda and DynamoDB best practicesLambda and DynamoDB best practices
Lambda and DynamoDB best practices
 
Lessons from running AppSync in prod
Lessons from running AppSync in prodLessons from running AppSync in prod
Lessons from running AppSync in prod
 
Serverless observability - a hero's perspective
Serverless observability - a hero's perspectiveServerless observability - a hero's perspective
Serverless observability - a hero's perspective
 
How to ship customer value faster with step functions
How to ship customer value faster with step functionsHow to ship customer value faster with step functions
How to ship customer value faster with step functions
 
How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
 
Why your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSyncWhy your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSync
 
Build social network in 4 weeks
Build social network in 4 weeksBuild social network in 4 weeks
Build social network in 4 weeks
 
Patterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applicationsPatterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applications
 
How to bring chaos engineering to serverless
How to bring chaos engineering to serverlessHow to bring chaos engineering to serverless
How to bring chaos engineering to serverless
 
Migrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 stepsMigrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 steps
 
Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQL
 
FinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economyFinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economy
 
How to improve lambda cold starts
How to improve lambda cold startsHow to improve lambda cold starts
How to improve lambda cold starts
 
What can you do with lambda in 2020
What can you do with lambda in 2020What can you do with lambda in 2020
What can you do with lambda in 2020
 
A chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage awayA chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage away
 
How to debug slow lambda response times
How to debug slow lambda response timesHow to debug slow lambda response times
How to debug slow lambda response times
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 

Modelling game economy with Neo4j OSCON