-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b5205d
commit 7d73d0b
Showing
6 changed files
with
36 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# BaseNetInput | ||
|
||
Base class for Input nodes used with rollback. | ||
|
||
During rollback, multiple logical ticks are simulated in the span of a single | ||
network tick. Since these are just logical ticks, no actual input arrives during | ||
them from the input devices. | ||
|
||
The solution is to gather input before the tick loop, and use that input for | ||
any new ticks simulated during the rollback. | ||
|
||
## Gathering input | ||
|
||
This class provides a virtual `_gather` method that you can override. Set the | ||
variables configured in [RollbackSynchronizer] in your own implementation: | ||
|
||
```gdscript | ||
extends BaseNetInput | ||
var movement: Vector3 = Vector3.ZERO | ||
func _gather(): | ||
movement = Vector3( | ||
Input.get_axis("move_west", "move_east"), | ||
0, | ||
Input.get_axis("move_north", "move_south") | ||
) | ||
``` | ||
|
||
[RollbackSynchronizer]: ../../netfox/nodes/rollback-synchronizer.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters