Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / SendNetworkMessage does not work properly for client (bug?)

Author
Message
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 27th Feb 2015 22:17
Hello everybody.
I was making some multiplayer code, when I notice that
SendNetworkMessage( iNetID, toClient, iMsgID ) does not send message to all clients when used by a client, even if toClient was set as 0.

The command only send messages to all client when it is called by the host.
If called by a client, it only send messages to the host. I had to relay that message from a client to the host, then make the host resend the message to all client to circumvent this issue.
Tested on multiple devices (PC, Android phones) with at least 1 host and 2 client, with different devices being host, but the issue still persists.

Is this intentional, or is it a bug?
I am using AppGameKit 2.0.11.

This is the code:
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Feb 2015 15:49
It should be intentional. The host should always be in control of how the clients respond to one another. Think of it as a bicycle wheel, with the host as the spindle. Everything has to travel down the spokes, through the spindle and out to the relevant clients.

Even if you could send to all clients, I wouldn't recommend it, you lose too much control.

Quidquid latine dictum sit, altum sonatur
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 7th Mar 2015 14:28
I see, good thing I had extra phones around.
Would be great if it is stated explicitly in the help files.
Is this the case with DBPro too? I've never got to try it on DBPRo due to only having 2 PC.
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 8th Mar 2015 03:02
Quote: "
//Make player objects
FOR t = 1 to 10
"

What is the limit on the number of players in an AppGameKit multiplayer game?


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 8th Mar 2015 13:23
I think its about 150 or something, can't remember where I got that.
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 8th Mar 2015 15:58
Quote: "I think its about 150 or something"

Wow!
I was hoping for 32 or 64, but 128 Gladiators battling it out in 1 arena would just be crazy.

Quote: "can't remember where I got that"

I couldn't find the number when looking in the documents, but I may have overlooked it.

Thanks


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Mar 2015 19:05
A message to client 0 should go to all clients, even if sent from another client. I had a look at your example but without the media it was difficult to see what was going on, and I couldn't replicate the bug. I had a look in the networking code and couldn't see any problems with the forwarding of messages to ID 0.

Although if you are just wanting to send the value of certain variables to other clients then the SetNetworkLocalFloat and GetNetworkClientFloat commands might be an easier way to do it.
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 12th Mar 2015 18:14 Edited at: 12th Mar 2015 18:20
These are the medias.

These are the better snippet. Click the left sprite to host, or right sprite to be a client.
Control with virtual joystick.
To keep the code simple, it's LAN only.
Please try it with 1 host and 2 or more client (beside the host).

Note that if this part below is deleted, the host would not sent the player position datas to all client, so each client can only see himself and the host moving, and not able to see other players moving.






Full code:

Attachments

Login to view attachments
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Mar 2015 22:31
Tested with a PC host and 2 Android devices as clients, all three can see the movements of everyone else. Then tested with an Android host with the PC and Android client, again no problems seeing all movements on all three screens.
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 13th Mar 2015 04:18 Edited at: 13th Mar 2015 04:23
Oh my, that's weird..
Have you tried deleting/excluding that part of the code? That replicates the problem for me




Here's the full code. It should replicate the problem.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Mar 2015 17:15
Removing that section of code did reproduce the bug, fixed for the next version.
JohnStabler
AGK Bronze Backer
10
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 16th Mar 2015 10:44
This sounds like the exact problem I'm having. All of a sudden my network code stopped working. Only the host was receiving messages sent to all clients. Must have spent hours looking through code, assuming it was something I'd changed.

This is a pretty serious issue as I'm now unable to progress through testing. Any estimate on the next release?
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 16th Mar 2015 15:05
Thanks for the swift action. I get the feeling the next version going to be great.

Login to post a reply

Server time is: 2024-04-26 11:04:58
Your offset time is: 2024-04-26 11:04:58