I am looking to make a small rpg game using php/mysql/javascript but I have a quick question, would it be better to store all data for items etc in the database. For instance a table called items, where the name, cost, sell cost, stats etc are in it for each item. Or would it be better to make php classes for each item and just store the item type and level in the database. If it is the last one, how would I go about doing this in the right way, I know how to make classes etc, but don’t understand how they would work in this situation.
Any advice would be nice, thanks.
I would recommend against making a specific class for each and every item; Instead make an some classes like WeaponItem, PotionItem, QuestItem which all inherits from an Item base class.
As for saving the data, It’s a matter of taste. As you’ll probably only access the item by key, you could just make some serialized arrays into files and manage them from a specific Item directory.
I would recommend you to take a peek at GameDev.net, they have tutorials and good forums for all things game programming.
Happy hacking!