Peer will not move

0 favourites
  • 15 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • I am building an online multiplayer game, and for the controls, the host is able to move perfectly fine. However, the peer moves both the host and the peer a little bit on its side, stops, and then moves back. I've looked over my code multiple times over, and haven't found any issues. can anyone help me with this issue?

  • In C3's style of multiplayer, only the host should be controlling the movement. The peer sends his inputs to the host and the host moves the peer's character based on the peer's inputs

    You need to disable the movement behaviors on the peer's side for the peer and host object. I'm assuming you're using 8 Direction. By default it needs to be deactivated, and it should only be activated on the host's game

  • ah, okay. I am using the platform behavior, not 8direction, and I'm fairly new to multiplayer. here's some screenshots of the code so you can tell me specifically what I have to remove, add, or replace.

  • You need to change 2 things

    1. In the second screenshot move the getbits to a subevent underneath the For Each. Right now they're just floating. This is why the host isn't moving anyone but himself

    2. In the third screenshot, just remove all the Platform Behavior controls in the peer's logic. Like I said in the post before, only the host should be controlling the movement. The peer should only ever send his inputs to the host

    In the peer's logic you should also disable the platform behavior for any peer that is created as well. If you leave it activated there can be weird glitches as the host and peer try to reconcile the state of the game

  • so having a 2-player platformer game that uses this type of multiplayer is more or less impossible?

  • No, it's entirely possible. Have you read through the Multiplayer tutorial?

    construct.net/en/tutorials/multiplayer-tutorial-1-concepts-579

  • I just did, several times over, and even making tweaks to the code that I thought would do it still doesn't allow the peer to send their inputs.

  • Can you post your project?

  • I cannot, since it’s a school project for a competition (which is why I have an online multiplayer mode- to make it unique), and it’s just a mode, there’s a bunch of other stuff around it, but I can send screenshots of the new multiplayer code in its entirety like last time

  • So I may not be able to show the entire project, here is an explanation of what’s going on still: on the host’s side, WASD moves only the host’s character, and the arrow keys moves both the host and peer, and it updates properly for both players. However, on the peer’s side, pressing WASD or the arrow keys doesn’t move the peer at all on either side and this is after removing the platform events and disabling the platform behavior for the peer.

  • Yes, it would be helpful to see as much as possible. All I can do is guess what's wrong right now

  • here is the latest update to the code, if it helps

  • 1. In Host logic move "Set Platform Default Controls Disabled" To the "On Peer Connected" Event

    The reason the Host is currently moving the peer is because you are only disabling the platform default controls for the host character. This means the peer's default controls are still enabled, and thus the Host is controlling him on accident when you press keys. To fix this just move the disable action to the peer connected event, so that every single peer gets his default controls disabled

    2. In Host logic add a "For Each Cassete_chan" condition underneath the condition where you pick all the peer cassete-chans

    multi_id =/= Multiplayer.MyID

    For Each Cassete_chan

    then put all your logic after that

    3. I can't tell if you are leaving "Peer Controls" group disabled. If you are, make sure you enable this group for the peer. Right now it looks like "Peer" is being enabled but "Peer Controls" is not. This would be why the peer can't move himself

  • both the peer and the peer controls group are disabled on startup. even when i made the peer controls group active, the peer isn't moving, but the host can't control the peer now, so there is some progress. Oddly enough, putting the "disable platform" action for when the peer connects allows them to move, but they can't jump, move through the host's character, and the peer continuously hops up and down

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)