Can I use (Physics) Revolute Joints with Multiplayer?

Get help using Construct 2

Post » Thu Apr 03, 2014 5:07 pm

Hey everyone,

we're working on implementing online multiplayer into our 2-player arena duel game.

We have hit a wall and can't continue due to an unresolved issue:

We're tying two physics objects together to form the player - we're doing this via the "create revolute joint" action. On the host, everything works fine. On the peer, however, Local Input Prediction seems to cause problems.

LIP seems to override the calculations in regards to the revolute joint. If we disable LIP everything works fine on the peer but the perceived latency is unacceptable.

We know this is a very specific issue so we would be thrilled if someone could enlighten us on this issue ( @Ashley ? :mrgreen: ).
B
5
S
2
Posts: 29
Reputation: 483

Post » Fri Apr 04, 2014 10:38 am

I would be really thankful if someone could comment on this. We can't continue working until this is solved. :(
B
5
S
2
Posts: 29
Reputation: 483

Post » Fri Apr 04, 2014 11:06 am

Local input prediction won't work unless the player's inputs directly control the object and are also run by the host, as described in multiplayer tutorial 3. If the physics behavior is just simulating by itself without using player input, then it is inappropriate to use local input simulation.

For just syncing objects in general, it should not matter what behaviors you use. Simply run everything on the host, then on the peers disable all the behaviors and sync object will move them like they appear on the host.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Sat Apr 05, 2014 2:07 pm

Another guy from the game here!
Ashley wrote:Local input prediction won't work unless the player's inputs directly control the object and are also run by the host, as described in multiplayer tutorial 3.

This is what we did. We connect 2 physics objects via the revolute joint and the players control the whole construction ('the player object') by applying forces to both objects at the same time (see picture below).

lrj-mp-1.png

The problem is, that the joint does not seem to work properly on the peer side. The physics objects don't keep their distance as soon as the peer starts to input something and the forces are applied (see picture below). On the host everything is correct of course.

lrj-mp-2.png

Ashley wrote:For just syncing objects in general, it should not matter what behaviors you use. Simply run everything on the host, then on the peers disable all the behaviors and sync object will move them like they appear on the host.

We tried this for testing purposes and it worked perfectly fine, as expected. But this is not the solution since the peers need direct feedback on their inputs.

Our question here is:
Is this a bug with multiplayer/local input prediction? (My guess is that the forces are applied correctly in regards of the joint but then overwritten by the local input prediction which is just ignoring the constraints).

Or is it just not possible to control connected physics objects on the host and the peers with local input prediction?

Maybe we just did something fundamentally wrong but we tried everything imaginable and don't seem to be able to solve it ourselves.

If you need a .capx, I can create one for you of course, when I got some spare time. But I hope the images and descriptions are clear enough now. Feel free to PM me or just answer right here.

@Ashley: Thank you so much in advance and for making all this possible in this wonderful program of yours! :D
We keep recommending Construct to our friends and fellows! ;)
You do not have the required permissions to view the files attached to this post.
B
2
Posts: 2
Reputation: 154

Post » Sat Apr 05, 2014 4:40 pm

Physics is a bit of a special case since trying to move a Physics object with 'set position' or 'set angle' counts as teleporting the object in the physics world which is obviously unrealistic and can lead to weird results. The multiplayer object internally will be doing 'set position' and 'set angle' so it might just be that they just won't work well together. You might just have to disable LIP and live with the input latency.
Scirra Founder
B
395
S
231
G
88
Posts: 24,367
Reputation: 193,694

Post » Sat Apr 05, 2014 4:50 pm

Ashley beat me to a reply... again :D

As a rule of guide most games don't do object syncing for networking. They work by instructions which is the more common way for non player entities. You best bet is to use a controller that gives physics objects instructions. however I would be concered with latency and Fixed Time step. You may need to tinker with a network timestep. This would be modifying the two main physics simulation values on certain perodical increments.

The other method is to do Ashley suggestion. Where Physics are controller on one computer and the position state are then mimiced to the others.

In Roblox which is amazing engineering for network physics. Roblox uses a model where the nearest player to objects has authority of the physics and handles the simulation. They send the results to other players who then follow suit of the simulation. Then the simulation is updated by the authority every x period of time and updates the others who are not the authority. This model however will require you develop spacial tree's of objects.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Sat Apr 05, 2014 4:57 pm

Thank you very much for your response! This is a bit of a bummer but at least we now know that we can't really do anything on our side. We will now try using another kind of input method.
B
2
Posts: 2
Reputation: 154

Post » Fri Apr 25, 2014 12:53 pm

My gut feeling with Multiplayer +Physics is to have the whole simulation happening only on the host computer. So the host would be the only one with the "physics behaviors" applied, while for the peers you have the same objects without the physics behavior so that u can do set position and set angle based on the positions and angles of the objects on the host computer.

So in a way you're trying to create a pantomime on the peers computer that looks just like what's happening on the hosts side. You don't have to have revolute joints on the peers side becos if the peers objects get their positions and angles from the host then it will all look and work the same anyways.

Any inputs get sent to the host and calculated on the host's side.

I dunno, am I talking crap or is this the way you guys would do it?
B
34
S
5
G
1
Posts: 78
Reputation: 3,397


Return to How do I....?

Who is online

Users browsing this forum: darkrealos, Rhindon and 19 guests