Multiplayer Drag and Drop (ONE Object)

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • I am trying to create a simple multiplayer game where anyone in the game can drag the same object. This objects location will be synced across all screens. Currently the object is being duplicated for everyone in the game. Currently only the hosts object position is being shared globally.

    Is this possible ¯\_(ツ)_/¯

  • Yes this is possible.

    As with all peer to peer networking with authoritative host, each peer will send only their input states to the host, such as mouse position and button inputs.

    The host, upon receiving the input state from any peer, can determine what to do with the object.

    For example, upon receiving a "click" and "position" from a peer, the host will go through the following process:

    Conditions:

    Where did the peer click? Is it on an object?

    Is the peer holding the mouse down?

    Where is the peer's mouse position moving to?

    Action:

    Move object to new location.

    Using object syncing, the object's new position will be reflected to all peers.

    You will have some additional considerations, such as "ownership" of an object, so multiple people can't manipulate the same object simultaneously, as well as local input prediction so the object's movement will be instantly reflected locally on a peer to hide lag.

  • I have tried with the condition touch of an object, send the object x,y coordinates to the host and then the host sets the position of the object upon receiving the messages but it does not appear to be working. Again, I am very new to construct and the project that I have created is using the DemoChat as a starting point.

    What does it look like I'm doing wrong?

    Here is a link to the project as it is now:

    drive.google.com/file/d/1r8FKA9LRMeSWJpABusRI4F2dTzSFz2Rl/view

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All a peer does is send its inputs, the host determines what to do with the inputs.

    The peer doesn't even need to know if it is touching anything. The host will see if there is an object at the location the peer's input specifies. Messages should not be used in this case.

  • Okay, here is a much simpler project that is only sending the touch location and is not using messaging. It is using another simple demo game as a starting point. It seems like I am comparing the values correctly but it still does not seem to be working. Also, if the click is inside the bounds of the object what should I do with the object? I cannot set the location of the object to the x,y values that I have because although they are within the object they are not necessarily the the correct location for the object to be positioned.

    Here is a link for the new project:

    drive.google.com/file/d/1ococnCqDt-CEYJnzv1XbjvAW9wiNs9t0/view

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