We factor out a common simulation abstraction for the 3 or 4 places where we simulate the game: server, client reconciliation, and client prediction (twice). To combat the performance issues caused by duplicating our game state too many times, we added checkpointing to our entity management, reducing clones in exchange for state-handling complexity: now we have to mark objects as dirty
before modifying them. Finally, we re-enabled the shooting system…but not our bullet physics.
Notes/highlights
- This session’s optimization hinges on a checkpointing mechanism that adds some complexity. We’re pretty sure it will come back to bite us. Some tools/libraries we discussed to deal with this:
- TypeScript
Readonly
type: https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype - Immutable.js: https://github.com/immutable-js/immutable-js
- C++
const
: https://isocpp.org/wiki/faq/const-correctness - Rust mutable and immutable variables: https://doc.rust-lang.org/stable/book/ch03-01-variables-and-mutability.html
- TypeScript
- We had a brief discussion on whether to use “type” or “interface” for object types. In recent versions of TypeScript, the difference between them ends up being really small: https://stackoverflow.com/a/37233777