Database Design in Games in Design Philosophy
|
|
How would I go about grabbing the information from the database? What would be the most efficient way?
PLAN A: Load all of the information on the world.startup (grab all of the item information from the table?)
PLAN B: Load the information whenever it's needed, ex,
select * from potions
where potion.id=5
( That would load the information bout the potion with the id of 5, the magic potion. )
But how would I transfer this to an object?
And how would I go about saving the items list? :(
|
Running database queries everytime you need to look up some information would probably be quite CPU intensive if you have a lot checks like this. I would be tempted to load it all into ram at the start.
Excluding player accounts of course, since they will grow very big very fast (lots of people creating players then never coming back). You won't need to load stuff from the accounts file very often anyway.