netfox icon indicating copy to clipboard operation
netfox copied to clipboard

PredictiveSynchronizer

Open elementbound opened this issue 1 year ago • 2 comments

:sparkles: Description

There are objects that need to participate in the rollback loop, but are not controlled by any input - e.g. moving platforms, interactive objects like doors, etc.

In addition to lacking input, these also depend fully on known state, so there's no point in synchronizing them.

Implementation

Introduce a PredictiveSynchronizer node. It would have a state configured the same way as in RollbackSynchronizer, but no input, nor synchronization-related properties.

It would gather all nodes implementing the _predict_tick() method and run them as part of the rollback loop.

Distribution

netfox core

Notes

  • :question: Should there be optional state synchronization?
  • Preferably implemented after HistoryBuffer in #358 so it can be reused

elementbound avatar Jan 06 '25 23:01 elementbound

Is the functionality that far from RollbackSynchronizer? I feel like we're missing an opportunity to simplify and avoid a whole new node.

For example, you could tweak a RollbackSynchronizer to handle an empty Input configuration. Or perhaps add a "Process Input" checkbox, which, if unchecked could hide the Input fields from the node.

StateSynchronizer could even have a "Predictive" checkbox to enable rollback for its synced properties but I think that would go against the "just like Godot" purpose of that node.

krazyjakee avatar Jan 07 '25 01:01 krazyjakee

That's a really important point @krazyjakee, I've been pondering that myself too.

On one hand, having a separate PredictiveSynchronizer would be a stronger distinction between "this is in rollback AND controlled by players" vs. "this just does its thing, but in rollback". It's another question whether this is such an important distinction :smile:

Having this as part of RollbackSynchronizer might be friendlier for users, as it's the same node, and can be re-configured easily.

Something I'm concerned about is that RollbackSynchronizer is slowly becoming a God class. Separating it into multiple components can help for a while, but still, much of the new features end up in that single node.

Either way, I think RollbackSynchronizer can already do this, it just needs better docs and support :smile: Before #321, it only simulated notes with known inputs. However, for fully predicted objects, there's no input. But now, with prediction enabled, it might just work. Will need to check and possibly document.

elementbound avatar Jan 07 '25 20:01 elementbound