JGN and TestAdvancedVehiclePlus


Hi all networkers,

I am trying to apply the JGN library to the TestAdvancedVehiclePlus
Demo from JMEPhysics.

Its in test-interactivecomjmetestphysicsvehicle.

The Controller wants a DynamicPhysicsNode but all I could
find was the getChassis() call in Car.java.

But that doesn't seem to work...

To I have to sync ALL parts ?

Ray.

Take a look here:



http://captiveimagination.com/svn/public/jme-physics-networking/tags/1.0/src/com/captiveimagination/net/physics/test/car/



For an implementation of what you’re trying to do on the old jME-Physics and the old JGN. It should give you a general idea of how to make the connection.  Also, if you get it done feel free to contribute it as it would be useful to people trying to learn jME-Physics-Networking.


Hmm,

in the old code you also transmitted torque and force.
In the new Controller they are missing...

But I think you had good reasons for not including them.

So it must be something else...

Ill look further.
Ray.

Hmm,
and I also saw, that u register the chassis and the wheels on the client
but only the chassis at the server...

I am confused..
:(

Ray.

Yeah, the torque and force was not necessary. Not sure why I registered chassis alone and chassis and wheels.  I think you need to register both if I recall to properly synchronize. Strange that the old code worked if that's the case though. :o



If you still can't figure it out post some code and I'll do what I can to help.


Ok I gained some wisdom about physics and it kinda works now. :)

I made a custom CarController and transfer all DynamicPhysicNodes stats
( i.e. translation, rotation, lin. velocity, ang velocity ) in one message.
So basically chassis, 4 suspension bases and the 4 wheels in one Sync.Message.

I feared if I'd register all DPNs separate the car might get ripped apart some times,
i.e. some packets are not yet received in this update cycle and so some DPNs get
new values and some not. Please enlighten me if I'm wrong. :)

Of course I think about optimizing this, because most car parts have a fixed location
relative to each other. So I don't really need to send each location in every message.

I will wait for your feedback, but if I'm in the right direction I would be happy
to provide an example of this for the jgn-physics project.

Ray.

I believe the joints should keep that from being a problem, but perhaps Irrisor could enlighten us with the reality of the matter.  However, in practicality it's not really an issue for a test case since they would never be far enough off to make a big difference.

Some things from the test developer (not that it's very good):



1 - The parts are not really relativelly FIXED. They are supposed to move when the force is strong enough… The suspension bases are tied to the chassis but can have a vertical movement (dump and spring).

2 - The wheels are kind of fixed from the bases, except for their rotations, but actually they occilate a bit (but that is something I tried to fix and couldn't)

3 - That said you can always count on optimization by thinking this: what do you want to replicate on the clients? precise  replicated simulation? or a visual copy is enough?

Probably you want something between, so you can have some dead reckoning.



Somebody worked on a much improved version of my vehicle code, making simulation closer to real life:

  • Wheel turns not symetrical
  • Better damper and spring (with "pumps")



    But I can't seem to find it right now.

So Darkfrog, you would register each DPN itself ?

What about the CreateMessages ?

Then it will be much harder to create the remote car, wouldn't it ?

With my CarMessage I can create the car and all its parts in one step.

Hey Perick,

thanks for the insight.

Yes I want more than just a visual copy, I want to reuse the physics
engine so that the remote object moves physically correct in between
network packets.

So you concur it is correct to transmit all DPNs data ?

Ray.

Personally I would just start out with the vehicle and wheels…or do like you suggested and use your own CarMessage to do it and then you'll just need to create your own GraphicalSynchronizer implementation that will apply the changes.  It's actually pretty trivial and you can look at the JMEPhysicsGraphicalSynchronizer for the basis.

Hi all !!





Paranoid, did you succeed in implementing multiplayer with testadvancedvehicle ?





:slight_smile:

No not really.



You can test it yourself if you whish.

But I got many socket exceptions…



https://dots.svn.sourceforge.net/svnroot/dots/SandHopper/trunk


I have got something working but It's quite different from your code.  I manually create the players and use my own synchronized message to transmit a car physic snapshot :slight_smile:



I compute an opponent car physic on a player pc only if the opponenent is near (and conversely), so I can save processor time: and I've got physic-reckoning.

When an opponent is far I use a less realistic reckoning with a box.



Now I wonder if I have to keep this simulation entirely distributed or if I have to keep a server which physic engine containing all the cars to have an authority when many pc lag at the same time, make the simulation impossible to manage this kind of P2P way. I guess I'll do like DarkFrog told me: add a server because if not it'll be an entire mess

kine said:

Now I wonder if I have to keep this simulation entirely distributed or if I have to keep a server which physic engine containing all the cars to have an authority when many pc lag at the same time, make the simulation impossible to manage this kind of P2P way. I guess I'll do like DarkFrog told me: add a server because if not it'll be an entire mess


Trust me, I wish that weren't the cold hard truth either. :-p