02 Client-side Prediction Theory | Networking for Virtual Worlds

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 18

  • @I-OGameDev
    @I-OGameDev 4 месяца назад +1

    Brooo this is such a good tutorial holy shit. You pace it so well and come back to summarise so often that I never lost track. I'll be sure to credit you if my project goes anywhere!

    • @net_
      @net_  4 месяца назад

      Glad it was helpful! 🙂

  • @RUMPshit
    @RUMPshit 3 года назад +5

    Omg, this is a total goldmine. I recently picked up a networking book that has over 300 pages and then I found you. Your way of explaining is awesome. Thank you!

  • @MrTaco1337
    @MrTaco1337 3 года назад +7

    Networking ASMR, nice explaining nice tingles

  • @razcodes
    @razcodes 3 года назад +1

    What a nice nice nice video, I was having real difficulties to understand this! Thank you very much!

  • @Shonia
    @Shonia Год назад

    Thank you very much!!

  • @hi_im_gush
    @hi_im_gush Месяц назад

    I'm assuming you wouldn't have to even go through each prediction at each update if the updated position is the same as your prediction for that tick. So, not only would you not do reconciliation but you wouldn't re-run simulations if you held onto updated position client-side.
    Is that correct? I know a lot of the resources touching on this topic haven't really mentioned that either. Your tutorial is the first one that touches on network ticks that I've come across.

  • @automata_
    @automata_ 3 года назад

    Great explanation!

  • @evy2710
    @evy2710 2 года назад

    @Net_ Thank you so much for these videos, they are awesome! One question that I have is how do you handle a case where a Tick() function doesnt complete in time? From what I am understanding the Tick() function should 1.accept the input change, 2. Run the process movement function, 3. Send updates. But what if all that logic doesnt finish before the next iteration of Tick() needs to be called? ( assuming that Tick() needs to be called 30 times per second). Should each Tick() function be handled by a new thread , allowing Tick() iterations to happen in parallel? thanks in advance!

    • @net_
      @net_  2 года назад +1

      If a tick overruns the timing window that it needs to complete within, then hopefully a future tick is short enough that it can catch up. If not, you're stuck in a overrun loop and need to either find a way out (shut down systems, kick players, etc), crash, or wait for someone to close the process.
      Ticks are necessarily sequential, so you can't really process T1, T2, and T3 in parallel. However, you may have individual systems or chains of systems that are independent enough that they can be processed in parallel with other chains. If you google around, you should be able to find some resources on forming dependency chains and parallelizing systems/jobs in game engine programming.

    • @evy2710
      @evy2710 2 года назад

      @@net_ makes sense, thank you!

  • @free_to_play
    @free_to_play 2 года назад

    ty for this! I've implemented it and it works great for X left/right position on a platformer. Do you recommend sending information per tick? if 10 ticks pass im at x=speed*ticks but im not sure if its a good idea to send every tick.. but if I do not then my end location is uncertain.. where x=speed*ticks+latency right?

    • @net_
      @net_  2 года назад +3

      Glad it's working :D If you're sending input state from the client to the server, you only need to send data when an input changes. For example, if the user presses a movement key, you immediately send an input change request to the server. While the user is holding the key, you don't need to send any messages. Then when they release the key, you send another input change request.

    • @free_to_play
      @free_to_play 2 года назад

      @@net_ thanks!! 😄

  • @razcodes
    @razcodes 3 года назад

    How would you deal with fluctuating latency? For example what if package t90 arrives and then package t88 arrives? Or if the server receives them in wrong order too?

    • @net_
      @net_  3 года назад +1

      Ordering is assumed to be handled at a layer above this by using either TCP or a "reliable UDP" setup to guarantee in-order transmission. If you're trying to avoid those to get absolute minimal latency, you would have to go for a more complicated approach.

    • @edvinte
      @edvinte Месяц назад

      you can pass sequence data in the udp package which allows you to know if it’s a package from ”the past” or if you should use it