modelling game economy with neo4j oredev

126
Modelling game economy with Neo4j

Upload: yan-cui

Post on 18-Jan-2017

779 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Modelling game economy with neo4j Oredev

Modelling game economy with Neo4j

Page 2: Modelling game economy with neo4j Oredev

Hi, my name is Yan Cuiaka @theburningmonk

Page 3: Modelling game economy with neo4j Oredev

noSQL = MongoDB

Page 4: Modelling game economy with neo4j Oredev

stolefrom

lovesloves

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

Page 5: Modelling game economy with neo4j Oredev

stolefrom

lovesloves

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

episodeepisode

Page 6: Modelling game economy with neo4j Oredev

Leonhard Eulerinvented Graph Theory in 1736,

275 years before Edgar Codd formulated the relational model

Page 7: Modelling game economy with neo4j Oredev

Seven Bridges of Königsberg

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

Page 8: Modelling game economy with neo4j Oredev

Seven Bridges of Königsberg

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

Page 9: Modelling game economy with neo4j Oredev

Seven Bridges of Königsberg

Land masses became vertices, and bridges became edges.

Page 10: Modelling game economy with neo4j Oredev
Page 11: Modelling game economy with neo4j Oredev

location

Page 12: Modelling game economy with neo4j Oredev
Page 13: Modelling game economy with neo4j Oredev
Page 14: Modelling game economy with neo4j Oredev
Page 15: Modelling game economy with neo4j Oredev

500+ Spots

Page 16: Modelling game economy with neo4j Oredev

locationepisodic

Page 17: Modelling game economy with neo4j Oredev

Season 1 London

Page 18: Modelling game economy with neo4j Oredev

Season 2 Nan Jing

Page 19: Modelling game economy with neo4j Oredev

locationepisodicmulti-player

Page 20: Modelling game economy with neo4j Oredev

herebemonstersgame.com

iPad

buddies

Page 21: Modelling game economy with neo4j Oredev

locationepisodicmulti-playerRPG

Page 22: Modelling game economy with neo4j Oredev

4000 Items

Page 23: Modelling game economy with neo4j Oredev

800 Recipes

Page 24: Modelling game economy with neo4j Oredev
Page 25: Modelling game economy with neo4j Oredev

1500+ Quests

Page 26: Modelling game economy with neo4j Oredev
Page 27: Modelling game economy with neo4j Oredev

100+ Monsters

Page 28: Modelling game economy with neo4j Oredev
Page 29: Modelling game economy with neo4j Oredev
Page 30: Modelling game economy with neo4j Oredev

gamebalancing

Page 31: Modelling game economy with neo4j Oredev

itemPricing

Page 32: Modelling game economy with neo4j Oredev

itemPricing

Page 33: Modelling game economy with neo4j Oredev

itemPricing

Page 34: Modelling game economy with neo4j Oredev

itemPricing

Page 35: Modelling game economy with neo4j Oredev

I’ll just change this one thing…

Page 36: Modelling game economy with neo4j Oredev
Page 37: Modelling game economy with neo4j Oredev

manual game balancing is SLOW

Page 38: Modelling game economy with neo4j Oredev

it is REPETITIVE

Page 39: Modelling game economy with neo4j Oredev

ERROR-PRONESUBJECTIVE

Page 40: Modelling game economy with neo4j Oredev

there must be a better way...

Page 41: Modelling game economy with neo4j Oredev

Hello, Neo4jThe rabbit hole sounds pretty good right about now!

Page 42: Modelling game economy with neo4j Oredev

BIG

FOO

Tca

tchi

ng

Page 43: Modelling game economy with neo4j Oredev

location baitattraction rate

catch rate

Page 44: Modelling game economy with neo4j Oredev

as a graph in Neo4j

Page 45: Modelling game economy with neo4j Oredev

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Page 46: Modelling game economy with neo4j Oredev

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Strength = 502Speed = 201Intelligence = 184

Strength = 420Speed = 210Technology = 240

Page 47: Modelling game economy with neo4j Oredev

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 48: Modelling game economy with neo4j Oredev

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Buy Price = 20BNSell Price = 482 GoldSellable = true…

Page 49: Modelling game economy with neo4j Oredev

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_inDropRate = 0.1

