Bullet on networks

Lf3THn4D
Posts: 11
Joined: Tue Mar 11, 2008 4:14 am

Bullet on networks

Post by Lf3THn4D »

Hi, I've searched the forum many times looking for details to implement networked physics. But I haven't actually found any concrete answer anywhere. I'm planning to use the method described by Glenn. However, as networking goes, one needs to beable to snap a client side body to the right location when they are no longer in sync. As I recall, snapping in Bullet means moving rigid body to location then clear the contact points cache. This sounds very expensive to do in a 20 fps interval.

So my question is, is clearing contact point cache all the time a viable solution? Or is there other methods that I missed?
User avatar
Dragonlord
Posts: 198
Joined: Mon Sep 04, 2006 5:31 pm
Location: Switzerland

Re: Bullet on networks

Post by Dragonlord »

Why do you want to do physics on the server machine AND the client machine? Usually you do physics on one machine and just propagate the state ( turning the object into a kinematic one on the other end ). No need to do tricky synchronization and doing the same work twice.
Lf3THn4D
Posts: 11
Joined: Tue Mar 11, 2008 4:14 am

Re: Bullet on networks

Post by Lf3THn4D »

Hi, thanks for the reply.

The reason I wanted to do this is because I want to attempt physics network simulation on the internet. I have to consider high latency issues. If I just propagate states, that would cause horrible retarded input lag on the client side of things. If I try to simulate input from client side before the real state packet comes, I would need to simulate physics on the client side (Just to fake the lag issue). However, it wouldn't work if I'm doing a kinematic object on the client side. Unless I write my own rigidbody simulation? That defeats the whole purpose of using bullet imho.
colinvella
Posts: 24
Joined: Sat Feb 09, 2008 2:38 pm
Location: Malta

Re: Bullet on networks

Post by colinvella »

What about a partial approach, that is, just solving unconstrained motion? Arguably you might see jittering or even temporary tunnelling if lag times are large enough, but at least you should be able to get fluid motion between status updates.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Bullet on networks

Post by Erwin Coumans »

For anyone who hasn't seen them yet, a few links to networked physics discussions:
http://www.gaffer.org/
http://www.gaffer.org/game-physics/fix-your-timestep
http://box2d.org/forum/viewtopic.php?f=3&t=143
http://www.javagaming.org/forums/index. ... #msg143560

Have you tried just setting the position without clearing the contact cache?

It would be good to have some sample implementation for networking in Bullet at some stage. Anyone interested in contributing some basic sample code?
Thanks,
Erwin
Lf3THn4D
Posts: 11
Joined: Tue Mar 11, 2008 4:14 am

Re: Bullet on networks

Post by Lf3THn4D »

Hi,
Thanks a lot for the replies and interests :)

Colinvella:
Do you mean that I do the simulation of rigidbody without the collisions and constraint part?

Erwin:
I'll go for your suggestion. I'll try to move the rigidbodies without clearing the contact cache and see what happens. :) Btw, thanks for your wonderful bullet physics engine. :)
colinvella
Posts: 24
Joined: Sat Feb 09, 2008 2:38 pm
Location: Malta

Re: Bullet on networks

Post by colinvella »

Yes.. obviously with the downsides I highlighted.