Fireboar
Joined: 17 Feb 2008 Posts: 323
|
Posted: Sat Mar 06, 2010 15:10 Post subject: |
|
|
The first option is better. You really don't want to be adding a new coulmn for every NPC you create, and most of these values will be zero. I suggest, however, you make use of a link table.
player:
- id
- account
- character name
reputation:
- player_id
- npc
- reaction
Have reputation.player_id and reputation.npc a composite primary key for reputation, and player.id a primary key for player. player.id should be in a one-to-many relationship with reputation.player_id.
Then you can store the player id on the player as a local variable, and use a query on the reputation table. You could also use joins to eliminate the need to store player ID, but I find a lot of things work well if players each have their own row in a "players" table, and other systems link in from there using a unique ID for each person, therefore storing player ID as a local variable is the cleanest and most efficient way. |
|