Jump to content

Inventory script/database


Zhyrios

Recommended Posts

i'm just having a little bit of a play around making a browser-based text RPG with PHP and mySQL. But when it comes to creating a system where a player can view their inventory, and for that matter -have- items. i just don't know where to begin.

Would i make a seperate database for inventories and have each column in the database be a different inventory slot and then have the value in that field be in reference to an item? like 1 = potion, 2= ether, etc?

with a large amount of items and inventory space for each player i don't want to get started down a long road on the wrong path.

 

To reiterate, I'm not asking for the code specifically i'm just asking what way I would go about it.

What would be the simplest, least headachey method of such a system?

Link to comment
https://forums.phpfreaks.com/topic/259321-inventory-scriptdatabase/
Share on other sites

It's a non-trivial schema, but in general terms, I'd recommend a standard normalized relational database design. 

 

-items table (one row for each possible item)

 

-worldItem (a row for an item that actually exists in the world)

 

-player (row per player)

 

-playerWorldItem (relates a worldItem to a player/slot)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.