Page 50: Modelling game economy with neo4j Oredev

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Page 51: Modelling game economy with neo4j Oredev

BigfootAlice Lake

exists_in

Alluring Goatcan_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 Recipe

requires

Peryton Fawn Decoy

makes

Page 52: Modelling game economy with neo4j Oredev

BigfootAlice Lake

exists_in

Alluring Goatcan_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 Recipe

requires

Peryton Fawn Decoy

makes

Page 53: Modelling game economy with neo4j Oredev

BigfootAlice Lake

exists_in

Alluring Goatcan_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 Recipe

requires

Peryton Fawn Decoy

makes

Page 54: Modelling game economy with neo4j Oredev

BigfootAlice Lake

exists_in

Alluring Goatcan_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 Recipe

requires

Peryton Fawn Decoy

makes

Page 55: Modelling game economy with neo4j Oredev
Page 56: Modelling game economy with neo4j Oredev
Page 57: Modelling game economy with neo4j Oredev
Page 58: Modelling game economy with neo4j Oredev

gamebalancing(revisited)

Page 59: Modelling game economy with neo4j Oredev

impact analysis

Page 60: Modelling game economy with neo4j Oredev

What’s the impact of upping

the price of “White Bread”?

Page 61: Modelling game economy with neo4j Oredev

CRAFTS

RECIPE

ITEMITEM

IS_USED_IN

Page 62: Modelling game economy with neo4j Oredev

MATCH

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

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

->(i:BaseItem)

RETURN i, rel, wb

Page 63: Modelling game economy with neo4j Oredev

MATCH

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

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

->(i:BaseItem)

RETURN i, rel, wb

Node-[rel]->Node

Page 64: Modelling game economy with neo4j Oredev

CRAFTS

RECIPE ITEMITEM

IS_USED_IN

Node-[rel]->Node

Page 65: Modelling game economy with neo4j Oredev

MATCH

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

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

->(i:BaseItem)

RETURN i, rel, wb

Page 66: Modelling game economy with neo4j Oredev

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 Oredev

MATCH

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

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

->(i:BaseItem)

RETURN i, rel, wb

Page 68: Modelling game economy with neo4j Oredev

MATCH

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

-[rel:CRAFTS | IS_USED_IN*1..] ->(i:BaseItem)

RETURN i, rel, wb

Page 69: Modelling game economy with neo4j Oredev

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 Oredev
Page 71: Modelling game economy with neo4j Oredev

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEMCRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEM

CRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 72: Modelling game economy with neo4j Oredev

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEMCRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEM

CRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 73: Modelling game economy with neo4j Oredev

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 Oredev

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEMCRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEM

CRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 75: Modelling game economy with neo4j Oredev

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEMCRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEM

CRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 76: Modelling game economy with neo4j Oredev

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEMCRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEM

CRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 77: Modelling game economy with neo4j Oredev

RECIPE

White Bread

IS_USED_IN

ITEM

CRAFTS

MONSTERATTRACTS

RECIPE

IS_USED_IN

ITEMCRAFTS

ITEMLOOTS

RECIPEIS_USED_IN

ITEM

CRAFTS

IS_USED_IN

RECIPEIS_USED_IN

CRAFTS

Page 78: Modelling game economy with neo4j Oredev

scarcity analysis

Page 79: Modelling game economy with neo4j Oredev

How scarce is “Durian”

compared to “Dragonfruit”?

Page 80: Modelling game economy with neo4j Oredev

EXISTS_IN

FRUIT TREE

SPOTFRUIT

FORAGES

Page 81: Modelling game economy with neo4j Oredev

MATCH

(fruit)<-[:FORAGES]-(tree)

-[:EXISTS_IN]->(spot)

WHERE

fruit.Name=‘Durian’ OR

fruit.Name=‘Dragonfruit’

RETURN fruit, tree, spot

Page 82: Modelling game economy with neo4j Oredev

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 83: Modelling game economy with neo4j Oredev

EXISTS_IN

FRUIT TREE SPOTFRUIT

FORAGES

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

Page 84: Modelling game economy with neo4j Oredev

MATCH

(fruit)<-[:FORAGES]-(tree)

-[:EXISTS_IN]->(spot)

WHERE

fruit.Name=‘Durian’ OR

fruit.Name=‘Dragonfruit’

RETURN fruit, tree, spot

