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 / Using the Multiplayer Commands.

Author
Message
Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 29th Mar 2008 06:14
Greetings! Now that I can write messages in my game, I'd like to test out the Multiplayer commands. The setup I would like for my game is this: The host checks for collisions and informs the individual players of scores, hits, etc. The clients would just display the information as it's given to them by the host and send the host data about the player's actions. So I started writing the host program for a TCP/IP connection and ran into a problem: when I specify the net connect as TCP/IP, it requests an IP/URL to connect to. But I just want my server to listen and accept incoming service requests from the clients. We've been going over TCP/IP connection at my University, but that's on Linux and I don't really know enough Winsock(yet) to do this myself, so I'd like to use the Dark GDK's commands, but can they do what I'm looking for? Thanks for the assistance!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 31st Mar 2008 19:27
The DarkGDK multiplayer commands use direct play which is a component of direct x. This uses reliable UDP, which is 'basically' TCP but faster. The commands are problematic however:
-They are a bit fiddly to use
-They take a long time to connect
-They are a bit slow in general

You could use a TCP plugin: http://forum.thegamecreators.com/?m=forum_view&t=120129&b=22

This is very easy to use but as it is pure TCP it is possibly too slow for your needs.

To answer your question:
In my opinion, you can do what you want with DarkGDK or multisync but it will be severely limited by the speed of these two. What you really want is UDP for quickly sending/receiving lots of client positions/actions etc. There are plugins which you can find by searching on google that will make programming with UDP easier, but I suggest learning winsock (as frustrating as that may be). Here are some links that will help you get started should you decide to:

MSDN Tutorial:
http://msdn2.microsoft.com/en-us/library/ms738545(VS.85).aspx

UDP Question/Answer:
http://forum.thegamecreators.com/?m=forum_view&t=126746&b=22
Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 31st Mar 2008 21:49
Thanks a ton, Michael. I'm actually new to internet connections, having just written my first multithreaded TCP server on Linux for my Operating Systems class. I'll start learning winsock tonight when my classes are out. I kinda wanted to all along, since I like knowing exactly what the code I'm using does, but at the same time I'm quickly finding out that it's impossible to write anything without using a library made by someone else, so I guess I'll just have to find a happy medium, haha!

Also: is UDP really that much faster than TCP? Is this because of the network handshakes and stuff requiring it to send several packets instead of just one in order to ensure the packets arrive? I was actually planning to have some packet redundancy anyways just to mitigate the effects of lag, so for example before telling the client that the player has a new destination, I'd also send the player's current location, so that at the moment that packet arrives, the player's location and destination will both be current.
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 31st Mar 2008 23:02 Edited at: 1st Apr 2008 01:08
I wrote a pretty functional server/client program where you can move around using multisync (TCP) for networking. Latencies were 'ok' at around 90ms for a person connected living near me. The real problem is that when I try to send packets faster than about every 100ms things clog up. I don't know exactly why that is, Benjamin (forum's winsock guru) probably does. That speed is however fine for a relatively high speed game. The problem is that accuracy will be limited. What I mean is that real pings are at around 190ms in the scenario mentioned earlier.

I'm currently trying to write a UDP server/client using winsock and I think that this clogging problem with TCP should be avoided because as you mentioned TCP has a lot of extra things put in that have their uses, but slow things down. I also expect pings to be a little lower at around 25 in the same scenario mentioned earlier.

With TCP, every packet is more or less guaranteed to arrive whilst UDP not all packets sent will arrive, and sometimes they will arrive in the wrong order. This is why, most games use a combination of either:
UDP & Reliable UDP
UDP & TCP

As far as fast paced games are concerned: generally, unreliable UDP is used for things like positions and rotations where we don't care if a few positions/rotations don't arrive, because right after another one will arrive. Reliable UDP and TCP are used for things where they must arrive e.g. chat messages; if unreliable UDP were used then some chat messages would not be received.
Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 1st Apr 2008 12:16
Ack! I spent all night poring over the winsock manuals and am totally nonplussed. I wrote a server/client pair that acts as a one-way chat program that sends strings as TCP packets and displays them on the client, but it only works with two IPs: 127.0.0.01, and when I changed it to the one in my Wireless Network Settings panel, which I assume is my network IP. But when I tried using the ones Google's "Your IP is:" pages spit back at me (my real one, as far as the internet is concerned) I couldn't even establish a connection.
I imagine that the IP Google is looking at will only get packets to my router, and something more is needed to get them from there to my computer, but the winsock manual doesn't want me to figure it out! I've tried all sorts of formats for IP addresses and hostnames to no avail. From using my local computer name, to using what I believe was an ANSI-fomatted IP that looked like: ip123-45-67-890.fl.cox.net. Does anyone know how someone on the other side of a DNS Server could access a server program running on my computer? I'm really out of ideas, it seemed like every time I found something different from the things in the winsock manual, it was from winsockv1.1 and thus I was "strongly urged" not to use it. Thanks a ton for your responses!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 1st Apr 2008 17:34 Edited at: 1st Apr 2008 17:43
I'm just guessing here but it could simply be something to do with your router.

