Hi, everyone
I am developing a racing car using box2d engine, I have 2 ideas and test them:
One Way:
1. use box2d engine to simulate in every client
2. used java as server, server only accept keyboard and collision and so on events, then server dispatch all such events to all clients (please ignore the client cheating )
instance description: now we have client A and B, they are in the same ground. so client A could see car A and car B, also client B.
car A and car B could be synchronized, but a few time, car A's position in client A is different with car A's position in client B.
I think the reason is that: box2d use float precision, and I use 30 as PHYSICAL SCALE.
The other Way:
1. use box2d engine to simulator in every client
2. used java as server, it runs jbox2d engine, server accept keyboard and collision and so on events, then server dispatch all such events to all clients
3. server also runs a thread to correct client's position every 2 secs.
instance description: the position of car is different between server and client(position of car in server and client can't be synchronized), I think the float is not very accurate.
Could you some one give some advice or some example which uses box2d in network game.
I am developing a racing car using box2d engine, I have 2 ideas and test them:
One Way:
1. use box2d engine to simulate in every client
2. used java as server, server only accept keyboard and collision and so on events, then server dispatch all such events to all clients (please ignore the client cheating )
instance description: now we have client A and B, they are in the same ground. so client A could see car A and car B, also client B.
car A and car B could be synchronized, but a few time, car A's position in client A is different with car A's position in client B.
I think the reason is that: box2d use float precision, and I use 30 as PHYSICAL SCALE.
The other Way:
1. use box2d engine to simulator in every client
2. used java as server, it runs jbox2d engine, server accept keyboard and collision and so on events, then server dispatch all such events to all clients
3. server also runs a thread to correct client's position every 2 secs.
instance description: the position of car is different between server and client(position of car in server and client can't be synchronized), I think the float is not very accurate.
Could you some one give some advice or some example which uses box2d in network game.