5 Replies - 593 Views - Last Post: 25 May 2011 - 05:42 PM Rate Topic: -----

#1 yellow24  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 01-February 09

game database layout

Posted 24 May 2011 - 10:24 PM

I am trying to create a database to hold some variables for an online game i am developing. I don't have a good background in MySQL put I understand PHP just well. My layout needs to be composed of user information like login/password as well as scores and achievements to the game and such. The challenging part I face is I want to keep checkpoints and have a record of every checkpoint a user reaches, also as the game will forever be expanding(hopefully) i will add more check points. I have no idea how to connect a user to his/her achieved checkpoints and not confuse them w/ all other users checkpoints. Thanks in advance for any help!

Is This A Good Question/Topic? 0
  • +

Replies To: game database layout

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9187
  • View blog
  • Posts: 34,489
  • Joined: 12-June 08

Re: game database layout

Posted 25 May 2011 - 06:54 AM

It's all about IDs. Your users will have a unique ID and that will be a key for most of your tables.

For instance... you can have a setup like this:

table: user_info
id (int) (k)
username (varchar)
userpassword (varchar)
dateinserted (datetime)
last_login (date time)
etc...

table: checkpoint

id (int) (k)
userid (int) (fk)
dateinserted (datetime)
check point data...


The checkpoint table would have a unique id for each check point, but would have the foreign key back to the user id column on the user table.

What you really need to do is read up on relational databases before you start out. Be it MYSQL or MSSQL. The concepts are transferable.

In a fit of awesome we have some great tutorials.

http://www.dreaminco...e-mysql-tables/
http://www.dreaminco...uction-to-keys/
http://www.dreaminco...-part-1-design/
http://www.dreaminco...-normalization/
http://www.dreaminco...6-mysql-basics/
Was This Post Helpful? 2
  • +
  • -

#3 yellow24  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 01-February 09

Re: game database layout

Posted 25 May 2011 - 09:15 AM

Thanks for the help, ill try to work with this, but is there anyway of linking 1 user account to multiple checkpoints? would i just need to add a new row in the table for every checkpoint a user gets? this seems like a poor management system, if not please let me know :)
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9187
  • View blog
  • Posts: 34,489
  • Joined: 12-June 08

Re: game database layout

Posted 25 May 2011 - 09:26 AM

Quote

would i just need to add a new row in the table for every checkpoint a user gets? this seems like a poor management system, if not please let me know


If you want a record of every checkpoint then yes you will need a row for every checkpoint. As I set it with a second table of two keys (that table/checkpoint id and the user id) and all your check point data.

Why would that sound like poor management system?
Was This Post Helpful? 1
  • +
  • -

#5 yellow24  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 01-February 09

Re: game database layout

Posted 25 May 2011 - 03:48 PM

i thought it would be poor because for every user that completes a checkpoint will need another row added onto his/her row. unless mysql is fast that would take time to view what checkpoints a user has done. maybe not haha, again not a ton of background in sql or how fast it runs :unsure:

thanks again for the help though i have a good idea on where to start now!
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9187
  • View blog
  • Posts: 34,489
  • Joined: 12-June 08

Re: game database layout

Posted 25 May 2011 - 05:42 PM

Nope.. that's how databases are - all sets of data. You won't add a new column - just a new row. Trust me - it's pretty fast on it's feet (millions of rows retrieved in less than a second, etc)... good stuff.

This post has been edited by modi123_1: 25 May 2011 - 05:42 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1