Should collision detection be done server-side or cooperatively between client/server?

BarakatX2
  • Should collision detection be done server-side or cooperatively between client/server? BarakatX2

    I am working on an online game that will have very heavy collision detection processing. Player models will collide with other players, mobs, structures, terrain, and solid objects that only exist server side (not stored in client data files).

    For security purposes, should I do all collision detection server-side? Or should I have the client do the detection and have the server follow up on it somehow? I feel like it will be too much for the server to do by itself (I am designing the engine for hundreds of players on one server).

    Does anyone know how mainstream MMOs do it? I know that almost all MMOs right now are susceptible to physics hacks and usually deal with them by detecting hacks and banning people. I would rather the hacks did not work at all, at least for the physics component.

  • It seems like the obvious answer is to do most of your detection client-side (for smoothness), and then you interpolate to what the server says if your client is too far off. The server will tick at a less frequent rate than the client (like, say, 10hz), and would probably need to have some basic "can this player have reached where he says he currently is from his last known location" code, which implies some kind of nav mesh-type solution and pathfinding.

    That might be prohibitively slow depending on what your needs are. You might make a design decision, for example, to not care about player-player collision on the server. Most games, as far as I know, don't even care about that on the client. It really depends on what your needs are.

    But the rule of thumb is that you should never trust the client. It if impacts gameplay, you have to at least verify it on the server.

  • World of Warcraft doesn't do collision detection between players/mobs. There may or may not be technical reasons behind this decision, but really, this has to be more of a game design decision than a technical decision:

    Imagine how exploitable it could be in player-vs-player situations. Or how hard it would be to use the bank/auction house/mailboxes if other (often idle) players blocked your movement!

    As for client vs server based collision detection - really, unless movement is very slow, it has to be primarily client-side, so it looks right to each client. Laggy/delayed collision response, and/or colliding with 'invisible' objects would be quite unpleasant.

  • So, a few answers here.

    • Client-side collision is ideal from a performance point of view and from a player feel point of view. You don't want collision to be laggy, you want players to run into a solid object and stop. If you do it server-side, you're either looking at rubberbanding players all over the place or giving players noticable lag when they try to move. Bad mojo, in both cases.

    • Server-side collision is ideal from a security point of view. The closer your clients get to "dumb terminals", the less exploitable your game is. There's a reason that nobody playing a text-based MUD has to worry about wallhacks or speedhacks - it's because the client isn't doing anything worth mentioning.

    • Doing both is "ideal" in almost every case. Let the clients do their thing, then doublecheck on the server to make sure people aren't cheating. The downsides are complexity, synchronization (what exactly do you do if the two disagree), and sheer server CPU usage.

    • What I recommend is to do it almost entirely client-side. The client is authoritative about its position, just like in a full client-side system, and does all its own processing. On top of that, you randomly have the server check various players once in a while. Keep the server load low, but this will root out cheaters surprisingly fast.

    Alternatively, do it client-side for now, add the server-side verification at some point in the future if your game gets popular enough that people are cheating in it. Which, let's be honest, it probably won't, so there's no point in spending the coder time on it right now.

  • If you are concerned about the hacks and that has big impact in the game play then the answer is YES.

    In my browser based game which is a "city building" kind of game, I am not bothered about the hacks because the client engine is not going to fail when I layout the saved game state.

    However it could potentially abuse the gameplay as the player needs to spend game coins (or premium cash) to expand the playable area in order to build more houses/buildings. So, I am going to implement a simple check of number of tiles occupied by the newly added building agains how many free tiles are available.

Tags
c++ collision-detection mmo server
Related questions and answers
  • for other players should only be sent to a game client if their player is near the other players (i.e. you shouldn't get health updates for people you can't see on the other side of the map). The main problem is that if you had to compare all the players every time an update is sent, it would just take way too long as the number of players scales (think up to a few thousand players per map and each...? My idea is to have a separate thread that compares the space difference of all the players every few seconds or so and stores references to all nearby players in the player's object for easy access

  • Questions: When we draw with interpolation, where should the collision detection code be? Is it worth implementing interpolation in the following situation? This is for Scrolling Asteroids. I have... second and 75 frame draws per second. Up until now, it is in the physics update routine that I do the collision detection and response. Your ship can collide with a rock. Your photons (bullets) can... the objects at a fraction of the distance between their previous and current value positions and rotations. That is yet to be done. Question: Will I also have to do move my collision detection code

  • and if I can leverage Shiro's session features then that's a bonus. My real question is about the handshake between the client and server. If I use WS-Security isn't all that taken care of for me? Does that alone make the overhead worth it? If not, what should I do here? I want to make sure all of the requests from the client are authenticated but I also don't want to have to jump through hoops to make... leverage it. My client is going to be written in C++ and I can use whatever language makes it easiest (I'm leaning towards Java) to make it happen on the server side. I plan on adding support for users

  • consistently updated for each person in the lobby (eg: MSG_TABLE_FILLED, 22) Ideally I'd like to have 1 server exe for all of this and to have to deal with multithreading as little as possible. I'm...I'm working on learning network programming. I'm working on a simple card game. The basic idea is: Players enter the lobby Players see tables Players sit at an empty seat Once they sit, they do not need any information from the lobby, they see the card table and the data about the other players and so forth. I've programmed the server portion for the game itself. The clients connect to my

  • The problem is that I'm trying to use my meshes with Bullet Physics for the collision part of my game. When I attempted doing this method with my GLM(model loading library by nate robins) model, I get a segmentation fault in the debug, so I figured that it doesnt like the coordinate variables of the model. If i use blender to export my model as a collision file, what type of file should I use? I have heard of a .bullet exporter, but i dont know hot to integrate this python script into my Blender 2.5 program.

  • Collision Resolution ultifinitus

    Hey all, I'm making a simple side-scrolling game, and I would appreciate some input! My collision detection system is a simple bounding box detection, so it's really easy to implement. However my collision resolution is ridiculous! Currently I have a little formula like this: if (colliding(firstObject,secondObject)) firstObject.resolve_collision(yAxisOffset); if (colliding(firstObject... with a working algorithm, but I'd rather not =). So what in the heck do you think I should do? How could I change my collision resolution system to fix this? Here's the program (temporary link, not sure how

  • I am developing a multi-player on-line game. I just started coding the server but I have no idea how to do it. Do I have to use threads ? And if i do, do I need one thread for every client? Knowing that I am using UDP, can I use multiple sockets in different threads to send packets on the same port? edit: server does: -listen for client connections -when a client connects: -update files (send new files to the client) -retrieve data from database -loop to retrieve and update live data -when client disconnects: -update data in database

  • I am trying to create a 2D platformer (Mario-type) game and I am some having some issues with handling collisions properly. I am writing this game in C++, using SDL for input, image loading, font loading, etcetera. I am also using OpenGL via the FreeGLUT library in conjunction with SDL to display graphics. My method of collision detection is AABB (Axis-Aligned Bounding Box), which is really all I need to start with. What I need is an easy way to both detect which side the collision occurred on and handle the collisions properly. So, basically, if the player collides with the top

  • I'm working on a Component/Entity-System based game engine atm. And I have this little dilemma. I have simple geometrical structures which might be downloaded or created in game at some point. These structures are used to create models that are used in OpenGL and OpenGL ES and then for some collision processing. During dev and Beta I am quite ok with maintaining data copies for the physics... and use the power of GPUs for the server side of my engine (and be ready for OpenCL enabled mobile hardware/software). The structures are of variable size and moving or stationary structures can