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.

Dark GDK / UDP Multiplayer Plugin

Author
Message
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 27th Feb 2008 17:00 Edited at: 27th Feb 2008 17:18
I'm looking for a plugin, or a method of using UDP protocol to transfer data in a server/client scenario.

I've been using multisync for a while, and am struggling to minimize lag. At best pings are around 70 (connecting with someone a few miles away) and when updating positions more than once every half a second there is a big choke up and pings shoot up to about 250. I'm fairly sure that the high pings are because multisync uses TCP which is not so good for fast paced games. It could be my coding but I have looked over to check if I'm doing anything wrong a few times.

The obvious solution is to use DB multiplayer commands since they use UDP. However, I've found it irritating and limitating that data can't be combined into one packet (by that I mean, I have to send each individual float by itself in an individual packet; there is no scope for combination like NetPut has in multisync).
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 27th Feb 2008 17:24
Quote: "At best pings are around 70 (connecting with someone a few miles away) and when updating positions more than once every half a second there is a big choke up and pings shoot up to about 250"

I think I may know why this is. Try the attached DLL.

Attachments

Login to view attachments
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 27th Feb 2008 18:48 Edited at: 27th Feb 2008 18:59
Huzzah, the problem is solved . Thanks, your plugin is great . Pings are now steady at around 70 for connecting player who lives a few miles away from me.

[edit] This is while sending data every 100ms (both the server/client send at this rate).

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Feb 2008 20:21
Michael, that looks cool so far MAN! Networking is UP! Gfx on Screen! MORE MORE MORE!!!

Good Job Benjamin....MultiSync MIGHT be what I end up using in Iron Infantry... You adding UDP support by chance ... maybe like the equiv of MEMBLOCK UDP?

KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 27th Feb 2008 22:30
Benjamin,

What's new or different in this DLL? Should I use it as well before I run my test apps?


Don't think, just code.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Feb 2008 13:47
Quote: "You adding UDP support by chance ..."

It was the original plan to, but I've put my plans for enhancements on the back burner for now. Especially since there are perfectly usable alternatives (although I'm not sure just how simple to use these others are).

Quote: "What's new or different in this DLL?"

There are two mechanisms in TCP that conflict with each other when you are doing rapid sending/receiving, resulting in a delay between transfers. I disabled one of them as it's not necessary.

Quote: "Should I use it as well before I run my test apps?"

Yes, probably.

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 25th Mar 2008 20:34
I'm still thinking of converting to UDP, because it is better for real time games.

Questions:
What UDP plugins have you used that were good and easy to use?
Does anyone know of a UDP plugin that works in a similar way to multisync for easy conversion?
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Mar 2008 20:49
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 25th Mar 2008 21:08
http://forum.thegamecreators.com/?m=forum_view&t=73342&b=5

Is that what you mean? I'll try it tomorrow, sure does look good
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Mar 2008 21:29
Quote: "Is that what you mean? I'll try it tomorrow, sure does look good "
No... but IT DOES look good.

I know writing sockets can be a pain - but Winsock is the Heart... on windows at least - everything else is a wrapper...

I mean taking a stab at actually writing to Winsock itself. This is what I think I'm going to do when I get that far- you're way ahead of me in your game dev I think - I'm still in "Make Fancy Level Editor" mode .... more precisely "Make GUI" mode for editor and game.

In FreePascal they have a open source "sockets" "unit" that I like because its platform independant - (write once never touch it again) ... but then I switched to C++ for DarkGDK.. so.. I might need to write to WinSock.. Which I have done before directly in FreePascal as well.. so I'm sure I could do it in C++...

It was hard... but it was only like 4 routines that were kinda hard... I made them easy to call like the plugins usually do... and after that is was smooth sailing.

Just the nitty gritty of making a port listen, grabbing a packet that arrives, seeing if its POSSIBLY one you care about (check a header for some code you place in your packets to self ID them) then you pass the data back to your app... The reason you have to do a couple "filtering" steps with UDP is because once you turn it on - you may recieve tons of packets that aren't yours... depending on the port you use. Then... you can't 100% trust the HEADER scan thingy - because you might occasionally get a packet that LOOKS like one of yours... then you start to do what you do - and CRASH because ... well.. it didn't have data you expected here or there because it was a fluke it got past your filter... so you need to code some safety into your routine that actually plays with the data you got in a packet so your program doesn't randomly crash.

I REALLY think you ought bite the bullet and hunker down and try to get this working directly with WinSock - the speed can't be topped - and once you "Git-R-Dun" you won't likely use a plug in for this (in C++ anyways) EVER again.

It wasn't that hard... it was but not like miles of code - just CAREFUL code... like maybe 300 lines and you will have a SOLID network interface... like those plugins.

One reason to do it yourself - I'm sure you know - is the benefits that come from knowing the insides and outs of the code and being able to look under the hood when ever you want. Usually helps track down bugs...for me anyways... when I hand something to a "Black Box" and it doesn't work how I thought it should... it takes a lot of testing before I can rule out my own issues and its a bug in the "Black Box" PLUS... in those situations... you can't do anything about it.

From our other conversations I KNOW your program's multi-play is going to be top notch and ready reasonably fast... I think you'd be one of the people who would be glad they just hunkered down and figured it out.

TheeLord
16
Years of Service
User Offline
Joined: 23rd Jan 2008
Location: Chicago
Posted: 26th Mar 2008 17:25
I am using RakNet, it is an awesome and very very powerful UDP library. Check it out, it has a learning curve but like any great tool is powerful enough to justify the learning curve.

www.jenkinssoftware.com

Login to post a reply

Server time is: 2024-09-29 15:17:39
Your offset time is: 2024-09-29 15:17:39