Modelling game economy with neo4j Oredev

776 views

Published on

In this talk I discussed the various ways in which we utilise Neo4j and data modelling with graphs to helps us model and automate the complex in-game economy in our MMORPG title Here Be Monsters.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
776
On SlideShare
0
From Embeds
0
Number of Embeds
599
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Modelling game economy with neo4j Oredev

  1. 1. Modelling game economy with Neo4j
  2. 2. Hi, my name is Yan Cui aka @theburningmonk
  3. 3. noSQL = MongoDB
  4. 4. stole from 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
  5. 5. stole from 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
  6. 6. Leonhard Euler invented Graph Theory in 1736, 275 years before Edgar Codd formulated the relational model
  7. 7. Seven Bridges of Königsberg Find a walk through the city that would cross each bridge once and only once.
  8. 8. Seven Bridges of Königsberg Eliminate features to leave just the land masses and the bridges.
  9. 9. Seven Bridges of Königsberg Land masses became vertices, and bridges became edges.
  10. 10. location
  11. 11. 500+ Spots
  12. 12. location episodic
  13. 13. Season 1 London
  14. 14. Season 2 Nan Jing
  15. 15. location episodic multi-player
  16. 16. herebemonstersgame.com iPad buddies
  17. 17. location episodic multi-player RPG
  18. 18. 4000 Items
  19. 19. 800 Recipes
  20. 20. 1500+ Quests
  21. 21. 100+ Monsters
  22. 22. game balancing
  23. 23. item Pricing
  24. 24. item Pricing
  25. 25. item Pricing
  26. 26. item Pricing
  27. 27. I’ll just change this one thing…
  28. 28. manual game balancing is SLOW
  29. 29. it is REPETITIVE
  30. 30. ERROR-PRONE SUBJECTIVE
  31. 31. there must be a better way...
  32. 32. Hello, Neo4j The rabbit hole sounds pretty good right about now!
  33. 33. BIGFOOT catching
  34. 34. location bait attraction rate catch rate
  35. 35. as a graph in Neo4j
  36. 36. Bigfoot Alice Lake exists_in Alluring Goat can_attract Bigfoot Toenail Clippings Musket-teer Trap loots can_catch Omar Lake exists_in
  37. 37. 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
  38. 38. 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
  39. 39. 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 …
  40. 40. 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
  41. 41. Bigfoot Alice Lake exists_in Alluring Goat can_attract Bigfoot Toenail Clippings Musket-teer Trap loots can_catch Omar Lake exists_in
  42. 42. 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_make Goat Honey Yeti Fur requires loots makes Alluring Goat Recipe requires requires Beeswax loots Bee Hive harvests McDonald’s Farm sells loots Goat’s Milk harvests London exists_in Peryton Fawn Decoy Recipe requires Peryton Fawn Decoy makes
  43. 43. 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_make Goat Honey Yeti Fur requires loots makes Alluring Goat Recipe requires requires Beeswax loots Bee Hive harvests McDonald’s Farm sells loots Goat’s Milk harvests London exists_in Peryton Fawn Decoy Recipe requires Peryton Fawn Decoy makes
  44. 44. 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_make Goat Honey Yeti Fur requires loots makes Alluring Goat Recipe requires requires Beeswax loots Bee Hive harvests McDonald’s Farm sells loots Goat’s Milk harvests London exists_in Peryton Fawn Decoy Recipe requires Peryton Fawn Decoy makes
  45. 45. 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_make Goat Honey Yeti Fur requires loots makes Alluring Goat Recipe requires requires Beeswax loots Bee Hive harvests McDonald’s Farm sells loots Goat’s Milk harvests London exists_in Peryton Fawn Decoy Recipe requires Peryton Fawn Decoy makes
  46. 46. game balancing (revisited)
  47. 47. impact analysis
  48. 48. What’s the impact of upping the price of “White Bread”?
  49. 49. CRAFTS RECIPE ITEMITEM IS_USED_IN
  50. 50. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  51. 51. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb Node-[rel]->Node
  52. 52. CRAFTS RECIPE ITEMITEM IS_USED_IN Node-[rel]->Node
  53. 53. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  54. 54. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  55. 55. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  56. 56. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  57. 57. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  58. 58. 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 RECIPE IS_USED_IN CRAFTS
  59. 59. 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 RECIPE IS_USED_IN CRAFTS
  60. 60. MATCH (wb:BaseItem { Name:"White Bread"}) -[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem) RETURN i, rel, wb
  61. 61. 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 RECIPE IS_USED_IN CRAFTS
  62. 62. 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 RECIPE IS_USED_IN CRAFTS
  63. 63. 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 RECIPE IS_USED_IN CRAFTS
  64. 64. 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 RECIPE IS_USED_IN CRAFTS
  65. 65. scarcity analysis
  66. 66. How scarce is “Durian” compared to “Dragonfruit”?
  67. 67. EXISTS_IN FRUIT TREE SPOTFRUIT FORAGES
  68. 68. MATCH (fruit)<-[:FORAGES]-(tree) -[:EXISTS_IN]->(spot) WHERE fruit.Name=‘Durian’ OR fruit.Name=‘Dragonfruit’ RETURN fruit, tree, spot
  69. 69. MATCH (fruit)<-[:FORAGES]-(tree) -[:EXISTS_IN]->(spot) WHERE fruit.Name=‘Durian’ OR fruit.Name=‘Dragonfruit’ RETURN fruit, tree, spot Node<-[r1]-Node-[r2]->Node
  70. 70. EXISTS_IN FRUIT TREE SPOTFRUIT FORAGES Node<-[r1]-Node-[r2]->Node
  71. 71. MATCH (fruit)<-[:FORAGES]-(tree) -[:EXISTS_IN]->(spot) WHERE fruit.Name=‘Durian’ OR fruit.Name=‘Dragonfruit’ RETURN fruit, tree, spot
  72. 72. quest lines
  73. 73. AWARDS QUEST ITEMITEM REQUIRES UNLOCKS
  74. 74. What quests come after “Year of the Horse”?
  75. 75. MATCH (q1:Quest { Name: “Year of the Horse” }) -[:UNLOCKS] ->(q2:Quest) RETURN q1, q2
  76. 76. How do you model quest progression?
  77. 77. 1. Price Items 2. Enrich Model 3. “Price” Quests
  78. 78. monster hierarchy
  79. 79. Catch me first. No, catch ME first.
  80. 80. IS_USED_IN CAN_ATTRACT ITEMMONSTER LOOTS RECIPE CRAFTSITEMMONSTER
  81. 81. MATCH (monster1:Monster)-[:LOOTS]->(loot) -[r:IS_USED_IN | CRAFTS*0..]->(bait) -[:CAN_ATTRACT]->(monster2) RETURN monster1, monster2
  82. 82. MATCH (monster1:Monster)-[:LOOTS]->(loot) -[r:IS_USED_IN | CRAFTS*0..]->(bait) -[:CAN_ATTRACT]->(monster2) RETURN monster1, monster2
  83. 83. Monster 1Monster 2 Quest 1 Quest 2 Unlocks Unlocks
  84. 84. Monster 1Monster 2 Quest 1 Quest 2 Unlocks Unlocks Requires Requires
  85. 85. successful catch = loot + gold
  86. 86. ∑(Bait Price * Attraction Rate) Input = Output ( ∑(Loot Price * Drop Rate) + Gold ) * Success Rate
  87. 87. IS_USED_IN CAN_ATTRACT ITEMMONSTER LOOTS RECIPE CRAFTSITEMMONSTER
  88. 88. NEW monster = More competitor for bait = Lower attraction rate for all monsters
  89. 89. getting data into NEO4J
  90. 90. version control Game Design data
  91. 91. allow multi-user editing
  92. 92. GitFlow - branching strategy for Git - used by all our developers
  93. 93. Publisher - Validate - Localize - Publish
  94. 94. Publisher Flash iOS Server Neo4j
  95. 95. test data changes in isolation
  96. 96. preview changes on live
  97. 97. auto-tuning trapping stats
  98. 98. genetic algorithms (in F#)
  99. 99. graphdatabases.com
  100. 100. bit.ly/1cmf7h1
  101. 101. @theburningmonk theburningmonk.com github.com/theburningmonk

×