1. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

KAG Netcode/Lag Compensation

Discussion in 'General Discussion' started by Destroid, Nov 9, 2012.

  1. Destroid

    Destroid Builder Stabber

    Messages:
    9
    I'm curious about it. It seems to work pretty darn well, especially in high latency situations (being from Australia I play at ~230ms quite often on the US servers) without too much trouble, handling both archer and knight well enough (although archer is definitely easier). So what sort of lag compensation system does it use? Was a reference used from other tech like source engine or is it an original design for KAG?
     
    dnmr likes this.
  2. Client simply calculates player's positions depending on their position and velocity up ahead.
    And corrects their position with next server update's information.

    There will always be "lag" behind Knight slash starts etc, which is crucial on 1v1 knight battles forexample.
    Player with better ping will always have "upper hand".
     
  3. Contrary

    Contrary The Audacious Paramount of Explosive Flight Donator Tester

    Messages:
    2,196
    There are also a lot of noticeable errors though, like infinity falling and lots of desynch on bomb jumps.
     
  4. Bombjumping should be made more client sided so you don't splatter all over walls because of desync.
    And let server validate that bombjump...if indeed there was no possible way for him to bombjump, ban time.
     
  5. Destroid

    Destroid Builder Stabber

    Messages:
    9
    Unfortunately there's not much you can do about that, unless you allow players to apply damage to others after they are dead (which would perhaps be more fair, but very strange). The falling bug I have noticed, and some players warping through doors, but all of that is only an issue with bad ping. Is your information from an interview?
     
  6. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    No, he's just talking from assumptions that he's made based on what he sees.

    There's an "unlagging" system which keeps about 2 seconds of previous network information from all players so that it can be used to reference where people were in relation to each other at a certain point in time, and therefore whether someone was able to hit someone with the positions at their respective ping. This causes the occasional "OH GOD MY 1000M SOWRD HAXKX" moments but makes sure that hitting "feels" acceptable most of the time. If you've got a huge ping then melee combat gets dicey for sure, but you can adjust for it easily enough, and archer in particular syncs out very well.
    This system is based on something that was developed for early quake servers, and it basically gives laggers a chance.

    There's also been a lot of work put into minimising the amount of data sent per player which helps us keep bandwidth use low while sending network information at a fairly high frequency.

    We trust the client a lot more than a few other games I know about the networking behind, because we take a hard line on hacking - any video validated report nets that person a ban. We also have a guy working on specific anti-hack technology that will help us justify looking the other way a little more ;)

    There are ways to make sure everything syncs 100% accurately and that everything the player is seeing is correct, but they mean latency _cannot_ be adjusted for, which means laggy players have input lag. If you serverside everything but have client-side prediction of what's gonna happen, then you have "rubber-banding", where players snap backwards if they failed to make some jump serverside. If you clientside everything then you get teleporting and all sorts of hacks are possible. We have a mix of clientside/serverside so that things are responsive enough and theres no rubber banding, but there's still some "interesting" teleportation and desync when people are moving at radical speeds or jumping off other players.

    @Ardi: The reason we dont have that stuff clientsided is that it causes mad teleporting (client sends deltas that disagree with server deltas by some margin) and requires a lot of validation serverside. Same for knock-back from slashes etc, while it feels more responsive for one player, its very confusing for the other 5 or so directly involved.
     
  7. Destroid

    Destroid Builder Stabber

    Messages:
    9
    Thanks Geti!
     
    Geti likes this.
  8. Makes perfect sense.
    Lag compensation is really great in Kag, i can easily have fun in a server where i have 500+ ping.
     
  9. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    No worries, glad I found the time to write that up as the details of implementation aren't exactly clear on inspection. I linked Michal to this thread, he's glad to hear the netcode get some praise, haha.
     
    delankski and Noburu like this.
  10. vampo

    vampo alchemist Donator Tester

    Messages:
    265
    As frustrating as it can be occasionally, I do really appreciate how little it is noticed. (with unlag systems, that's a good thing)

    Curious if you guys experimented with all serverside calculations in kag at all. Been playing a tiny bit of Diablo III and very rarely have issues with it. (I realize that's a very different environment and doesn't compare, just curious)
     
  11. Destroid

    Destroid Builder Stabber

    Messages:
    9
    Did the netcode in Soldat work the same way?
     
  12. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Not sure, I haven't seen the underlying code for that :)

    @jeffey: Yes, and it couldn't cope with the huge ping people were trying to play the game with, haha. Rubber banding etc was very common, probably in part due to how quickly the code was thrown together ;)
     
    jeffeypop and delankski like this.
  13. illu

    illu En Garde! Donator Tester

    Messages:
    737
    Nope. You can read about MM's struggles with the netcode here. Here he compares it to Soldat for example.
    Of course keep in mind that it has been a while since then, so the current netcode may work a bit different.