Skip to content

Added Input delay (no custom serialization, no static typing)#276

Merged
elementbound merged 16 commits intofoxssake:mainfrom
TheYellowArchitect:input-delay-standalone
Jan 31, 2025
Merged

Added Input delay (no custom serialization, no static typing)#276
elementbound merged 16 commits intofoxssake:mainfrom
TheYellowArchitect:input-delay-standalone

Conversation

@TheYellowArchitect
Copy link
Copy Markdown
Contributor

@TheYellowArchitect TheYellowArchitect commented Sep 14, 2024

This is #261 but without the dependency of #251 and without any static typing #277
Solves #245

@albertok
Copy link
Copy Markdown
Contributor

I'll give this PR a test over the coming weeks and report back.

@albertok
Copy link
Copy Markdown
Contributor

Gave this one a round of testing. The improvement is noticeable - you can feel there is less reconciliation overall especially when it comes to observing the positions of other players.

Logging the rollback loops you can visually see they half as there is less need to go back to correct for late input arrival.

image

@albertok
Copy link
Copy Markdown
Contributor

albertok commented Jan 25, 2025

There may an issue with the "is_fresh" flag in rollback_tick when input_delay is active. I am noticing that things that rely on it are playing up occasionally.

You can see in the screenshot from my last comment, on the left they aren't as common as on the right.

Searching across logs there are definitely instances where a tick is never fresh, this doesn't seem to happen on the server.

@elementbound
Copy link
Copy Markdown
Contributor

Thanks for checking @albertok! As discussed on Discord, I think for now we can have both display offset and input delay, so we'll have to figure out this issue. Also wondering whether display_offset is affected by this as well.

## This is measured in ticks. So if your game's tickrate (project settings > Time) is 60 ticks, 4 ticks are 68 ms (bad but acceptable)
## If your game's tickrate is 30 ticks, 4 ticks are 134 ms (laggy)
## The lesser the value, the tighter the controls feel locally, but the less time for other players to catch up to this node's input
@export var input_delay: int = 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be best to have this as a project setting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a guard to make sure its never negative

@albertok
Copy link
Copy Markdown
Contributor

albertok commented Jan 26, 2025

My discrepancy with is_fresh turns out happens because the server can beat the clients at their own inputs if the latency isnt high enough. ( 2 ticks over localhost )

Basically the client was skipping running rollback_tick because the server had already processed and sent it a saved snapshot.

If I dialled up the latency this stopped happening.

@elementbound
Copy link
Copy Markdown
Contributor

@albertok added docs about this phenomenon both in the GDScript docs and the site, so hopefully people don't run into the same issues! Will return to the question of is_fresh in a separate PR.

@elementbound elementbound merged commit 1223bd9 into foxssake:main Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants