Multiplayer: local string variables don't sync

Discussion and feedback on Construct 2

Post » Fri Mar 21, 2014 11:22 am

Hello fellas,

@Ashley
Don't know if it's bug or feature or I'm doing something wrong, but local string variables do not get synced.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Fri Mar 21, 2014 12:04 pm

Currently only number variables are coded to be synced. I'm not sure it's worth syncing text variables, since they can be variable length, don't conveniently fit in to the binary updates, and could easily waste loads of bandwidth. Could you compensate with sending messages?
Scirra Founder
B
399
S
236
G
89
Posts: 24,525
Reputation: 195,382

Post » Fri Mar 21, 2014 12:16 pm

Sure I can easily work around that, just noticed it.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Fri Mar 21, 2014 12:41 pm

Ashley wrote:Currently only number variables are coded to be synced. I'm not sure it's worth syncing text variables, since they can be variable length, don't conveniently fit in to the binary updates, and could easily waste loads of bandwidth. Could you compensate with sending messages?

And I do not work message. When the client is connected and connected server room and login and I send a message to the host but the host can not receive the message.
B
21
S
4
G
2
Posts: 66
Reputation: 2,741

Post » Sat Mar 22, 2014 2:35 pm

There is a problem with On Peer Connect> Send Message, as it doesn't process the information until after the objects are synced.

If you look at the multiplayer demo, as a peer joining a host everything is destroyed and then respawned. if you put a message event in the On Peer Connect, the peer's events won't see it. If you put a wait 0.001seconds before the message, it does.
It's probably the same problem that the peer is having on-connect, where when it sends the message is too early

Since I do not like relying on a 0.001 wait just in case there is an issue and it doesn't execute, I've made a SERVER object that only the server keeps. Then for the Peer event group, have a On created: SERVER> Send message requesting a response

This way the host receives the request, then sends the sync afterward.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Sat Mar 22, 2014 2:53 pm

@Thndr little misunderstood but the source can show an example
B
21
S
4
G
2
Posts: 66
Reputation: 2,741


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests