modelling game economy with neo4j oscon

126
Modelling Game Economy with Neo4j Yan Cui (@theburningmonk)

Upload: yan-cui

Post on 25-Jan-2017

1.507 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Modelling game economy with Neo4j OSCON

Modelling Game Economy with Neo4j

Yan Cui (@theburningmonk)

Page 2: Modelling game economy with Neo4j OSCON
Page 3: Modelling game economy with Neo4j OSCON

1MILLION USERS

ACTIVEDAILY

Page 4: Modelling game economy with Neo4j OSCON

250MILLION DAY

PERREQUEST

Page 5: Modelling game economy with Neo4j OSCON

noSQL = MongoDB

Page 6: Modelling game economy with Neo4j OSCON

stolefromloves loves

enemy

enemyA Good

Man Goes to War

appeared in

appeared in

appeared in

appeared in

Victory of the Daleks

appeared inappeared in

companion

companion

enemyappeared in

appeared in

planet prop

species

species

species

character

character

character

episode

episode

Page 7: Modelling game economy with Neo4j OSCON

source : http://db-engines.com/en/ranking_categories

Page 8: Modelling game economy with Neo4j OSCON

Graph DBs are great for modelling complex domains

Page 9: Modelling game economy with Neo4j OSCON

Leonhard Eulerinvented Graph Theory in 1736

Page 10: Modelling game economy with Neo4j OSCON

Leonhard Eulerinvented Graph Theory in 1736

(that’s 275 years before Edgar Codd formulated the relational model)

Page 11: Modelling game economy with Neo4j OSCON

Find a walk through the city that would cross each bridge once and only once.

Page 12: Modelling game economy with Neo4j OSCON

Eliminate features to leave just the land masses and the bridges.

Page 13: Modelling game economy with Neo4j OSCON

Land masses became vertices, and bridges became edges.

Page 14: Modelling game economy with Neo4j OSCON
Page 15: Modelling game economy with Neo4j OSCON

location

Page 16: Modelling game economy with Neo4j OSCON
Page 17: Modelling game economy with Neo4j OSCON
Page 18: Modelling game economy with Neo4j OSCON
Page 19: Modelling game economy with Neo4j OSCON

500+ Spots

Page 20: Modelling game economy with Neo4j OSCON

locationepisodic

Page 21: Modelling game economy with Neo4j OSCON

Season 1 London

Page 22: Modelling game economy with Neo4j OSCON

Season 2 Nan Jing

Page 23: Modelling game economy with Neo4j OSCON

locationepisodicmulti-player

Page 24: Modelling game economy with Neo4j OSCON

herebemonstersgame.com

iPad

buddies

Page 25: Modelling game economy with Neo4j OSCON

locationepisodicmulti-playerRPG

Page 26: Modelling game economy with Neo4j OSCON

4000 Items

Page 27: Modelling game economy with Neo4j OSCON

800 Recipes

Page 28: Modelling game economy with Neo4j OSCON
Page 29: Modelling game economy with Neo4j OSCON

1500+ Quests

Page 30: Modelling game economy with Neo4j OSCON
Page 31: Modelling game economy with Neo4j OSCON

100+ Monsters

Page 32: Modelling game economy with Neo4j OSCON
Page 33: Modelling game economy with Neo4j OSCON
Page 34: Modelling game economy with Neo4j OSCON

gamebalancing

Page 35: Modelling game economy with Neo4j OSCON

itemPricing

Page 36: Modelling game economy with Neo4j OSCON

itemPricing

Page 37: Modelling game economy with Neo4j OSCON

itemPricing

Page 38: Modelling game economy with Neo4j OSCON

itemPricing

Page 39: Modelling game economy with Neo4j OSCON

I’ll just change this one thing…

Page 40: Modelling game economy with Neo4j OSCON
Page 41: Modelling game economy with Neo4j OSCON

manual game balancing is SLOW

Page 42: Modelling game economy with Neo4j OSCON

it is REPETITIVE

Page 43: Modelling game economy with Neo4j OSCON

ERROR-PRONE!SUBJECTIVE

Page 44: Modelling game economy with Neo4j OSCON

there must be a better way...

Page 45: Modelling game economy with Neo4j OSCON

Hello, Neo4j

Page 46: Modelling game economy with Neo4j OSCON

BIG

FOO

Tca

tchi

ng

Page 47: Modelling game economy with Neo4j OSCON

location baitattraction rate

catch rate

Page 48: Modelling game economy with Neo4j OSCON

as a graph in Neo4j

Page 49: Modelling game economy with Neo4j OSCON

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Page 50: Modelling game economy with Neo4j OSCON

nodes & edges can have!arbitrary properties

Page 51: Modelling game economy with Neo4j OSCON

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Strength = 502!Speed = 201!Intelligence = 184

Strength = 420!Speed = 210!Technology = 240

Page 52: Modelling game economy with Neo4j OSCON

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in CatchRate = 0.774

Page 53: Modelling game economy with Neo4j OSCON

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Buy Price = 20BN!Sell Price = 482 Gold!Sellable = true!…

Page 54: Modelling game economy with Neo4j OSCON

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_inDropRate = 0.1

Page 55: Modelling game economy with Neo4j OSCON

BigfootAlice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexists_

in

Yowie

Yetican_catch

can_catch

Apprentice’s Workshop

can_

mak

e

GoatHoney

Yeti Fur

requires

loots

mak

es

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

Page 56: Modelling game economy with Neo4j OSCON

BigfootAlice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexists_

in

Yowie

Yetican_catch

can_catch

Apprentice’s Workshop

can_

mak

e

GoatHoney

Yeti Fur

requires

loots

mak

es

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

Page 57: Modelling game economy with Neo4j OSCON

BigfootAlice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexists_

in

Yowie

Yetican_catch

can_catch

Apprentice’s Workshop

can_

mak

e

GoatHoney

Yeti Fur

requires

loots

mak

es

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

Page 58: Modelling game economy with Neo4j OSCON

BigfootAlice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexists_

in

Yowie

Yetican_catch

can_catch

Apprentice’s Workshop

can_

mak

e

GoatHoney

Yeti Fur

requires

loots

mak

es

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

Page 59: Modelling game economy with Neo4j OSCON
Page 60: Modelling game economy with Neo4j OSCON
Page 61: Modelling game economy with Neo4j OSCON
Page 62: Modelling game economy with Neo4j OSCON

gamebalancing(revisited)

Page 63: Modelling game economy with Neo4j OSCON

impact analysis

Page 64: Modelling game economy with Neo4j OSCON

What if I increase the price of

“White Bread”?

Page 65: Modelling game economy with Neo4j OSCON

CRAFTS

RECIPE ITEMITEM

IS_USED_IN

Page 66: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 67: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Node-[rel]->Node

Page 68: Modelling game economy with Neo4j OSCON

CRAFTS

RECIPE ITEMITEM

IS_USED_IN

Node-[rel]->Node

Page 69: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 70: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 71: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 72: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 73: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 74: Modelling game economy with Neo4j OSCON
Page 75: Modelling game economy with Neo4j OSCON
Page 76: Modelling game economy with Neo4j OSCON
Page 77: Modelling game economy with Neo4j OSCON
Page 78: Modelling game economy with Neo4j OSCON
Page 79: Modelling game economy with Neo4j OSCON

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEM

CRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEMCRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 80: Modelling game economy with Neo4j OSCON

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEM

CRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEMCRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 81: Modelling game economy with Neo4j OSCON

MATCH!

(wb:BaseItem { Name:"White Bread"})!

