Results 1 to 3 of 3

Thread: Database structure for an item system

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Squire
    Join Date
    Jun 2015
    Location
    Your basement, run
    Posts
    28

    Default Database structure for an item system

    Hi, I am making a web chat similar to Discord but with lots of new, probably never before-seen features (in a webchat)!

    It's a webchat with a player based economy.

    Anyways, does anyone know how I should structure the items database?

    Here's what I have now:
    An itemdata document that gets information every time a new item is created (spawned)
    Name:  Screenshot_20200616-082515425 (1).jpg
Views: 61
Size:  164.7 KB

    And then, when a new item is created, all you need is the item type id, the owners userid, and a special field for items like paper notes which allows you to store and trade notes.
    Name:  Screenshot_20200616-083043610 (1).jpg
Views: 58
Size:  269.1 KB

    What can I improve? It feels like I'm missing something but I'm not sure what

    P.s: how do you think you'd be able to receive items in a webchat? Also, what type of items?

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,377

    Default

    Hrm. Well, I don't really know enough about your backend and project to give any meaningful info I guess, but here are some rules I use for making something that uses a database:

    • Have a simple command to delete all databases and start over (this way you can keep changing the structure as you work on it, and it will re-fill out a few base items automatically or whatever - the goal is that breaking stuff during development doesn't mean more work or worry about smoothly upgrading data (although that should come later after things are nailed down..))
    • Worry about low level optimization down the road (if stuff gets slow, you can probably figure out how to make it run faster quickly if needed)
    • Don't be afraid to build and change it drastically as you go
    • Depends on the backend db, (mysql or whatever) but use indexes for quick lookups/searches where it makes sense, minimize the use if strings, or put them in a string database separately, last thing you want is to have 1000000 items with 128 char fields reserved and only 10 items using them
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Squire
    Join Date
    Jun 2015
    Location
    Your basement, run
    Posts
    28

    Wink

    Quote Originally Posted by Seth View Post
    Hrm. Well, I don't really know enough about your backend and project to give any meaningful info I guess, but here are some rules I use for making something that uses a database:

    • Have a simple command to delete all databases and start over (this way you can keep changing the structure as you work on it, and it will re-fill out a few base items automatically or whatever - the goal is that breaking stuff during development doesn't mean more work or worry about smoothly upgrading data (although that should come later after things are nailed down..))
    • Worry about low level optimization down the road (if stuff gets slow, you can probably figure out how to make it run faster quickly if needed)
    • Don't be afraid to build and change it drastically as you go
    • Depends on the backend db, (mysql or whatever) but use indexes for quick lookups/searches where it makes sense, minimize the use if strings, or put them in a string database separately, last thing you want is to have 1000000 items with 128 char fields reserved and only 10 items using them
    Thanks for the tips! I already kinda try to make everything as non-resource intensive as possible, but it still gets a bit too heavy imo

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •