creating a database for clash of clans (or similar game) -


i still brand new playing databases , wanting create tracking database few games clash of clans.

i unsure of how structure tables.

here end result: select user user inputs levels of buildings. stored in table.

the tricky part(at least me) determining buildings , levels available based upon user's current levels.

example: current level of user th7 , laboratory level 5 , spell factory 3

spells available @ th7 b c. factory level 3 spells b , laboratory spell can reach maximum of 3 , spell b can reach maximum of level 2.

my thought 1 giant table of permutations of buildings , prerequisites. doesn't seem right. on simplified?

keep in mind there mulitple buildings of same kind i.e. 5 archer towers, 5 cannons, etc.

my queries player current levels prereqs lookup building available current th level. determine buildings , levels missing. display those.

there nice webpage doing (clasofclans-tracker) want recreate own usage , adopt other games. more learning exercise else.

i'm not familiar clash of clans, can work example.

current level of user th7 , laboratory level 5 , spell factory 3

spells available @ th7 b c. factory level 3 spells b , laboratory spell can reach maximum of 3 , spell b can reach maximum of level 2.

first, we'll create object tables. in example, named user, laboratory, spell, , factory. generally, table names singular.

user ---- user id user name user game name user password user level ...  laboratory ---------- laboratory id laboratory name ...  spell ----- spell id spell name user level available factory level available ...  factory ------- factory id factory name ... 

we've created table each object. primary key these tables auto-generated integer call id.

now, these tables aren't useful. need create junction tables associate user other components of game.

the first junction table we'll discuss userlaboratory table.

userlaboratory -------------- user id laboratory id laboratory level 

this table associates (joins) user laboratory. laboratory level valid particular user , particular laboratory. primary key of table, might guess (user id, laboratory id).

in example, laboratory level 5.

the next junction table we'll discuss userfactory table.

userfactory ----------- user id factory id factory level 

this table identical userlaboratory table, except deals factories.

in example, factory level 3.

i think @ point can see how create remaining junction tables.

this process creating database.

  • extract out of object tables.
  • make sure object tables define 1 , 1 object.
  • create of junction tables.

good luck database endeavors.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -