I'm currently developing a top down, realtime, zombie shooter. I'm coding this in Java, using JBox2D as my physics engine. I have been coding the networking this week, and am now up to the physics synchronization.
I'm planning to use the predictive client/authoritative server model, where the client is free to move, as long as the server approves of it later. This involves the client sending packets containing movement data to the server, and the server calculating latency, and re-simulating the world from an older state.
My problem is, my current physics engine, JBox2D (basically a port of Box2D), doesn't support rolling back the world, and apparently isn't that easy to serialise the world data. I have 2 solutions, I could either modify/extend my current physics engine, or write my own.
Reasons for writing my own physics engine -
- I can remove unnecessary features. In a top down game, I only really need collision mechanics, and handling forces. No gravity is involved.
- I can understand the code better, and it would [most likely] be easier to implement roll back functions
Reasons for extending/modifying JBox2D
- Writing my own physics engine, would be a significant amount of work, which could be cumbersome
- JBox2D has a widely supportive community, that can help me with my dev
- JBox2D, has specific optimizations, for things like collision detection, which make it useful
- Some work as already been done on this, but little code has been shared
So what are your opinions. This is my first game, and I am no way a professional game developer. If anyone could provide some links to work already done in the area (preferably using JBox2D/Box2D/Java).