Hit detection server side or client side?
ViPr
Resident naysayer Join Date: 2002-10-17 Member: 1515Members
is the hit detection going to be client side like i think counter-strike is? can you aim at where you see the enemies on your computer or do you have to aim where you think the enemy will be on the server by the time your shot registers at the server bearing in mind that what you see on your computer at any instant is where things were on the server a while ago?
Comments
However there is client-side animations and prediction, but hit detection would be impossible client side, as everyone would get horribly out of sync. Also it would be a nightmare as far as cheating goes, people could hack it so that it sent a packet telling the server they just headshot the entire enemy team.
When you shoot on you client, the client tells the server that you made a shot. Ordinarily, the server would the determine if your hit was succesful or not. In HL and mods, there is lag compensation to make it fairer for people on lower speed connections. (I believe this can be enabled and disabled with sv_unlag)
Well the server checks your ping and calculates where everything would have been when you took the shot. So if you have a ping of 200ms, the server will check if the target would get hit by the bullet 200ms ago, even though the person with the faster connection may have moved around a corner. If the target would have been hit, he gets hit, if not, he doesn't.
Understandably some low pingers can get annoyed by this as to them it seems like they're getting shot around corners and through walls, but it is in fact an attempt to make the game fairer to high pingers.
So basically...the server does do the hit detection but it compensates for your lag so if on your screen you hit it, theoretically you should on the server too.
Voodoo got it somewhat correct.
When you fire at someone, the client sees the muzzle flash at once. This is to give the appearance of zero lag. This is where it somewhat favors HPBs. However, it can disfavor them too....
When the client fires, the server detects to see if the attack would have hit. However... there is something different. The client ALSO detects, client-side, if the bullet would have hit something, and instantly draws the hit sprite, whether it be sparks, blood, dirt, whatever. This is another way it gives appearance of no lag.
This means that you may see blood on an enemy, when, in reality you didn't hit them. This is, however, rare, because, well, bullets are fast, folks. <!--emo&:)--><img src="http://www.natural-selection.org/iB_html/non-cgi/emoticons/smile.gif" border="0" valign="absmiddle" alt=':)'><!--endemo--> When you see blood, this usually means you hit. Of course, unless you're playing AvP2.
For more information on this, go to <a href="http://www.summerblue.net/games/cs_report/" target="_blank">Counter-strike top secret file</a> to learn about how the old CS versions had many bugs and faults. And on the <a href="http://www.summerblue.net/games/cs_report/2_3_latency_issues.html" target="_blank">third or fourth page</a> it will tell you how client-side weapons work, and hitscan stuff. You should get the Divx codec so you can view their shocking videos, too. Thankfully, the newer versions have fixed some of these problems. But <i>not</i> the hitscan problem.
So you can't trust sparks and bullet decals, or anything else that appears immediately, but things you have to wait for (usually things that are affected globally like windows) you can be sure they were real hits.
anyway i really want to make sure it is correct in this mod. i think just because it's made in half-life doesn't guarantee that the hit detection will work well because there is another mod for half-life called Svencoop where it looks like it must have been done completely wrong because i am never able to hit things that are moving across my view by aiming straight at them when i play on someone else's server. my ping was around 300 * when i did that by the way. i can hit them sometimes by aiming ahead of where they are going. thankfully in Svencoop, the computer controlled enemies happen to stand still alot of the time so that's when i try to kill them, and i usually end up getting the highest score with the lowest deaths even though i have the highest ping, but in NS i'm sure i will not be able to wait for the enemies to stand still. anyway i want the NS coders to know i am here to help test this mod for them. i pay close attention to these things. unfortunately it might be harder to test this mod because the guns use randomization firing cones instead of American Army's moving crosshair type system. in Svencoop i was able to test using the magnum because its bullets don't go in random directions at all. there was another mod called hunt for quake3 where i convinced the coder to remove the enlarging crosshair system and replace it with the moving crosshair system and then i was able to find out for him that one of the enemies in his mod had no hitbox for it's head. we were not able to notice this before because the shots never went where we aimed before.
*i have DSL but the server situation for Svencoop is pretty pathetic; i was not able to find one near me. i can play CS with around 30 to 40 ping though but i hate CS because of its hugely random and misleading aiming system.
/me sets fire to Surge *
I play AvP2 online regularly with pings in excess of 200ms and I've had no serious lag issues. Even with half a dozen aliens nibbling at your kneecaps.
I don't understand why people form opinions on things they've never played or seen. You ask the average joe-on-the-net about the Lithtech engine and AvP games in general they'll say something along the lines of "LITHTECH R T3H S0X0R! IT R H4V3 T3H B4D L!GHT!NG! AND IT R T3H LAGZ0R!" Not specifically pointing my finger at Surge particularly.
--Scythe--
"large" mods (dod, cs, ns, flf) have this, and with this you don't need to lead shots at all.
There is the bog standard network code which I think is the same as the Quake netcode, with a few optimisations to reduce lag.
Another kind of problem is the horrible "delayed shot" problem I used to have with Firearms; every shot took approximately 1 second to appear, due to my pretty awful ping of 300 or so.
Seriously, perhaps if that's the case, then what I think is a shot appearing late is actually a shot appearing early, and me seeing it appearing late. Either way, I'm going to have to go test it out some more later...
Thanks for the info.
It's just in other games you strafe faster than you do in CS, so in CS it's less noticable (even more so since the CS guns are generally less accurate, so you'd just think it was spray), but in games where you move much faster like FLF and tfc- scout it becomes very noticable at times with higher ping.