Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In an MMORPG:

Is it typical or feasible to store the coordinates of every tree, bush rock.. etc in the server side for collision detection?

If so, what would be a feasible way to store such a huge number of coordinates (data structures and such, performance issues handling)?

If not, is this type of collision detection done entirely in the client side, with the server not checking at all?

Or is there a middle ground, with the client checking collision and server verifying? If so, how would the server verify the same without keeping the coordinates in the server as well?

share|improve this question
2  
I don't know enough about this to give a good answer, but if you do collision detection only on the client side, cheaters will find a way to clip through everything, or pick up powerups that are miles away from them. – Peethor Mar 29 at 5:09
2  
-1 "Question does not show any research effort". – Alexandre Vaillancourt Mar 29 at 13:57
1  
    
actually, probably not a duplicate, I learned about spacial partition schemes and spacial data structures that the other question didn't have – Sajith Dilshan Jamal Mar 30 at 5:18
up vote 14 down vote accepted

Independent of feasibility (yes, depending on scale) there are often better or easier ways.

For instance, in your typical MMO, the server really only needs to know about the coarse navigation map used by AI and player pathfinding. Instead of storing the location of a tree, you can instead just cut a hole into the navmap at the location of the tree. Likewise for any other big obstacles.

Even games that need more in-depth collision detection, you can often break this into server- and client-side detection. The server can just concern itself with coarse pathing while the client handles more animation-sensitive collision detection. For instance, a wounded player tries to crawl along a big rock to find a hiding place from enemies. The server determines that a player could move along the edge of the rock (the server has no idea that there is a rock, just that there's a path the player can take next to an unpathable area) while the client knows that the rock is present and plays an animation of the character propping itself against the rock as it walks. Note that the client isn't moving the character or impacting gameplay in any way in this case; it's just reacting to the nearby objects with an animation.

You certainly can store large numbers of objects on the server. It's no different than any open-world game. Use a good spatial partitioning scheme and keep the memory footprint of your objects as light as you can. Note that we may have different versions of "large numbers" in our heads here: if you meant that you wanted to store every little pebble or rocky bump in the game as a separate object then that's just silly, even for a single-player game. :)

share|improve this answer

Yes - it is feasible. MMOs often split the game world into multiple areas, as this makes the job easier, but you can still do it with 1 massive area - you just need to use a good spatial partitioning scheme.

Because most objects in MMOs don't move, you can also perform a preprocessing pass where objects are used to create collision checking trees.

Memory footprint isn't a huge issue here as long as you use instancing. Storing a couple floats per object is nothing in the grand scheme of things. A modest PC nowadays will have 4 gigabytes, while storing a position is just 3 floats (or 3 doubles) - which would easily allow several million stored objects in-game.

Storing things like inventories for each player would undoubtedly take up more data - although that can easily be cached to disk and only loaded when a player logs in.

You'll want to redundantly do the collision checking on the client as well as the server, as this'll allow the client to more responsively react to the environment. If a player walks into a wall, you want them to stop moving immediately - not after half a second when the server responds.

You only want to use the server for authoritative things, too. For example, you would perform pathfinding only on the client, as you can't cheat by taking a less efficient path!

share|improve this answer
    
thanks for the tip about spacial partioning schemes, I learnt something new – Sajith Dilshan Jamal Mar 30 at 5:18
    
+1 for the pathfinding tip. – Alejandro Piad Apr 1 at 13:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.