If you want someone to connect to your computer, you need to use port forwarding otherwise everything will be blocked because your router won't know where to send incoming data.

Firstly you need to know your local IP address. There are better ways to find it, but I simply click on the little flashing computer at the bottom right of my screen . Then, I click on the settings tab and there it is (circled in red):


Now that you know your local IP you can forward incoming data to that IP in your router configuration section. When I'm testing things I like to use a feature on my router thats called 'virtual server'. Basically this forwards all incoming data to your computer (don't leave this on because hackers love this):


Or, you can use port forwarding and here you just forward the ports that your application uses:


When configuring a client to be used by someone not connected to your router, the IP you should use is your remote IP which can be found at http://www.whatismyip.com.
When configuring a client to be used by someone connected to your router (this includes a client that you want to use on the same computer as your server) the IP you should use is your local IP.
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 1st Apr 2008 17:47
Quote: "But when I tried using the ones Google's "Your IP is:" pages spit back at me (my real one, as far as the internet is concerned) I couldn't even establish a connection."

You can't connect to yourself on the same LAN using your internet IP, as the router is the only device that knows what your internet IP actually means, and most do not forward this kind of traffic.

As Michael P suggested, you listen on your PC's LAN IP, and then other machines on the same LAN connect to this IP, while machines on the internet use your internet IP (which is your router's IP).

Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 2nd Apr 2008 00:56
Michael's suggestion worked perfectly, I can now get the client to connect to my server using my internet IP (huzzah!) But now I've run into a new problem. My next step was to get my friend to run the client on his computer and see if it would actually connect over the internet or if it was a case of my router being smart enough to figure out what I wanted it to do. But when my friend ran my program it gave the error message: "application configuration is not correct" "reinstalling might help" according to my friend. I assume this is because the .dll(s) it uses try to link other .dlls which he doesn't have on his computer. So the question is: how do I overcome this problem? Thanks again for your responses!
Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 2nd Apr 2008 01:30 Edited at: 2nd Apr 2008 01:31
Whenever you want an application to run on someone's computer you need to make sure they have the following installed:

The latest version of direct X is required if you use any DarkGDK commands (anything with db infront of it). Note that there are several versions of DX9.0c so if he says he has 9.0c, it probably isn't the latest version. The latest is currently March 08. You can download the latest version here:
http://www.microsoft.com/downloads/details.aspx?familyid=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displaylang=en

A version of .net framework is required to do most things with C++. The latest is v3.5 which can be downloaded at this link:
http://www.microsoft.com/downloads/details.aspx?familyid=2da43d38-db71-4c1b-bc6a-9b6652cd92a3&displaylang=en

The problem you are talking about is caused by not having the correct version of direct x (if I remember correctly).
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 2nd Apr 2008 01:37
Quote: "A version of .net framework is required to do most things with C++."

Only if compiled using CLR, otherwise it's not necessary.

Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 2nd Apr 2008 04:13
The problem isn't DirectX because my friend (as well as another who I had test it a moment ago) had no problems running my game, which has plenty of DarkGDK graphics commands in it. Also, my client doesn't use any dbCommands or DirectX commands, so DirectX shouldn't be the problem. Also, I'm not using any .net anything and my compiler is set to "no CLR support" so that shouldn't be the problem. Is it possible to statically compile my program so that all the .dll commands it uses are included in the .exe? I've walked through steps to do this before for a different library on a different compiler and it made my program infinitely more portable, and since file size isn't an issue here, I wouldn't mind doing it again. How would I do that in MSVC++? And would it solve my problem? Thanks again, you guys have beeen tremendously helpful =D
Fasine
16
Years of Service
User Offline
Joined: 28th Mar 2008
Location:
Posted: 2nd Apr 2008 07:37
Aha! I got it by messing with the compiler. I went to Project > Properties > C/C++ > Code Generation > Runtime Library and changed it from Multithreaded DLL to just Multithreaded. Size of the .exe jumped by about 190k, but I'm not really worried about that since it works, and my friend was able to connect to my server from California, haha.

Login to post a reply

Server time is: 2024-09-29 17:30:58
Your offset time is: 2024-09-29 17:30:58