Trust client side hits

ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
<div class="IPBDescription">performance band aids</div>One thing above all else annoys me at the moment. I can deal with the jittery FPS, I've dealt with it in many other games before. I can deal with the rubber banding lag, as once again, I've experienced it before. One thing I cannot tolerate, however, is the server rejecting my client verified hits 50% of the time.

I do not understand the point of calculating client side hits just to light up a crosshair, when in most cases the server refutes the hit and doesn't follow through with it. This is obviously just some problem that I'm sure will be fixed down the line, but I see no point in having to subject ourselves to this irritation for the time being. As a make shift "solution", can the server not just trust that which is determined as a hit on the client side?

I know that, at release, this will not be viable due to potential cheating, but lets be honest, at the moment its built on open LUA. I could probably hack together a makeshift aimbot in a day. I don't think cheating is a big concern at the moment.

Comments

  • World ConstructWorld Construct Join Date: 2012-03-29 Member: 149616Members
    edited May 2012
    The client predicts your hits so that it will be less laggy, actually. Even though it gets it wrong a lot of the time because so much code has been executed in the few seconds between you clicking the mouse and the server sending the code back that says "hitreg" or not, it's not really possible to have a modern FPS without client-side prediction. The lag would be insane. It's hard to have to respond with another "it will be fixed eventually", but to clarify, it's more an issue of the original optimization you desire allowing client-side prediction to perform accurately.

    At least, that's how I understand it. I could be wrong; synchronized network code is complicated computer science.
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    edited May 2012
    <!--quoteo(post=1932462:date=May 2 2012, 02:12 AM:name=World Construct)--><div class='quotetop'>QUOTE (World Construct @ May 2 2012, 02:12 AM) <a href="index.php?act=findpost&pid=1932462"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->The client predicts your hits so that it will be less laggy, actually. Even though it gets it wrong a lot of the time because so much code has been executed in the few seconds between you clicking the mouse and the server sending the code back that says "hitreg" or not, it's not really possible to have a modern FPS without client-side prediction. The lag would be insane. It's hard to have to respond with another "it will be fixed eventually", but to clarify, it's more an issue of the original optimization you desire allowing client-side prediction to perform accurately.

    At least, that's how I understand it. I could be wrong; synchronized network code is complicated computer science.<!--QuoteEnd--></div><!--QuoteEEnd-->

    The client is already doing the hit checks, which is why the crosshair lights up essentially instantly. The server then checks it against its own internal version of the game world to see if the client is correct. Best case scenario, every client is trustworthy and the hits registered by the clients truly are hits. The only reason the server would then reject such claims is due to latency and jitter, which causes the prediction of the client to create a version of the game world inconsistent with that of the server's. So while the client did in fact shoot the target on his screen, the server is forced to refute it because its version of the game world is the final arbiter.

    Real world scenario however, people will simply stream positive hit messages to the server, which is why in general the server must always check for itself.

    Oh, and I'm not talking about prediction here. Prediction merely refers to the positioning of targets, not how positive hits are registered and conveyed.
  • pRiNcEkAhUnApRiNcEkAhUnA Join Date: 2012-03-06 Member: 148264Members
    <!--quoteo(post=1932461:date=May 1 2012, 05:06 PM:name=Imbalanxd)--><div class='quotetop'>QUOTE (Imbalanxd @ May 1 2012, 05:06 PM) <a href="index.php?act=findpost&pid=1932461"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I know that, at release, this will not be viable due to potential cheating, but lets be honest, at the moment its built on open LUA. I could probably hack together a makeshift aimbot in a day. I don't think cheating is a big concern at the moment.<!--QuoteEnd--></div><!--QuoteEEnd-->
    Experienced two aim-boter's last night. The cheating has already commenced.
  • World ConstructWorld Construct Join Date: 2012-03-29 Member: 149616Members
    edited May 2012
    <!--quoteo(post=1932468:date=May 1 2012, 08:29 PM:name=Imbalanxd)--><div class='quotetop'>QUOTE (Imbalanxd @ May 1 2012, 08:29 PM) <a href="index.php?act=findpost&pid=1932468"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->The client is already doing the hit checks, which is why the crosshair lights up essentially instantly. The server then checks it against its own internal version of the game world to see if the client is correct. Best case scenario, every client is trustworthy and the hits registered by the clients truly are hits. The only reason the server would then reject such claims is due to latency and jitter, which causes the prediction of the client to create a version of the game world inconsistent with that of the server's. So while the client did in fact shoot the target on his screen, the server is forced to refute it because its version of the game world is the final arbiter.

    Real world scenario however, people will simply stream positive hit messages to the server, which is why in general the server must always check for itself.

    Oh, and I'm not talking about prediction here. Prediction merely refers to the positioning of targets, not how positive hits are registered and conveyed.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I'm confused. I was wrong about how it works, but you're saying that the fix is the same, right? Without the client performing quickly enough, it makes inaccurate calculations.

    And if prediction doesn't affect hitreg, am I not still talking about the same thing? I don't know, are there any good articles for understanding this? It's pretty interesting, and I would like to learn it correctly.
  • xDragonxDragon Join Date: 2012-04-04 Member: 149948Members, NS2 Playtester, Squad Five Gold, NS2 Map Tester, Reinforced - Shadow
    Really? already calling aimbotters? I highly doubt that those people were 'cheating'
  • MaximumSquidMaximumSquid Join Date: 2010-07-20 Member: 72593Members
    edited May 2012
    Why not show damage numbers?

    Those can come in late and don't need to be a lie obviously

    It's a feature I've been requesting for a while now, but has largely been brushed aside I think

    -
  • jerkstoresupjerkstoresup Join Date: 2011-06-22 Member: 105840Members
    edited May 2012
    <a href="https://developer.valvesoftware.com/wiki/Prediction" target="_blank">https://developer.valvesoftware.com/wiki/Prediction</a>

    Red dot, blood spatter, and sound effects = Predicted

    +Score, Animation wince or ragdoll = Registered

    Prediction is there just to show the expected result of your actions immediately, while waiting for the server to read your net packet, compare it to everyone else's, and return an update of the result. If the client and server are having no bandwidth/latency/performance issues, the prediction will most likely be correct. If there's lag, low tick-rate, packet loss, or poor server performance, it can often be wrong. Shouldn't be difficult to understand why prediction isn't always right in NS2, knowing that.
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    <!--quoteo(post=1932475:date=May 2 2012, 02:57 AM:name=World Construct)--><div class='quotetop'>QUOTE (World Construct @ May 2 2012, 02:57 AM) <a href="index.php?act=findpost&pid=1932475"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm confused. I was wrong about how it works, but you're saying that the fix is the same, right? Without the client performing quickly enough, it makes inaccurate calculations.

    And if prediction doesn't affect hitreg, am I not still talking about the same thing? I don't know, are there any good articles for understanding this? It's pretty interesting, and I would like to learn it correctly.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Well at the risk of Max or someone else coming in and finding 1000 errors of mine, I will level with you and say that I am not 100% informed on this stuff. I am formerly educated in the field thought not completely familiar with industry standards.
    Anyway:

    Many games like to have "on hit" indicators that tell you when you are firing in the correct location. I think battlefield did it first, and other games have started doing it as well. Additionally, things like blood splatters and pain noises (skulk grunts, marine moans ect) also rely on determining whether or not the target was hit. Sending the necessary information to the server, waiting for it to be processed, and then waiting for the server to return the outcome can take some time. If only this method was used to determine hits, it would create quite a jarring visual and audio discord. So instead, while the client waits for the server to determine positive hits for the purpose of damage, it calculates its own hits for hit indicators and blood splatters ect. The server can disagree with the client however, even after the client has determined a positive hit and implemented the required visual feedback. This is why you can shoot a skulk directly in the face wit a shotgun, witnessing the rain of green blood, and have it take absolutely no damage.

    So the problem I am referring to is in the agreement between the client and the server. What I am proposing is that, instead of having the server do the hit detection a second time, let the client do it and just send the positive hit register back to the server. In other words, trust the client.

    The client side prediction is what <b>causes</b> the disagreement between client and server, and is a lot more complicated. That is essentially where the problem lies I assume, and will probably be addressed in the future.
  • Evil_bOb1Evil_bOb1 Join Date: 2002-07-13 Member: 938Members, Squad Five Blue
    <!--quoteo(post=1932482:date=May 1 2012, 08:15 PM:name=Imbalanxd)--><div class='quotetop'>QUOTE (Imbalanxd @ May 1 2012, 08:15 PM) <a href="index.php?act=findpost&pid=1932482"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Many games like to have "on hit" indicators that tell you when you are firing in the correct location. I think battlefield did it first...<!--QuoteEnd--></div><!--QuoteEEnd-->

    A bit off subject, but quake 2 had an audio on-hit indicator, I don't know if it was the first but its been around before battlefield.
  • KrizzenKrizzen Join Date: 2011-12-16 Member: 138181Members
    edited May 2012
    <!--quoteo(post=1932482:date=May 1 2012, 08:15 PM:name=Imbalanxd)--><div class='quotetop'>QUOTE (Imbalanxd @ May 1 2012, 08:15 PM) <a href="index.php?act=findpost&pid=1932482"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->... let the client do it and just send the positive hit register back to the server. In other words, trust the client.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Never trust the client. To accomplish the solution you're looking for, the server would have to rewind the game to trace the client's shots along with the servers version of the client's prediction. That may sound confusing, but basically I'm saying the server would have to do the exact prediction the client did to generate a true trusted result.

    Of course the end result would be even more code running on the server, and possibly a big performance hit.
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    Never trust the client is right, and from my understanding, the client never sends a "hit" message to the server. Only "i shot from here at that time in that direction". Which means that the server doesnt even know, that the client predicted a hit. (Which shouldnt be trusted anyway)
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    From what I understand Imbalanxd ment it as a temporary relief from the rubberbanding and\or bad hit-reg caused by the crappy server-performance, from now up until public release when the proper mechanisms are put back in place. Assuming it is a matter of flipping a boolean for Max, I'm still not be sure it's a good idea, namely because this beta-stage is exactly the place you would want crap like this to happen, not very close to release when it's basically too late. I'm very sympathetic to the idea of making the beta go by smoother though, it's terribad right now, but we're probably only going to see improvement through hard-worked optimizations.
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    <!--quoteo(post=1932529:date=May 2 2012, 07:37 AM:name=Krizzen)--><div class='quotetop'>QUOTE (Krizzen @ May 2 2012, 07:37 AM) <a href="index.php?act=findpost&pid=1932529"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Never trust the client. To accomplish the solution you're looking for, the server would have to rewind the game to trace the client's shots along with the servers version of the client's prediction. That may sound confusing, but basically I'm saying the server would have to do the exact prediction the client did to generate a true trusted result.

    Of course the end result would be even more code running on the server, and possibly a big performance hit.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Ye, I meant eliminate all forms of hit registration not happening on the client. Would be kind of pointless to perform the exact same calculation with the exact same data at two different locations.

    As player said, it was just a suggestion for a band aid fix. I don't think it would be a simple boolean change though, as the client packet would need to include extra data, and the structure is probably already set.

    I'm also not sure how badly this affects people at the moment. I perfectly aware that sometimes bullets simply "miss" even when aiming directly at the target, but I don't know how often people have client/server disagreements on hits. I play with very high ping, so maybe that is the main factor. When my friend buys into the beta I will do some tests on what kind of movement gives the most frequent disagreements.
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    On an additionaly note, not having bandaid fixes (that could create a huge cheater problem) is good to find bugs and fix them. This is a beta after all. Several hitreg issues have been found already. If they where masked by a bandaid like that, we would never have found out.

    While hitreg has still some bugs, its much improved now. I actually dont know of a specific hitreg bug right now. I know that there is an issue somewhere, but nobody came up with a video or a way to reproduce a current hitreg problem yet.
  • CorpseyCorpsey Join Date: 2011-07-02 Member: 107538Members
    Is anyone able to make a vid? We should set it up again like the last vid that showed how elusive the skulk hitbox was
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    <!--quoteo(post=1932548:date=May 2 2012, 11:32 AM:name=Corpsey)--><div class='quotetop'>QUOTE (Corpsey @ May 2 2012, 11:32 AM) <a href="index.php?act=findpost&pid=1932548"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Is anyone able to make a vid? We should set it up again like the last vid that showed how elusive the skulk hitbox was<!--QuoteEnd--></div><!--QuoteEEnd-->

    I don't know if a video will be of much use, as it will just show what we already know; some bullets hit, some don't.

    What I want to do is get a skulk to move around using various styles while I shoot at it with a pistol. Every time my client records a hit I can verify with the skulk player whether or not he actually took damage. I think anything less than around an 80% correlation between client and server can be said to be unacceptable. The main problem is that two people running around shooting each other is not the same as 20 people, but its a start at least.
  • ogzogz Join Date: 2002-11-24 Member: 9765Members
    there has to be some sort of client side hit rego happening already

    if you play vs a high ping pkayer (or you yourself is one)
    you'll notice the ability to shoot and kill a statioary skulk before he can even react

    if i was 800 ping and the server tedted
    my shots then the skulk with 100 ping should easily have been able to move from that location
    but reality is they have moved but my shots still counted
  • Ice30Ice30 Join Date: 2011-11-26 Member: 135365Members
    Basically the issue is to do with server performance. The server should be able to run fast enough (especially hit registration code) to process attack events and look up whether or not the client was attacking another player, before the players have already moved. Unfortunatley, server side performance is dreadful in NS2 at the moment
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    <!--quoteo(post=1932576:date=May 2 2012, 03:09 PM:name=Ice30)--><div class='quotetop'>QUOTE (Ice30 @ May 2 2012, 03:09 PM) <a href="index.php?act=findpost&pid=1932576"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Basically the issue is to do with server performance. The server should be able to run fast enough (especially hit registration code) to process attack events and look up whether or not the client was attacking another player, before the players have already moved. Unfortunatley, server side performance is dreadful in NS2 at the moment<!--QuoteEnd--></div><!--QuoteEEnd-->

    Exactly. So, for the meantime, lets take the strain off the server and just do it client side. I think everyone will be happier with that solution for now, unless cheating becomes rampant.
  • Ice30Ice30 Join Date: 2011-11-26 Member: 135365Members
    edited May 2012
    Having it as only client side would cause even more headaches. Because whats to stop me from having a slightly faster connection and running into a room and blasting you to pieces before you even see me on your screen? Or if the situation was reversed, if you had a slower connection you could blast me to pieces as you enter a room while I think i'm running out of a completley empty room. Server side prediction is a must, it just needs to be done right.
  • haprohapro Join Date: 2012-03-27 Member: 149492Members
    I was under the impression that most modern games do a blend between server status and the client-side view to reduce overall error but still mostly relying on server. Basically, the server knows you're 0.1 seconds behind, so when it does the calculation, it takes the position of where they were 0.1 seconds ago when you press the fire button.
  • Soylent_greenSoylent_green Join Date: 2002-12-20 Member: 11220Members, Reinforced - Shadow
    <!--quoteo(post=1932590:date=May 2 2012, 08:45 AM:name=Ice30)--><div class='quotetop'>QUOTE (Ice30 @ May 2 2012, 08:45 AM) <a href="index.php?act=findpost&pid=1932590"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Whats to stop me from having a slightly faster connection and running into a room and blasting you to pieces before you even see me on your screen?<!--QuoteEnd--></div><!--QuoteEEnd-->

    Nothing. Lag compensation also does not fix this problem; there's no way to magically remove the latency without actually, physically removing the latency. The person who does the peeking has the advantage.

    Lag compensation makes the inconsistency feel slightly worse. High latency players can hit you were you were several hundred milliseconds ago; that's the price of "rewinding time" on the server and checking if it looked like a hit on their screen.

    You can't get rid of the latency, you can only move it around. Wíth hitscan weapons it's not so bad; sometimes you make it around a corner before you die and that feels a little dodgy, but most often the enemy player is far enough away that he's just aiming a few degrees wrong. Melee is the worst; it's hard to dodge something that runs around and bites you were you were several hundred milliseconds in the past, it can feel like the range on melee is much too long(hence feeling like you get devoured from 10 meters in NS if you quickly scoot past a high latency onos with a jetpack and he gets you).

    If players have the same run speed you can end up with strange paradoxes. This happens often enough in PVK. You are running backwards; you see the enemy as they were in the past(way out of range). The enemy that is chasing after you sees you where you were in the past, which is much closer to him. So a player with a dinky little sword can reach you, but you simultaneously cannot reach him with a long spear.

    Latency sucks and there is only one fair and consistent way to remove it without making trade-offs and that is to actually, physically remove latency. Better internet connections is hard; but you can make the server run faster and if a game gets more players, a good, populated server will on average be available closer to the player(this is actually a very large effect. If I look in the steam server browser for the original counter-strike I find at least a hundred servers _with players_ and a latency less than 10 ms. Now interpolation effectively adds some latency, but if the server tickrate is high you can get away with maybe 25-50 ms of interpolation instead of 100+ ms.)
  • Soylent_greenSoylent_green Join Date: 2002-12-20 Member: 11220Members, Reinforced - Shadow
    <!--quoteo(post=1932671:date=May 2 2012, 03:17 PM:name=hapro)--><div class='quotetop'>QUOTE (hapro @ May 2 2012, 03:17 PM) <a href="index.php?act=findpost&pid=1932671"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I was under the impression that most modern games do a blend between server status and the client-side view to reduce overall error but still mostly relying on server.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Most visual indications of a hit(blood spurts, sparks etc.) are generated on the client. But the server still has final say over whether any actual hits were made.

    The server has a record of its past transactions with the client and it has timestamps on packets sent by the client. It knows what packets the client has recieved(the client ACKs the packets) and when the client sent its packet to the server, so it can "rewind time" and reconstruct what the player saw when he fired a gun.

    The server also has authority over your movement(except for view direction, typically); but the client predicts your movement so you don't notice any latency. For static geometry the server will pretty much infallibly generate the same result as the client. When you collide with another player there are problems. The server can't use the same trick and rewind time, because it needs to use a consistent view of the world, which is the latest position of players as seen by the server; but this is unknown to your client so there are lots of prediction errors. (hence why things get very jittery when you brush up against moving enemy players)
Sign In or Register to comment.