[Multiplayer] Update peer list

Get help using Construct 2

Post » Thu Mar 20, 2014 1:17 pm

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?
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Fri Mar 21, 2014 5:09 am

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 ?
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701

Post » Fri Mar 21, 2014 1:06 pm

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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Fri Mar 21, 2014 2:52 pm

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.
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Fri Mar 21, 2014 3:21 pm

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.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Fri Mar 21, 2014 11:02 pm

That sounds like a pretty sweet new expression :D
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,701


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests