Problem with Multiplayer Send Message - nothing sent

Discussion and feedback on Construct 2

Post » Mon Jul 07, 2014 7:00 pm

Hi. I tried it for almost 2 hours now but it does not work and I hope someone can give me a hint how to fix this.
I joined a room and then I send a message to the host. First I tried it without groups but I added them to make it easier. When you are the Peer you should send 2 values to the host so he can determine which level should be loaded and to know what char the peer is playing. The Debug window shows the "Sending Data to Host" message but the Host does not seem to get any message because nothing shows up there.

I tried it with and without trigger once, with "on key press" and some other things but the message never appears on the host. But when I open the Chat example it works. But I cant find the difference and why it is not working for me. Can anyone see the error? :|

Image
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Fri Jul 11, 2014 10:32 am

Any ideas? I tried to convert the sent data to a string with str() because the manual says it must be a string and I tried to send numbers first. But that did not change anyhting.
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Fri Jul 11, 2014 12:08 pm

Hey brother - What I've had success with is "set client input state".

I had a quick shot at it (but I've got to leave for work and may not be entirely right)

If you look at the Pong or Real-Time multiplayer game tutorials, they'll have the right versions of this. (I've built a character selected lobby for multiplayer based on this method and it works)
You do not have the required permissions to view the files attached to this post.
B
20
S
5
G
3
Posts: 66
Reputation: 2,823

Post » Mon Jul 14, 2014 9:25 am

Thank you for your suggestion. I could already sync values with "Set Client Input State" and syncinc Instance Variables and it should work with CharID and LevelID since its only a number.
But shouldn't "Send Message" work as well? Does it have any prerequisites or can it only be used after specific triggers?
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Mon Jul 14, 2014 2:59 pm

I just tried it again and its working now! o.O
Maybe it was a bug in the last beta build, with the latest r175 I can receive the message (number variables need a str(VARNAME) to be a string). :D

But the second player (Peer) sometimes has to try to join the new room 2-3 times before he gets into it. I hope I can find the reason for this.
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Mon Jul 14, 2014 3:36 pm

I just removed the "On key pressed" and tried "Trigger Once" but now no data arrives at the host (the debug message is shown once). Is Send Message only working with single triggered events and not with "Trigger Once"?
Image

/Update:
It seems I found it! You need another pause (Wait) before sending the data as peer. If you do it immediately it seems to be "too fast" for the host to recognize the sent message. After adding a System.Wait(1.0sec) (adding 0.1 was not working/still too fast?) to the TriggerOnce actions the Host got the data. :D
After adding "Multiplayer is ready for Input" + Trigger Once it seems to work without the pause. :)
B
53
S
16
G
6
Posts: 718
Reputation: 9,150

Post » Mon Jul 14, 2014 4:22 pm

@Bl4ckSh33p - I had the same problem and after debugging the multiplayer plugin I found that once the peer connects to the room it still has to wait for the host to link to it. Its not part of the original process of joining the room. There is a peer condition called "Is Ready for Input" that you can work with to determine when its ok to start sending messages.

Edit: Apparently I missed your last line as you mentioned "Is ready for input" :)
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Mon Jul 14, 2014 4:49 pm

Thanks. It sometimes takes a while to get used how to use a new plugin like Multiplayer. :)
B
53
S
16
G
6
Posts: 718
Reputation: 9,150


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests