modelling complex game economy with neo4j by yan cui at codemotion dubai

142
Modelling game economy with Neo4j

Upload: codemotion-dubai

Post on 10-Feb-2017

121 views

Category:

Design


1 download

TRANSCRIPT

Modelling game economy !with Neo4j

agenda

Hi, my name is Yan Cui.

1MILLION USERS

ACTIVEDAILY

250MILLION DAY

PERREQUEST

location

500+ Spots

locationepisodic

London 2012

Nan Jing 2013

locationepisodicmulti-player

herebemonstersgame.com

iPad

buddies

locationepisodicmulti-playerRPG

4000 Items

800 Recipes

1500+ Quests

100+ Monsters

gamebalancing

itemPricing

itemPricing

itemPricing

itemPricing

manual game balancing is SLOW

it is REPETITIVE

ERROR-PRONE!SUBJECTIVE

there must be a better way...

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

BIG

FOO

Tca

tchi

ng

location baitattraction rate

catch rate

as a graph in Neo4j

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

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

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

CatchRate = 0.774

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!…

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_inDropRate = 0.1

Bigfoot

Alice Lake

exists_in

Alluring Goat

can_attract

Bigfoot Toenail Clippings

Musket-teer Trap

lootscan_catch

Omar Lake

exists_in

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

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

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

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

8000+ Nodes

40000+ Edges

gamebalancing(revisited)

impact analysis

What’s the impact of upping

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

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

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

MATCH! !

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

-[:EXISTS_IN]->(spot)!

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

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 first.

No, catch ME first.

IS_USED_IN

ITEMMONSTERCAN_ATTRACT

ITEMMONSTERLOOTS

RECIPECRAFTS

MATCH!

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

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

-[:CAN_ATTRACT]->(monster2)!

RETURN monster1, monster2

∑(Bait Price * Attraction Rate)

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

IS_USED_IN

ITEMMONSTERCAN_ATTRACT

ITEMMONSTERLOOTS

RECIPECRAFTS

NEW monster !

= More competitor for bait!

= Lower attraction rate for

all monsters

getting data into NEO4J

version control Game Design data

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

allow multi-user editing

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

Publisher- Validate!- Localize!- Publish

Publisher

Flash iOS Server Neo4j

test data changes in isolation

preview changes on live

Localization

more text than first three Harry Porter books!

Step 1. !ingest gettext file

Step 2. !intercept string property setters

Step 3. !replace string

Step 4. !repeat for next language

intercept string property setters

intercept string property setters

replace string

replace string

target all DTOs!

auto-tuning trapping stats

Monsterstrength!speed!

intelligence

Trapstrength!speed!

technology

Monsterstrength!speed!

intelligence

Trapstrength!speed!

technology

Catch Rate %

trial-and-error

trial-and-errorlaborious

error-prone

sub-optimal

genetic algorithms(in F#)

auto-tuning baits

auto-tuning baits

LONDON 2.0we rewrote the entire season 1 !

quests to make them better.

TWICETHE FUN

SEASON 1

SEASON 1!(POST-REWRITE)

SEASON 2

STREAMLINEDMORE

QUALITY > QUANTITY

TWICETHE AMOUNT

SUPPORTTO

Neo4j to the rescue!

Thank you!

@theburningmonk

github.com/theburningmonk

theburningmonk.com