Search Unity

Feedback Client and Server at editor sometimes will miss out player input

Discussion in 'NetCode for ECS' started by optimise, Oct 6, 2023.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,128
    I found that when running both client and server together at editor sometimes will miss out player input that when try to cast a skill it will fail to cast and rollback immediately. Is that current netcode limitation that server will definitely not behave properly at editor since at editor client and server are not running at separate process?
     
  2. NikiWalker

    NikiWalker

    Unity Technologies

    Joined:
    May 18, 2021
    Posts:
    314
    Hey optimise!

    We're not aware of any input related issues, especially in the editor. Debugging steps:
    1. Can you post your input handling and input processing code?
    2. Does this issue persist when you entirely disable the Network Simulation / Emulation tool?

    You may need to modify your input code to make it more "resilient" of packet drops. For example: Incrementing a counter every time a button is pressed down will ensure that the button presses are "eventually consistent" (i.e. eventually replicated). However, that can have it's own problems (lag spikes causing your input to "fire" on the server seconds after its raised on the client).

    Sending a public NetworkTick LastPressedTick may be a better option, as it allows you to specify a range of valid timings on the server (but it doesn't tell you exactly how many times the button was pressed down).

    Thus, sending:
    Code (CSharp):
    1. public NetworkTick LastPressedTick;
    2. public byte PressCount;
    Would be the most resilient.