Box2D Forums

It is currently Sat May 25, 2013 10:18 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Jan 30, 2010 10:36 am 
Offline

Joined: Fri Jan 08, 2010 3:38 pm
Posts: 44
Hello,
is possible set the body Serializable/Externalizable? it can be really useful for network game :)
I think the externalize is the solution, because body contains world, ControllerEdge, XForm, Sweep, Vec2, Shape, JointEdge, ContactEdge, and Object(userdata and idlock).
XForm, Vec2, shape and userdata is easy to be serializable (just a check for valid userdata, if serilizable then send it^^).
idlock and world has to be created on the receiver.
ControllerEdge, JointEdge, ContactEdge have to be recalculated on the reciver?
what about Sweep?
maybe i can only send xform and a "shapes container" and then recreate the body on the receiver? :shock:

off topic: what you think is the best solution to solve the asynchronous body creation due to network lag?


Top
 Profile  
 
PostPosted: Mon Feb 01, 2010 12:31 am 
Offline

Joined: Mon Jun 08, 2009 12:21 pm
Posts: 353
Based on what I've don't, serializing the body objects themselves is not the way you would want to network a game. Plus, it wouldn't really work out well with the engine. See this thread for networking tips:

viewtopic.php?f=9&t=4009

lestofante wrote:
off topic: what you think is the best solution to solve the asynchronous body creation due to network lag?


That's solved with the message system I talk about in that thread, where you tell everyone in the network to create a body at the time, say T, where T is the time (in seconds, milliseconds, nanoseconds, whatever) from when the game officially started.


Top
 Profile  
 
PostPosted: Mon Feb 01, 2010 3:07 pm 
Offline

Joined: Fri Jan 08, 2010 3:38 pm
Posts: 44
I was thinking to make the user draw it's "avatar", then simply send the shape to server and validate it. If the body is ok send him to all client (for pre-load the images), then the server can activate/deactivate a body on a client simply with a "infoposition packet" or "remove packet"

i've readed the post a week ago, i like the idea of synchronous creation and i'm going to implement it. also I was thinking about something similar but with rollback done periodically to synchronize [only the position, rotation and velocities], because the world can have 2000+ obj and it's impossible to send and receive them in one step, and use an interpolation between the estimated position and "official" servers position.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: psbot [Picsearch] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group