Jump to content

structure


dose

Recommended Posts

What would be the best way anyone can think of for me to store the following info.

 

Game

achievments

earned

users

 

I have no idea how i should store all this info.. Im doing more than just 1 game could be hundreds same with the achievments and users..

 

ive thought about 1 table per user till i found out its bad.. then i was thinking of 1 table per game then a row for each achievment.. but i dunno where to go from there how i would add the rest of the info or to where and then link it all together..

Link to comment
Share on other sites

First thing you have to know is what are the relations to each other?

 

Example... a game can have zero to many different achievements or a user can only have one game... etc once you clarify that it is much easier to specify a data structure.

Link to comment
Share on other sites

game (id, name)

achievement (id, game_id, title, description, image_uri)

user (id, username, password)

achievement_collection (user_id, game_id, achievement_id, data)

 

Don't worry about the logic behind achieving an achievement as the game is responsible for this your database is responsible for storing it.

 

A query to select all achievements for user $uid filtered by game $gid:

SELECT a.*
FROM achievement_collection ac, achievement a
WHERE ac.user_id = $uid AND ac.game_id = $gid AND ac.achievement_id = a.id

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.