Collision over network
Posted 23 September 2009 - 05:47 AM
Posted 23 September 2009 - 03:22 PM
A lot of games do collision detection (character to environment) on the client side. Collision detection can take a fair amount of CPU depending on a lot of factors. If you are trying to do it all on the server I think you will run into problems. More importantly there is the lag issue. A player has to be responsive on the client even if the server communication is not optimal. You really need to do some collision detection on the client or players will be running though walls and things. Player to player collision is a different story. First it takes less CPU for doing basic player to player collision and second the server holds the true location of a player. The down side is collisions can be somewhat off from what the player is experiencing. Note games like WoW do don't even do player to player collision.
There are a few other factors to consider. Are you going to do prediction for other players' position or are you just going to allow them to be slightly behind their actual position? In old EQ I believe they used prediction. On occasion a player would run off a cliff and then pop back to his real position. In WoW you never see this, however if you are running on two accounts with two characters you will notice a character is always slightly behind his true position. This means you can get away with just doing collision detection for a single character on each client and never have to worry about seeing players majorly off their course. Don't quote me on any of this. This is just my guess from doing tests on these games.
You need to think about what's acceptable to you and how you want the players to experience the world.
Posted 24 September 2009 - 02:36 AM
Posted 24 September 2009 - 03:19 AM
I actually ignored validation in my last post. Of course some form of preferably low cost validation can also be applied on the server. My main point was that you typically still need client side collision detection at a minimum because otherwise there is nothing to stop a player from appearing to walk through a wall. In fact you will probably fall through the floor pretty readily. The client of course can fix this and put you back where you are supposed to be once it receives an update from the server. However that means you will appear to be bouncing around if you are running against a wall. Or worse you will be bouncing up and down on the ground.
I'm not sure any client/server games use pure server based collision detection. The lag would have to be pretty low and even then I would think the bouncing would be noticeable and very annoying. I was annoyed by a small jittering in corner situations caused by a bug in my CD code before I fixed it. Anything caused by server lag would probably make me want to punch my monitor.
Edit: Actually after reading the OP's post again, I'm wondering if I misunderstood it. I read it to mean all collision detection should be done on the server as opposed to additional collision detection should be done on the server. If he meant the latter .... hopefully I still said something remotely intelligent :-P
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users