Skip to content

One-Off Inputs tutorial duplicates one-off input during lag #489

@DustieDog

Description

@DustieDog

🐛 Description

The code for one-off inputs doesn't properly take into account the following paragraphs from the tutorial:

A different issue pops up when the game slows down a bit, and netfox needs to run multiple ticks in a single loop to catch up. Let's visualize this with a timeline, showing both the user input in real-time, and what netfox records as input:

To solve [this issue], one-off inputs can be buffered similarly to continuous inputs. The difference is that we reset the input value after it's gathered - this way, the input will be true for at most a single tick:

Steps to reproduce

Use a list to describe how to reproduce a bug, e.g.:

  1. Follow the tutorial for adding one-off inputs.
  2. Overload your game so NetworkTime ticks multiple times at once.

Expected behavior

  1. Only the first tick should contain the one-off input.

Observed behavior

  1. All processed ticks contain the one-off input due to _gather only being run once per loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions