[Multiplayer] Update peer list

0 favourites
  • 6 posts
From the Asset Store
Fantasy Game includes more than 600 sound effects inspired by hit computer games like World of Warcraft and Diablo.
  • Hi all

    Working with the multiplayer functionality and have run into a problem, that someone have hopefully some idea how to fix.

    The setup

    My initial idea is to just have a host connected at all times. Which will handle the communication and solve the problem of not being able to select a new host when the current one leaves. Whether there is a work around I don't know, so this is what I aim for at the moment.

    On the front page I have an ordinary chat functionality with a chat window and a list of people that are connected. And they can chat with each other.

    The problem

    My problem occurs as a peer for instant click to show high score it goes to a new layout where the chat functionality is not available, when they then go back the peers doesn't show up In the list of connected peers. However testing it there is still connection between the host and the peer, and they can still chat.

    So what I would like is for the host to broadcast the peers when someone enters that layout again. And I can get it to work to some degree meaning that I can broadcast the peers, but it will only broadcast the last connected peer alias several times for each peer count.

    I have tried using a "for 0 to Multiplayer.peercount" and hoped that it would then be able to broadcast each peer alias. But can see any way of picking a peer so I can make sure that it broadcast the correct one.

    Have some alternative ideas of how to solve it, which I haven't tried yet, but I think will work. But have anyone tried anything similar and solved it some clever way?

  • If that's the case, why not either spawn the high score over top of the chat layout, or just kick the peer, and then have them relog in when they leave the high score layout ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Think it would be to messy spawning it on top of the chat window as there will be a high score for each map. Anyway after the bug and the r164.2 update the game have become so buggy to the point of where I have lost patience, and trust in C2 actually working correct in this project. To many things suddenly doesn't work for no apparent reason, things that worked fine yesterday, and even though I haven't changed any code and can see on the debug data that it is correct it still doesn't work. C2 crashed due to the most weird and simple things, and seems to happen only in this project from what I can tell. So I simply doesn't trust that other weird things are not going to happen if I continue working on it.

    So ill have to sack the project, but thanks for the reply anyway.

  • This isn't anything specific to multiplayer: changing layout just destroys the list object which shows all the peers, and then when you come back to the layout there's no way to get that information back.

    I'll add a 'Get peer at index' expression for the next build so you can re-fill the list when returning. Or just make the list global and hide it when changing layout.

  • No the problem is not connected to that, that merely my lack of knowledge of that new functionality.

    But it sounds like a really good update I think thumbs up for that.

  • That sounds like a pretty sweet new expression

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