Page 85: Modelling game economy with neo4j Oredev
Page 86: Modelling game economy with neo4j Oredev
Page 87: Modelling game economy with neo4j Oredev
Page 88: Modelling game economy with neo4j Oredev

quest lines

Page 89: Modelling game economy with neo4j Oredev

AWARDS

QUEST

ITEMITEM

REQUIRES

UNLOCKS

Page 90: Modelling game economy with neo4j Oredev

What quests come after “Year of the Horse”?

Page 91: Modelling game economy with neo4j Oredev

MATCH

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

-[:UNLOCKS]

->(q2:Quest)

RETURN q1, q2

Page 92: Modelling game economy with neo4j Oredev
Page 93: Modelling game economy with neo4j Oredev
Page 94: Modelling game economy with neo4j Oredev

How do you model quest progression?

Page 95: Modelling game economy with neo4j Oredev

1. Price Items

2. Enrich Model

3. “Price” Quests

Page 96: Modelling game economy with neo4j Oredev

monster hierarchy

Page 97: Modelling game economy with neo4j Oredev

Catch me first.

No, catch ME first.

Page 98: Modelling game economy with neo4j Oredev

IS_USED_IN

CAN_ATTRACT

ITEMMONSTER

LOOTS

RECIPE

CRAFTSITEMMONSTER

Page 99: Modelling game economy with neo4j Oredev

MATCH

(monster1:Monster)-[:LOOTS]->(loot)

-[r:IS_USED_IN | CRAFTS*0..]->(bait)

-[:CAN_ATTRACT]->(monster2)

RETURN monster1, monster2

Page 100: Modelling game economy with neo4j Oredev

MATCH

(monster1:Monster)-[:LOOTS]->(loot)

-[r:IS_USED_IN | CRAFTS*0..]->(bait)

-[:CAN_ATTRACT]->(monster2)

RETURN monster1, monster2

Page 101: Modelling game economy with neo4j Oredev
Page 102: Modelling game economy with neo4j Oredev

Monster 1Monster 2

Quest 1 Quest 2Unlocks

Unlocks

Page 103: Modelling game economy with neo4j Oredev

Monster 1Monster 2

Quest 1 Quest 2Unlocks

Unlocks

Requires Requires

Page 104: Modelling game economy with neo4j Oredev

successful catch = loot + gold

Page 105: Modelling game economy with neo4j Oredev

∑(Bait Price * Attraction Rate)

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

* Success Rate

Page 106: Modelling game economy with neo4j Oredev

IS_USED_IN

CAN_ATTRACT

ITEMMONSTER

LOOTS

RECIPE

CRAFTSITEMMONSTER

Page 107: Modelling game economy with neo4j Oredev

NEW monster

= More competitor for bait

= Lower attraction rate for

all monsters

Page 108: Modelling game economy with neo4j Oredev

getting data into NEO4J

Page 109: Modelling game economy with neo4j Oredev
Page 110: Modelling game economy with neo4j Oredev

version control Game Design data

Page 111: Modelling game economy with neo4j Oredev

allow multi-user editing

Page 112: Modelling game economy with neo4j Oredev

GitFlow- branching strategy for Git - used by all our developers

Page 113: Modelling game economy with neo4j Oredev

Publisher- Validate - Localize - Publish

Page 114: Modelling game economy with neo4j Oredev

Publisher

Flash iOS Server Neo4j

Page 115: Modelling game economy with neo4j Oredev

test data changes in isolation

Page 116: Modelling game economy with neo4j Oredev

preview changes on live

Page 117: Modelling game economy with neo4j Oredev

auto-tuning trapping stats

Page 118: Modelling game economy with neo4j Oredev

genetic algorithms(in F#)

Page 119: Modelling game economy with neo4j Oredev
Page 120: Modelling game economy with neo4j Oredev
Page 121: Modelling game economy with neo4j Oredev
Page 122: Modelling game economy with neo4j Oredev
Page 123: Modelling game economy with neo4j Oredev
Page 124: Modelling game economy with neo4j Oredev

graphdatabases.com

Page 125: Modelling game economy with neo4j Oredev

bit.ly/1cmf7h1

Page 126: Modelling game economy with neo4j Oredev

@theburningmonktheburningmonk.comgithub.com/theburningmonk