Skip to main content
GameDev.net gamedev.net
🔒 Locked

player -player and player-projectile collision

Started by Bru Feb 2, 2010 at 1:18 AM 5 replies 1.9k views
Original Post
Bru
Bru
so i know that all the calculations are suppoused to be done on the server to prevent cheating,but i can imagine a situatin where on the server, a projectile has hit the player,but on the player's screen that projectile missed. or worse,player 1 sees himself colliding with player and stops moving 2,but player 2 still see's himself close to player 1 rather than collided,so player 2 keeps moving. this sounds realy confusing to me,especialy if the projectile is a slow projectile(energy bolt or whatever) and the player collision situation. how are stuff like this being handled?
becoolnike
becoolnike
You can do nothing. Just smooth the correction.

Bru
Bru
are you sure about that? because i dont actually see this problem in any online games that i play,yet i can see how i am going to have it unless i find a solution.
Wolfdog
Wolfdog
It's there you just need to look carefully or setup just the right test case. Usually these corrections are very small so they can be corrected by smoothly nudging the player over a few frames. In some larger cases though you will need to snap the player back.

Information about the Source Engine's networking
hplus0603
hplus0603
If you detect that the player is killed by a bullet, you send the player a "die" packet and the player dies on the local client. Other players will see the player die in a slightly different (earlier) place. This is why, in games like MW2, you see yourself firing your weapon at an attacker, and then you dive behind cover, but you die anyway -- and in the replay, you don't see yourself firing against the attacker. This is because the server already decided you were dead before it could apply your "fire" command. Lag in action!
enum Bool { True, False, FileNotFound };
Bru
Bru
Quote:
Original post by hplus0603
If you detect that the player is killed by a bullet, you send the player a "die" packet and the player dies on the local client. Other players will see the player die in a slightly different (earlier) place. This is why, in games like MW2, you see yourself firing your weapon at an attacker, and then you dive behind cover, but you die anyway -- and in the replay, you don't see yourself firing against the attacker. This is because the server already decided you were dead before it could apply your "fire" command. Lag in action!

thanks :) that sounds clear. but then,what about the player aginst player collision over network? do i need to wait for the server to send the clients a packet saying "hey guys,you collided" or simply let the client do it,which will mean no delay but you might be collided even though you did not collide.

hplus0603
hplus0603
That's really up to you. In case of doubt, add lots of camera shake and smoke, and hope the player doesn't notice :-)

You might actually make it so that the local player detects local collisions, and sends those out to others as a change in movement for the local player. The remote player may not have detected that same collision, and may not actually send out a course change. That's probably still going to be OK, because the local player will see mostly what he expects to see (he collides, and there is a collision response to the local avatar).

Of course, all of this requires that you can trust the client, which is generally true for small hobby games, and for console gaming, but not for more popular games running on PCs/Macs/Linux boxes, because those clients can be easily hacked.
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.