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 / Multiplayer Issues

Author
Message
Grayvyn
16
Years of Service
User Offline
Joined: 30th Oct 2008
Location: Southern California
Posted: 3rd Jul 2013 23:54
Hello everyone!

My WIP is an online RPG with a client/server model.
- Client uses AppGameKit, Tier 1
- Server uses C#

I was able to hack the AppGameKit network protocol with the help of some posts and a packet sniffer. All was working well on my PC and Nexus 10 tablet while on my local network. As soon as I put the server on an external machine, accessed via internet (with real lag), all sorts of packet and data loos problems showed up.

It happens most times when the server sends a large amount of data, about 8k, in a short time, about 1 second. Running the client on a PC would crash about 10% of the time. Running the AppGameKit Player on my tablet, would crash about 90% of the time.

I tried a million different things and got mixed results. I finally tried to slow down the data sending from the server for that initial 8k transfer and that seems to have fixed the problem. I am thinking that the AppGameKit recv buffer might be too small or getting overwritten some how. This would make sense since the PC is faster and tends to not crash as much thus probably keeps up with incoming data better?

Yeah, it could be my C# code but I have tried a lot of different things and the server code works fine with small data sending. I would rather not slow down the server.

Any ideas or suggestions?

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 4th Jul 2013 00:02
I did a small multiplayer game a few weeks back and noticed the same thing. I was running the client and server with uncapped FPS and sent one message each frame. It was crashing constantly until I caped the FPS at 60 which reduced the crash rate (but not completley). The theory about the small network buffer sounds perfectly valid to me.

I ran the app on a local network between my PC and Galaxy note
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 4th Jul 2013 00:10
It looks like the AppGameKit network stuff was designed with quite small packets, which would be inside the single packet size (which is OS etc dependant).

You should flag is up as an issue, with some supporting example.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 4th Jul 2013 03:30 Edited at: 4th Jul 2013 03:32
Try to use the SetNetworkLatency on the client side. A value of 2 or 3 times your ping between your client and your server should works without any drop or crash.

Actually, with my Linux dedicated server with my AppGameKit Server (a PHP Daemon), if the ping is 25-30ms (it's actually the case) i can set 60ms with the SetNetworkLatency command and i haven't any disconnection at all.

However, your app shouldn't crash. It should only disconnect ... Are you sure about your reverse engineering ?

Over internet, i just tried to set the latency to 15ms with an auto-reconnect function and it works (not really reliable in a real game but it should do the trick lol....).

I will try to see if there is a workaround on the client side to prevent disconnections (but i think it must be fixed in the AppGameKit network protocol itself dropping packets instead of disconnection).
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 4th Jul 2013 06:17
Quote: "I did a small multiplayer game a few weeks back and noticed the same thing. I was running the client and server with uncapped FPS and sent one message each frame. It was crashing constantly until I caped the FPS at 60 which reduced the crash rate (but not completley). The theory about the small network buffer sounds perfectly valid to me. "

I've had such problems that overloaded my clients (causing them to crash). My solution was to cap, not the FPS, but only the rate at which the host sent information. (does the client really need 1000+ copies of nearly identical data ) I just used a timer so information could only be sent at ~130 FPS. The time at which the code hit this loop wouldn't always match up to keep a minimum of 60 per second otherwise

swis
Joined: Tue Dec 16th 2008
Interstellar
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Jul 2013 02:46
If you are sending message ID 5 with some data then the data is limited to 1400 bytes so it fits in a single packet. There should be no limit to the number of messages you can send a second (as far as AppGameKit is concerned), and the messages will arrive in the order they were sent.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 5th Jul 2013 04:10 Edited at: 5th Jul 2013 04:12
Quote: "There should be no limit to the number of messages you can send a second (as far as AppGameKit is concerned)"


And we must not be disconnected if we are sending messages too fast over the internet ?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Jul 2013 17:03
There is nothing in AppGameKit that will disconnect you, it creates a linked list of messages so there is no cap, and it's a standard TCP stream so that shouldn't disconnect, just throttle.
swissolo
14
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 5th Jul 2013 19:44
Quote: "There should be no limit to the number of messages you can send a second (as far as AppGameKit is concerned), and the messages will arrive in the order they were sent. "

My problem was reading in these messages. My clients couldn't keep up and became stuck in the pickup loop.

swis
Joined: Tue Dec 16th 2008
Interstellar

Login to post a reply

Server time is: 2024-11-24 15:26:47
Your offset time is: 2024-11-24 15:26:47