-[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 82: Modelling game economy with Neo4j OSCON

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEM

CRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEMCRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 83: Modelling game economy with Neo4j OSCON

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEM

CRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEMCRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 84: Modelling game economy with Neo4j OSCON

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEM

CRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEMCRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 85: Modelling game economy with Neo4j OSCON

scarcity analysis

Page 86: Modelling game economy with Neo4j OSCON

How scarce is “Durian”

compared to “Dragonfruit”?

Page 87: Modelling game economy with Neo4j OSCON

EXISTS_IN

FRUIT TREE SPOTFRUIT

FORAGES

Page 88: Modelling game economy with Neo4j OSCON

MATCH! !

(fruit)<-[:FORAGES]-(tree)-[:EXISTS_IN]->(spot)!

WHERE! !

fruit.Name=‘Durian’ OR!

fruit.Name=‘Dragonfruit’!

RETURN fruit, tree, spot

Page 89: Modelling game economy with Neo4j OSCON

MATCH! !

(fruit)<-[:FORAGES]-(tree)-[:EXISTS_IN]->(spot)!

WHERE! !

fruit.Name=‘Durian’ OR!

fruit.Name=‘Dragonfruit’!

RETURN fruit, tree, spot

Node<-[r1]-Node-[r2]->Node

Page 90: Modelling game economy with Neo4j OSCON

EXISTS_IN

FRUIT TREE SPOTFRUIT

FORAGES

Node<-[r1]-Node-[r2]->Node

Page 91: Modelling game economy with Neo4j OSCON

MATCH! !

(fruit)<-[:FORAGES]-(tree)-[:EXISTS_IN]->(spot)!

WHERE! !

fruit.Name=‘Durian’ OR!

fruit.Name=‘Dragonfruit’!

RETURN fruit, tree, spot

Page 92: Modelling game economy with Neo4j OSCON
Page 93: Modelling game economy with Neo4j OSCON

Durian

Dragonfruit

Page 94: Modelling game economy with Neo4j OSCON
Page 95: Modelling game economy with Neo4j OSCON
Page 96: Modelling game economy with Neo4j OSCON

quest lines

Page 97: Modelling game economy with Neo4j OSCON

AWARDS

QUEST ITEMITEM

REQUIRES

UNLOCKS

Page 98: Modelling game economy with Neo4j OSCON

What quests come after “Year of the

Horse”?

Page 99: Modelling game economy with Neo4j OSCON

MATCH!

(q1:Quest { Name: “Year of the Horse” })!

-[:UNLOCKS]!

->(q2:Quest) !

RETURN q1, q2

Page 100: Modelling game economy with Neo4j OSCON
Page 101: Modelling game economy with Neo4j OSCON
Page 102: Modelling game economy with Neo4j OSCON

How do you model quest progression?

Page 103: Modelling game economy with Neo4j OSCON

1. Price Items

2. Enrich Model

3. “Price” Quests

Page 104: Modelling game economy with Neo4j OSCON

monster hierarchy

Page 105: Modelling game economy with Neo4j OSCON

Catch me

No, catch ME

Page 106: Modelling game economy with Neo4j OSCON

IS_USED_IN

CAN_ATTRACT

ITEMMONSTER

LOOTS

RECIPE

CRAFTSITEMMONSTER

Page 107: Modelling game economy with Neo4j OSCON

MATCH! (monster1:Monster)-[:LOOTS]->(loot)! -[r:IS_USED_IN | CRAFTS*0..]->(bait)! -[:CAN_ATTRACT]->(monster2)!RETURN monster1, monster2

Page 108: Modelling game economy with Neo4j OSCON

MATCH! (monster1:Monster)-[:LOOTS]->(loot)! -[r:IS_USED_IN | CRAFTS*0..]->(bait)! -[:CAN_ATTRACT]->(monster2)!RETURN monster1, monster2

Page 109: Modelling game economy with Neo4j OSCON
Page 110: Modelling game economy with Neo4j OSCON
Page 111: Modelling game economy with Neo4j OSCON
Page 112: Modelling game economy with Neo4j OSCON
Page 113: Modelling game economy with Neo4j OSCON
Page 114: Modelling game economy with Neo4j OSCON

Monster 1Monster 2

Quest 1 Quest 2

Unlocks

Unlocks

Page 115: Modelling game economy with Neo4j OSCON

Requires

Monster 1Monster 2

Quest 1 Quest 2

Unlocks

Unlocks

Requires

Page 116: Modelling game economy with Neo4j OSCON

successful catch = loot + gold

Page 117: Modelling game economy with Neo4j OSCON

∑(Bait Price * Attraction Rate)

Input = Output( ∑(Loot Price * Drop Rate) + Gold ) * Success Rate

Page 118: Modelling game economy with Neo4j OSCON

IS_USED_IN

CAN_ATTRACT

ITEMMONSTER

LOOTS

RECIPE

CRAFTSITEMMONSTER

Page 119: Modelling game economy with Neo4j OSCON

NEW monster !

= More competitor for bait!

= Lower attraction rate for all monsters

Page 120: Modelling game economy with Neo4j OSCON

Graph DBs are great for modelling complex domains

Page 121: Modelling game economy with Neo4j OSCON

impact analysis

Page 122: Modelling game economy with Neo4j OSCON

fraud detection

Page 123: Modelling game economy with Neo4j OSCON

social networks

Page 124: Modelling game economy with Neo4j OSCON

recommendation engine

Page 125: Modelling game economy with Neo4j OSCON

graphdatabases.com

Page 126: Modelling game economy with Neo4j OSCON

Thank you!

@theburningmonktheburningmonk.comgithub.com/theburningmonk