Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7649753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:03:09+00:00 2026-05-31T11:03:09+00:00

I’m making a browser MMO using PHP and MySQL. I’m hesitating between two ways

  • 0

I’m making a browser MMO using PHP and MySQL. I’m hesitating between two ways to implement player inventories :

  1. when crafted/dropped from a monster/found, an item creates a new row in the Items table, storing its type (instance of a dagger, of a potion…), its location (on the ground at tile X:Y ? in player Z’s inventory ?) and maybe an additional field or two. An item’s listing would look like this :
    id=728 ; type=14 ; location="i426" ; special="e8"
    (where “i426” would mean “in the inventory of player n°426”, and “e8” would mean the item has the enchantment n°8).
    Pros : I can store data about each individual item – enchantments, durability, previous owner… Also, the items are easily placed in any location; putting the items in, say, auction houses, comes for free with this system – not to mention crazy possibilities such as items inside items, etc.
    Cons : with hundreds of players looting monsters and crafting all day, this quickly creates a huge table, and it seems pretty wasteful. I fear this might slow down the whole game (I’m using a lot of AJAX voodoo) anytime items are involved.

  2. or : when a player puts an item in their inventory, that player’s inventory field on the database is updated with the new item’s type (an integer) being appended at the end, with a delimiter. A typical inventory field would look like this : "|11|8|27|58|58"
    Pros : much less wasteful. An item instance is just a few digits and a delimiter.
    Cons : no extra data on items; every instance is the same. Also, dropping an item on a tile means that tile needs its own inventory field – and so on for every possible location of an item. Besides, this method involves juggling with strings anytime an item has to be added/removed, rather than simply deleting a row from the table. Another thing is that a player’s inventory can store a variable number of items, so this string has no predictable length.

In a previous project, I used the second method. The first method looks fun, but I’m not sure if it’ll agree with our storage space and our server’s speed. Which of those methods is most often used in MMOs ? Is it another one altogether ? Are there some pros or cons I’ve missed ? (I’m sorry if this question is a bit subjective !)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:03:10+00:00Added an answer on May 31, 2026 at 11:03 am

    Your best design is a version of approach 1: every item has its own row and you put all the necessary information there. Don’t worry about optimization yet – you’ll have time for that later when you see how users use your system and where the bottlenecks are.

    For now, you want to design for ease of programming and clean, unambiguous descriptions of state. You want a master items table for each “type” of item, where you keep information about what that item is and how it can be used. Then, when created (or instantiated), you put a row in the items table and describe the specifics of that instance of the item. When it moves, you can update the location information. It isn’t wasteful, because you are storing — once and in the right place — only the information you need to manage the item.

    By putting the right indexes on the table, you’ll be able to manage millions of them easily and quickly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
We're building an app, our first using Rails 3, and we're having to build

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.