This recipe will go into something of a final frontier in game development. The topic is extremely application-dependent, and it is difficult to get right. Hopefully, after going through this recipe, you will have a basic framework in place that can be adapted to specific projects.
This recipe is for those who have a fundamental understanding of both Chapter 7, Networking with SpiderMonkey, and Chapter 8, Physics with Bullet. This recipe will describe how to implement networked physics in the networked fps that was discussed previously in the book. Since this is built on top of the existing framework, an AppState
pattern has been chosen to isolate as much of the physics code as possible. There will be some overlapping, though.
Physics can be expensive as it is and has its own problems and requirements. Sending translations and rotations for objects over the network with every tick will seriously affect the bandwidth load. The ground rule is this: send only what...