fishfolk / bones

An easy-to-use game engine for making real games.
https://fishfolk.org/development/bones/introduction/
Other
210 stars 20 forks source link

fix: Fix Zero'd DenseMoveDir not representing no input. #380

Closed MaxCWhitehead closed 5 months ago

MaxCWhitehead commented 5 months ago

When GGRS sends predicted input on first frame (no prev input to use), it zeroes PlayerInput and uses that.

Due to how we quantize move direction, zeroed bits did not represent no movement input, it instead was (-1.0, -1.0). This sometimes caused desync on beginning of online match.

Previously used 6 bit representation over range, was changed to quantize [0, 1.0] with 5 bits, and include a sign bit to map from [0, 1.0] -> [-1.0, 1.0]. Because range is symmetric and we quantize only half of it with one less bit, should still be same amount of precision. Now all zero bits represents 0 which is compatible with ggrs.

Additionally added debug log (not enabled by default) in networking to dump net inputs.