How do I make proper moving objects in [Multiplayer]

0 favourites
  • 3 posts
From the Asset Store
Now you can drop everything in your game with sound :)
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • [quote:3dlro9j3]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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)