Top Banner
Modelling game economy with Neo4j
142

Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Feb 10, 2017

Download

Design

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Modelling game economy !with Neo4j

Page 2: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

agenda

Page 3: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Hi, my name is Yan Cui.

Page 4: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 5: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

1MILLION USERS

ACTIVEDAILY

Page 6: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

250MILLION DAY

PERREQUEST

Page 7: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 8: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

location

Page 9: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 10: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 11: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 12: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

500+ Spots

Page 13: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

locationepisodic

Page 14: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

London 2012

Page 15: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Nan Jing 2013

Page 16: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

locationepisodicmulti-player

Page 17: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

herebemonstersgame.com

iPad

buddies

Page 18: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

locationepisodicmulti-playerRPG

Page 19: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

4000 Items

Page 20: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

800 Recipes

Page 21: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 22: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

1500+ Quests

Page 23: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 24: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

100+ Monsters

Page 25: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 26: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 27: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

gamebalancing

Page 28: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

itemPricing

Page 29: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

itemPricing

Page 30: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

itemPricing

Page 31: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

itemPricing

Page 32: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 33: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

manual game balancing is SLOW

Page 34: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

it is REPETITIVE

Page 35: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

ERROR-PRONE!SUBJECTIVE

Page 36: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

there must be a better way...

Page 37: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

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

Page 38: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

BIG

FOO

Tca

tchi

ng

Page 39: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

location baitattraction rate

catch rate

Page 40: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

as a graph in Neo4j

Page 41: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Page 42: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

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 43: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

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 44: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

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 45: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_inDropRate = 0.1

Page 46: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

Page 47: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

BigfootAlice Lake

exists_in

Alluring Goatcan_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexist

s_in

Yowie

Yetican_ca

tch

can_catch

Apprentice’s Workshop

can_make

GoatHoney

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 Recipe

requires

Peryton Fawn Decoy

makes

Page 48: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

BigfootAlice Lake

exists_in

Alluring Goatcan_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexist

s_in

Yowie

Yetican_ca

tch

can_catch

Apprentice’s Workshop

can_make

GoatHoney

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 Recipe

requires

Peryton Fawn Decoy

makes

Page 49: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

BigfootAlice Lake

exists_in

Alluring Goatcan_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexist

s_in

Yowie

Yetican_ca

tch

can_catch

Apprentice’s Workshop

can_make

GoatHoney

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 Recipe

requires

Peryton Fawn Decoy

makes

Page 50: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

BigfootAlice Lake

exists_in

Alluring Goatcan_attract

Bigfoot Toenail Clippings

Musket-teer Trap

loots

can_catch

Omar Lakeexist

s_in

Yowie

Yetican_ca

tch

can_catch

Apprentice’s Workshop

can_make

GoatHoney

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 Recipe

requires

Peryton Fawn Decoy

makes

Page 51: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 52: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

8000+ Nodes

Page 53: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

40000+ Edges

Page 54: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 55: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 56: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

gamebalancing(revisited)

Page 57: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

impact analysis

Page 58: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

What’s the impact of upping

the price of “White Bread”?

Page 59: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

CRAFTS

RECIPE

ITEMITEM

IS_USED_IN

Page 60: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

->(i:BaseItem)!

RETURN i, rel, wb

Page 61: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

->(i:BaseItem)!

RETURN i, rel, wb

Node-[rel]->Node

Page 62: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

->(i:BaseItem)!

RETURN i, rel, wb

Page 63: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

(wb:BaseItem { Name:"White Bread"})! -[rel:CRAFTS | IS_USED_IN*1..]!

->(i:BaseItem)!

RETURN i, rel, wb

Page 64: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

->(i:BaseItem)!

RETURN i, rel, wb

Page 65: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

RETURN i, rel, wb

Page 66: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

->(i:BaseItem)!

RETURN i, rel, wb

Page 67: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 68: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

scarcity analysis

Page 69: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

How scarce is “Durian”

compared to “Dragonfruit”?

Page 70: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

EXISTS_IN

FRUIT TREE

SPOTFRUIT

FORAGES

Page 71: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH! !

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

-[:EXISTS_IN]->(spot)!

WHERE! !

fruit.Name=‘Durian’ OR!

fruit.Name=‘Dragonfruit’!

RETURN fruit, tree, spot

Page 72: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

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 73: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH! !

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

-[:EXISTS_IN]->(spot)!

WHERE! ! fruit.Name=‘Durian’ OR! fruit.Name=‘Dragonfruit’!RETURN fruit, tree, spot

Page 74: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 75: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 76: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 77: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

quest lines

Page 78: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

AWARDS

QUEST

ITEMITEM

REQUIRES

UNLOCKS

Page 79: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

What quests come after “Year of the Horse”?

Page 80: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

-[:UNLOCKS]!

->(q2:Quest) !

RETURN q1, q2

Page 81: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 82: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 83: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

How do you model quest progression?

Page 84: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

1. Price Items

2. Enrich Model

3. “Price” Quests

Page 85: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

monster hierarchy

Page 86: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Catch me first.

No, catch ME first.

Page 87: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

IS_USED_IN

ITEMMONSTERCAN_ATTRACT

ITEMMONSTERLOOTS

RECIPECRAFTS

Page 88: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

MATCH!

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

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

-[:CAN_ATTRACT]->(monster2)!

RETURN monster1, monster2

Page 89: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 90: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 91: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

∑(Bait Price * Attraction Rate)

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

Page 92: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

IS_USED_IN

ITEMMONSTERCAN_ATTRACT

ITEMMONSTERLOOTS

RECIPECRAFTS

Page 93: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

NEW monster !

= More competitor for bait!

= Lower attraction rate for

all monsters

Page 94: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

getting data into NEO4J

Page 95: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 96: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

version control Game Design data

Page 97: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

What changed!When did it change!Why did it change!Who changed it

Page 98: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

allow multi-user editing

Page 99: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

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

Page 100: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Publisher- Validate!- Localize!- Publish

Page 101: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Publisher

Flash iOS Server Neo4j

Page 102: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

test data changes in isolation

Page 103: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

preview changes on live

Page 104: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Localization

Page 105: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

more text than first three Harry Porter books!

Page 106: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Step 1. !ingest gettext file

Page 107: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Step 2. !intercept string property setters

Page 108: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Step 3. !replace string

Page 109: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Step 4. !repeat for next language

Page 110: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 111: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

intercept string property setters

Page 112: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

intercept string property setters

Page 113: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

replace string

Page 114: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

replace string

Page 115: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

target all DTOs!

Page 116: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

auto-tuning trapping stats

Page 117: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Monsterstrength!speed!

intelligence

Trapstrength!speed!

technology

Page 118: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Monsterstrength!speed!

intelligence

Trapstrength!speed!

technology

Catch Rate %

Page 119: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

trial-and-error

Page 120: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

trial-and-errorlaborious

error-prone

sub-optimal

Page 121: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

genetic algorithms(in F#)

Page 122: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 123: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 124: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 125: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 126: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 127: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 128: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 129: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 130: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

auto-tuning baits

Page 131: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

auto-tuning baits

Page 132: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 133: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai
Page 134: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

LONDON 2.0we rewrote the entire season 1 !

quests to make them better.

Page 135: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

TWICETHE FUN

Page 136: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

SEASON 1

SEASON 1!(POST-REWRITE)

SEASON 2

Page 137: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

STREAMLINEDMORE

Page 138: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

QUALITY > QUANTITY

Page 139: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

TWICETHE AMOUNT

SUPPORTTO

Page 140: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Neo4j to the rescue!

Page 141: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

Thank you!

Page 142: Modelling complex game economy with Neo4j by Yan Cui at Codemotion Dubai

@theburningmonk

github.com/theburningmonk

theburningmonk.com