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
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)

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.