Skip to content

feat: Implement synchronizer logic as servers#549

Merged
elementbound merged 97 commits intomainfrom
exp/server-pattern
Mar 11, 2026
Merged

feat: Implement synchronizer logic as servers#549
elementbound merged 97 commits intomainfrom
exp/server-pattern

Conversation

@elementbound
Copy link
Contributor

@elementbound elementbound commented Jan 6, 2026

This is an experimental PR, that refactors much of netfox's internals, inspired by Godot's server pattern.

While Godot had its own requirements, the interpretation here is that:

  • Servers are singletons that provide access to a group of related functionalities
  • Servers act as an interface, similar to a facade, as an outer boundary to internal details
  • Nodes act as convenient wrappers to servers, meaning they expose some config and then do some server calls based on said config

Hopefully this allows:

  • Simplified history tracking
  • Greatly simplified RollbackSynchronizer, StateSynchronizer, and PredictiveSynchronizer
  • Easier testing
  • Batching - sending state in one RPC per tick, instead of one RPC per RBS per tick
  • Nested RBS's
  • An easier fix for RollbackSynchronizer removes mutated states on rollback #383
  • Buffering incoming data in case the target node doesn't exist yet, instead of printing errors
  • Easier implementation of Rollback liveness #468

Also lays the foundations for some potentially wild features like:

  • RPCs on objects
  • Rollback on objects

TODO:

  • Diff states
  • Redundant inputs
  • Binary state serialization
  • Binary input serialization
  • Support schemas
  • Support visibility filtering
  • Networked IDs
  • Command bus
  • StateSynchronizer
  • PredictiveSynchronizer
  • Update metrics
  • Toggleable input broadcast
  • Mutations?
  • Separate into multiple PRs

Pending fixes:

  • Input prediction
  • Diff states

Sanity tasks:

  • Implement tests
  • Implement / postpone TODOs
  • Test with large states, e.g. larger than the MTU of 1500 bytes
    • Large state ( 2k ) doesn't arrive consistently using noray + relay
    • Checking the same scene with 1.35.3 works well
  • Test physics stepping
  • Test display offset and input delay
  • Test Track and expose latest confirmed tick #470
  • Test all examples

Introduces #556
Closes #559
Closes #432

@Archists-dev
Copy link

Great stuff!!

@elementbound elementbound mentioned this pull request Feb 4, 2026
18 tasks
@elementbound elementbound changed the title refactor: Server pattern feat: Implement synchronizer logic as servers Mar 6, 2026
@elementbound elementbound marked this pull request as ready for review March 6, 2026 13:00
@elementbound elementbound merged commit d6ddde4 into main Mar 11, 2026
2 checks passed
@elementbound elementbound deleted the exp/server-pattern branch March 11, 2026 21:57
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.

Implement rollback servers Batch RPCs for synchronization

3 participants