Items in MMORPG
Hi, How do people go on about setting up an item system in a MMORPG? I want to be able to have a character put items in his inventory, put them on the ground outside, trade them with other characters, and of course use them... I have my own ideas for this, but it would help a lot if someone could maybe explain how they handled this, as it seems like a pretty complicated task. Really, the hard part for me is designing a generic Item class that can be used with every item in the game, and then somehow make it so the player can use these items, like equip a sword or drink a potion... I mean, having a generic system that can do specific tasks is pretty damn complicated... I'm thinking is this where I start getting scripting involved? Thanks for any help.
FTA, my 2D futuristic action MMORPG
abstract base classes. But honestly, if you don't know that, there's no way you'll ever make an MMO. Can we once and for all get the word out that making an MMO isn't a three week project? It takes ridiculous amounts of people and time. Not to mention the millions it costs for maintenance and servers, etc. start much smaller.
DarkMerchant, you need to stop right there. Graveyard filla has come very far with his project, farther than a lot of people. He's been working on it for a lot longer than three weeks (although I don't know the actual amount of time). A lot of people in the community will back him up, because he's doing a great job. Besides, you can't assume he doesn't know about abstract base classes. That isn't the only solution to the problem. There are many solutions, and he needs to choose one that suits him. He's asking for opinions, not your rude remarks.
Edit: here is the proof LINKY
Edit: here is the proof LINKY
In my attempt to answer your question, I'll ask another question: weren't you trying to use mySQL (or any type of SQL) to hold your game information? If so, you can have items independent of users inventories and locations. For example, if you have a database for all items in the system, you can have a key that represents where it currently is (user inventory, shop inventory, etc.). That's how I'm developing for my hobby MUD. My theory comes from the database classes I've taken so far, and it's AFAIK how big MMORPGs handle it.
But if you're not using SQL, disregard.
But if you're not using SQL, disregard.
I recommend MMP Database Mini-Cookbook: A Half Dozen Recipes To Aid Development. It's a gamasutra article, so you'll need to register.
You need to have an item and inventory table. Each linked to the user table in the database. The inventory table holds the ID's the user has, allowing you to add new items easily, and so you can easily insert the item into the user's account that the item was traded to.
I've never made a mmo, but I know that is how it is done, because I have done testing on published MMO's.
I've never made a mmo, but I know that is how it is done, because I have done testing on published MMO's.
The OSLib | Personal Site/Blog | /Dev/Nulled Hosting | WoW Linux Petition | The Wildcard - My IRC Network
In our game we have seperate class for item 'objects' and item characteristics. We basically have 3 classes:
psItemStats - This is the 'blueprint' of the item. This is a table in our database that stores stuff like the size/weight/mesh/etc for an item. This has fields for every possible item characteristic. So if, for example, the item has no damage_slash value ( ie could be a potion ) it just has 0's for that field.
Next we have a psItem class. This is a particular instance of an item no matter where it is in game. This class has memebers that store who owns it ( ie player owner ) and where it is in the players inventory. We don't subclass this out into different items like psItemWeapon or psItemArmour etc. This makes our psItem class a bit bulky but it keeps the design simple and general. We are refactoring that class a bit to try to clean up some of the deadwood. We assume that any item could potentially be anything ( for example, a spiked shield that can be used as a melee weapon ) and by making a quick adjustment to the item_stats table we can make any item suddenly have an attack value. These instances of items are stored another table: item_instances.
Finally we have a gemItem class ( game entity management Item ). This is a subclass of gemObject which represents all 'physical' objects in the world, ie players, items, switches etc. So this is the 'physical' form of the item in world.
So in our scheme of things:
Each player has a list of psItem that is his inventory. When he drops an item a new gemItem object is created and the item is placed in the world. When the item is picked up the psItem data is added to the player's inventory and the gemItem object is destroyed.
This way we only have one table item_instance that stores all the information about an item no matter where it is ( in world, in inventory, in container etc ). We also have a script value in this table that runs whenever a player equips or removes an item.
If you want I can provide the links to the table structures and c++ files in our CVS repository.
psItemStats - This is the 'blueprint' of the item. This is a table in our database that stores stuff like the size/weight/mesh/etc for an item. This has fields for every possible item characteristic. So if, for example, the item has no damage_slash value ( ie could be a potion ) it just has 0's for that field.
Next we have a psItem class. This is a particular instance of an item no matter where it is in game. This class has memebers that store who owns it ( ie player owner ) and where it is in the players inventory. We don't subclass this out into different items like psItemWeapon or psItemArmour etc. This makes our psItem class a bit bulky but it keeps the design simple and general. We are refactoring that class a bit to try to clean up some of the deadwood. We assume that any item could potentially be anything ( for example, a spiked shield that can be used as a melee weapon ) and by making a quick adjustment to the item_stats table we can make any item suddenly have an attack value. These instances of items are stored another table: item_instances.
Finally we have a gemItem class ( game entity management Item ). This is a subclass of gemObject which represents all 'physical' objects in the world, ie players, items, switches etc. So this is the 'physical' form of the item in world.
So in our scheme of things:
Each player has a list of psItem that is his inventory. When he drops an item a new gemItem object is created and the item is placed in the world. When the item is picked up the psItem data is added to the player's inventory and the gemItem object is destroyed.
This way we only have one table item_instance that stores all the information about an item no matter where it is ( in world, in inventory, in container etc ). We also have a script value in this table that runs whenever a player equips or removes an item.
If you want I can provide the links to the table structures and c++ files in our CVS repository.
I would love to see it, but I don't really have the time. Your system sounds awesome. Could you pm me the table structure so I could visually see how they are set up?
The OSLib | Personal Site/Blog | /Dev/Nulled Hosting | WoW Linux Petition | The Wildcard - My IRC Network
item_stats.sql
item_instances.sql
You can also see a big relation diagram of all the tables together. Look to the right side for the item stuff. Its a bit of a big image( ~1MB )
item_instances.sql
You can also see a big relation diagram of all the tables together. Look to the right side for the item stuff. Its a bit of a big image( ~1MB )
a good book for that is Programming Roleplaying Games in Directx 2nd Edition by Jim Adams. It goes through all the little stuff like that realy well. Doesnt do the directx part that well but I heard it was better in the 2nd Edition I have the first. It covers all the things you need to know though for RPG functions.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement