School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,109 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,024 people online right now. Registration is fast and FREE... Join Now!




Item action management in an MMORPG.

 

Item action management in an MMORPG., How does it work, and what is most efficient?

SphereCat1

29 Oct, 2009 - 11:14 AM
Post #1

New D.I.C Head
*

Joined: 29 Oct, 2009
Posts: 4


My Contributions
Hi guys! I am writing an MMO (crazy, I know), and I need to figure out the best way to create actions for items. I way I think would be the best would be to create an XML file for each object, and have a section of that file that contains some code to be loaded into the client when the object is accessed, sort of a temporary plugin. The code would just be a type of script that would call basic functions on the server to avoid hard-coding anything.

What do you guys think of this approach? Would it be too susceptible to hacking if it runs from the client? Would it be easier to have an "object server" of some type, so the client just passes the name of the item & action, and the server does the rest? Or am I looking at this completely wrong?

Thanks for any input you have! smile.gif
SphereCat1

User is offlineProfile CardPM
+Quote Post


Aeternalis

RE: Item Action Management In An MMORPG.

29 Oct, 2009 - 11:38 AM
Post #2

D.I.C Regular
***

Joined: 13 Jul, 2009
Posts: 273



Thanked: 25 times
My Contributions
Could you supply an example of an action for an item? Usually Items don't perform actions. Are you talking about a "USE" functionality where a player causes an action by Using an Item?
If that is the case, the USE functionality is usually built into the class that is doing the using. static attributes particular to the item belong in the class of the item.


As a general rule, you don't want to store any behavior or game state related data on the client. The ability to modify and change this data is too difficult to contain.

hope that helps.
Aet



User is offlineProfile CardPM
+Quote Post

SphereCat1

RE: Item Action Management In An MMORPG.

29 Oct, 2009 - 01:11 PM
Post #3

New D.I.C Head
*

Joined: 29 Oct, 2009
Posts: 4


My Contributions
Yeah, the use functionality is kind of what I'm going for. So that each item doesn't have to have it's effect hard-coded into the server.

But I'm also trying to get a bigger scope for the functionality, so that if there was a space station, for instance, it could have a self-destruct function built into it, as well as move, spin, etc. So I guess object would be a better word for it than item.

Thanks for the quick reply! smile.gif
User is offlineProfile CardPM
+Quote Post

BlackPhoenix

RE: Item Action Management In An MMORPG.

29 Oct, 2009 - 03:35 PM
Post #4

D.I.C Head
**

Joined: 11 Jul, 2009
Posts: 152



Thanked: 4 times
My Contributions
You would normally have an Item class, and then a class for each item which inherits the Item class.

There will be a method called Use in the Item class that gets overloaded in the child class, which has code which is executed when that item is used.

In a single-player game, the client will use the item, the item will be destroyed and the inventory will be updated, and the code inside the Use() method will go off.

In an MMO, 1 of 2 things will happen:

1) The client will use the item, destroy it, update inventory, and then send a message to let the server know that the item has been used OR

2) A REQUEST will be sent from the client to the server to let the server know the client would LIKE to use the item, the server will check to see that this is a valid move, then send back to the client whether or not the client can actually perform this request.

Depending on the scale of the game, it is better to go with Option 2. Most other actions fall under Option 2 as well.
User is offlineProfile CardPM
+Quote Post

SphereCat1

RE: Item Action Management In An MMORPG.

29 Oct, 2009 - 05:56 PM
Post #5

New D.I.C Head
*

Joined: 29 Oct, 2009
Posts: 4


My Contributions
So then I would just store the child classes in separate files that can be swapped in and out when necessary? That's a good idea. I could create a wrapper file for an item that contains a Class file, and also all the 3D models and textures needed to create an item. Then it's just a matter of passing the models to the client. Sounds like a plan!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 12:51PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month