How do I make proper moving objects in [Multiplayer]

Get help using Construct 2

Post » Thu Nov 12, 2015 6:54 pm

Salut!

I really enjoy developing with the multiplayer system of Construct 2. I figured out most of it.
Now i'm think how its is possible to have proper movement of faster moving objects on every client.

Let's say i have a dagger that i'm throwing. It's not like a bullet but it uses the bullet behaviour.
It starts flying and decelerates until it stops. It can hit someone or hit a wall.

This is all done and easy. The point now is, i want to make the hit check on the host and tell the clients what the dagger hit.

My first try was to create the dagger locally on every client with the correct angle of motion. That works pretty well but the problem is (except of the fact that every client has a bit of a different angle and flying dagger) how would i stop the dagger in the right moment for every client?

If the host detects a hit of a moving player, the dagger stops. I send a message to all clients with the id of the dagger and the player hit. That works, but the dagger is (obviously) before or behind (or with some luck) on the player. So thats a bit inaccurate.

My next try was to sync the object. First i didnt use Input Prediction. That works but looks pretty laggy and not smooth at all (but its the most accurate). If i'm enabling the input prediction the movement is smooth and the way how it acts feels good. However the dagger is flying faster and fruther on the clients and always needs to roll back a bit when stopped. What the hell? :)

Does anyone have a cool idea or did already some successful stuff for such flying objects and syncing it all together?

Thank you!
B
11
S
2
Posts: 9
Reputation: 812

Post » Sun Nov 15, 2015 5:32 pm

Peer: create dagger, set speed, set deccelaration, en Object.asjson to host, host creates new object and set json from the multiplayer message, and transmits the same mutliplayer message with the json code to the other peers.

This works fastest. As it takes all the values/layer/location/acceleration/bullet state/etc etc in the json info and uses it to set the object state.

for host and other peers simply create the dagger on layer 0 at 0,0 then set the object to the the multiplayer message having the json.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Mon Nov 16, 2015 8:09 am

I like the idea of sending json. But what about prevent cheating?

I mean if the peer creates the object and set's all values, it could be possible to cheat by overriding the values.

Any suggestions?

Thanks for your help :)


EDIT:
I figured out a good way to do it via the host. Much appreciate for this great advice! :D
B
11
S
2
Posts: 9
Reputation: 812


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 56 guests