How do I set all players to show to each other on multiplayer plugin

0 favourites
  • 11 posts
From the Asset Store
Adventure Quiz interactive (Questions and answers via Json)
  • I’m workin on a simple game like chess or checkers and I need help gettin the chess pieces to show properly in correct animations and x/y position for host and peer

    And also the stats to show like health points for each chess piece

    It’s a simple 2 player multiplayer game , thank you to anyone that can help

    Post your discord so we can chat if you want to help me

  • Hello,

    One logic you can use is adding Point, x, y and UID instance variables in a family and make two seperate families one fro black other for white or just one family in which each will have 2 animations (black and white).

    Now, If you are using construct multiplayer then you will have to focus on Host and peer in which

    These chess objects will be already placed at initial places.

    When host moves any object then add those values to its instance variables ,y then send it to peer and peer will set that particular object to the place you chose. Same applies to peer to host.

    Every time check which UID you have moved and send that data using messaging broadcast (host to peer) and peer message ( peer to host)

    I'm just telling you logic cause it will be fun if you make it by yourself

    Good luck

  • I just ended up using sync multiplayer on the sprites , sync with position and angle and it shows the locations for all of them which was actually easier ,now my problem is syncing the global time variable each player has 30Seconds to make their move and it switches to the next players turn, idk how to sync the time variable because its showing different for each player.

    Add me on discord ZtarDuzt#8322

  • Hey there!

    You figured it out! That's good !

    So for timing if you know we can sync variables too.

    -> add instance variable( you will need to sync timer(text object too) to timer (sprite or text) whatever you are using and add one more variable named turnof which should also be instance variable of timer (text)

    Then at game start, Host will set timer on and set turnof to 1 means host itself.

    After his turn of time up, he will change it to turnof 2 and time to 30 seconds again.

    For timing counting you can use timer at host side.

    And it is very easy to get time for showing it going down

    Like

    If you added timer behaviour in Timer (text object) then.

    30 - timer.currenttime("turntimer")

    ( I'm still forgetting something at the end maybe but it's pretty much it. And you'll be having countdown)

    And I have to download discord and then only I can add.

    I'll add you later on. Right now, just wanna get some sleep😬 I had rough day with using photon in construct 2.

    (try above logic and always check if things are going well or not using debugger instead of just assuming)

  • Do i need to spawn the chess grid thru the host?

  • Or can i use on start of layout

  • Hello there! Hope you are progressing with your game.

    -> chess grid

    You don't need to spawn it.

    Cause it will be same on both sides.

    Now, you can just put it in background or after background.

  • Can you sync global variables because i had my timer and turn to globals do i have to put them in an object to sync multiplayer

  • You have to put it in the object.

    Instead of making new object for it, you can just add variable in timertext object which you are using for showing time.

    Then just sync instance variable after adding syncing line for timer object.

    Then you just have to sex timer object to every tick and set text to that instance variable

    Suppose, TimerText (your object), TimerText.timeshow (instance variable)

    Then, sync them before connecting to server then

    Use

    Every tick for both players in which host will contain code for subtracting the values.

    Think of host as server and peer is just receiver.

    So peer just send data when he do some input like moving chess object.

  • For some reason an object that is sync position is showing different postions for host and peer? How is that possible

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You probably making any mistake. Check it properly.

    One ore thing you can do is sending message from host to peer per second.

    That message will be fetch by peer and peer will sex that value to timer text.

    Simple.

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