Skip to content

Commit 19f8cac

Browse files
authored
docs: Inputless RollbackSynchronizers (#528)
Closes #450
1 parent 5fbb927 commit 19f8cac

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Using RollbackSynchronizer without inputs
2+
3+
In certain cases, a component needs to participate in rollback, but is not
4+
driven by any input. One example could be more complex NPCs. These need to be
5+
part of the rollback tick loop, but they are not controlled by any player.
6+
7+
In these cases, you can use RollbackSynchronizer as described earlier in
8+
[Responsive player movement], but without the input. This means not needing an
9+
input node, and not configuring any input properties. State properties still
10+
need to be configured, and the gameplay logic must be implemented in
11+
`_rollback_tick()`.
12+
13+
!!!tip
14+
An example project featuring a simple NPC using an inputless
15+
RollbackSynchronizer can be found at [examples/rollback-npc].
16+
17+
Under the hood, *netfox* will simulate these inputless nodes whenever it
18+
encounters a tick that has no state for the inputless node. On the server, this
19+
means inputless nodes will be simulated only for new ticks. On clients, this
20+
means never being simulated, since all state is received from the server. If
21+
prediction is enabled, clients will simulate inputless nodes for ticks they
22+
don't have data from the server.
23+
24+
25+
[Responsive player movement]: ./responsive-player-movement.md
26+
[examples/rollback-npc]: https://github.com/foxssake/netfox/tree/main/examples/rollback-npc

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ nav:
3636
- 'netfox/tutorials/responsive-player-movement.md'
3737
- 'netfox/tutorials/input-gathering-tips-and-tricks.md'
3838
- 'netfox/tutorials/predicting-input.md'
39+
- 'netfox/tutorials/using-rollbacksynchronizer-without-inputs.md'
3940
- 'netfox/tutorials/modifying-objects-during-rollback.md'
4041
- 'netfox/tutorials/configuring-properties-from-code.md'
4142
- 'netfox/tutorials/rollback-caveats.md'

0 commit comments

Comments
 (0)