3 Replies - 1499 Views - Last Post: 11 March 2013 - 12:36 PM Rate Topic: -----

#1 English_Fire  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 01-May 12

Can I get some advice with browser game item system/db?

Posted 10 March 2013 - 11:31 PM

Hello,

I've been developing a little browser game as a side project for a while now. I currently have a decent amount of features in the game, such as combat, messaging, inventory, equipped items, stats, and some different areas to explore. As the development as progressed, I've realized that the design of my item system is getting pretty sloppy and I wonder if there is some way I could make it more organized. Before I get to the question, I'll give a little more information.

The game is a typical browser-based text(ish) game built using -
-PHP
-Javascript
-MySQL

Now here's the dilemma.

My current item system uses a table called "items" to store all different items in the game. Each item has a "type" column, which is used in code to determine what "flags" the code should look for. There is also a "flags" column in the items table. The flags column hold key and value pairs of different attributes of the item such as heal amount, damage, strength boost, and so on.

This is starting to get very hard to manage as more items are added and different modifiers are added. It's easy to forget to add some modifiers to the code, or to forget to scan for certain modifiers on a particular item when calculating stat totals and such.

Can anyone offer any insight on how to create an efficient and flexible item system that allows for different types of items and flexibility in their modifiers? I'm looking for general discussion on possibilities.

Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: Can I get some advice with browser game item system/db?

#2 Takk  Icon User is offline

  • D.I.C Head

Reputation: 40
  • View blog
  • Posts: 110
  • Joined: 08-March 13

Re: Can I get some advice with browser game item system/db?

Posted 11 March 2013 - 12:09 AM

My best suggestion I can come up with right off would be to extend this into a second 'administration project' also, an actual GUI which will allow you to search through your items, and as per item type show you available flags, configure an item's stats, etc.. It's way easier to do database edits with a GUI, or become very disciplined on documentation.
Was This Post Helpful? 0
  • +
  • -

#3 English_Fire  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 01-May 12

Re: Can I get some advice with browser game item system/db?

Posted 11 March 2013 - 12:29 AM

View PostTakk, on 11 March 2013 - 12:09 AM, said:

My best suggestion I can come up with right off would be to extend this into a second 'administration project' also, an actual GUI which will allow you to search through your items, and as per item type show you available flags, configure an item's stats, etc.. It's way easier to do database edits with a GUI, or become very disciplined on documentation.


I see what you're saying. I have a page for adding items currently, but that's the extent of my administration tools for the item system at this point.

I was pondering my current setup, and I realize it really limits my ability to make additions to the item system. For example, I was considering the ability to "enchant" a weapon and add some modifiers of your choice, such as increased critical hits.

That's not possible with my current system because all a player's items are simply references to the items database. That would mean every time a player enchants an item, it pollutes the database with a record. That could grow to huge amounts of crap polluting the database.

How can I achieve the flexibility I want for things such as enchanting and dozens of types of items from weapons to potions with varying effects? I'm trying to conceptualize how to design something like that.
Was This Post Helpful? 0
  • +
  • -

#4 Takk  Icon User is offline

  • D.I.C Head

Reputation: 40
  • View blog
  • Posts: 110
  • Joined: 08-March 13

Re: Can I get some advice with browser game item system/db?

Posted 11 March 2013 - 12:36 PM

I'm not sure how anyone else may see this as a feasible solution, but you could... instead of referencing the item id directly, reference it through a string and parse the string accordingly..


slotShoulders = "111:222^333^444^555"
111 being the itemID
222-555 being the enchantID of each applied enchant to the item

it would involve a second query to the database to grab the stat modifiers for each of the enchants.

makes this possible, however someone may have a better idea that would keep the number of queries down at 1 and let the database do more of the work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1