Online Multiplayer Development

Feel like posting Off Topic? Do it here.

Moderator: MaxCoderz Staff

User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

Cool. apache.org gives me a blank window (prolly our stupid filter at work) but I am able to see the text game, which is cool.

I looked at the socket examples, and they look like exactly the examples I needed. I'm sorry for ever mistrusting you ben. :oops:

Anywho, I don't have access to the server I'm currently on, which is on our network. Could I manually specify the IP address in the code (rather than using a function to find it) to put the server on virtually any machine, and not necessarily an actual server? Seems like it would work well enough. On that note, what does the IP look like in Visual Basic? (Like, it it formatted "127.0.0.1" like a string, or is is a long number?)

Also, How would I compile said .NET program so that it could run under linux? I have Microsoft Visual Studio and support for Visual Basic and C++ as languages. (don't have access to C#, unfortunately) I am aware that linux tends to not like to run .exe files, so I assume you have to compile for linux, yes? How do you do this?

-gamefreak

PS: I will test out and play with the example code later, my compiler isnt here. I'm sure I'll have all sorts of questions about it. Also, you would use synchronous for something like a FPS game, and asynchronous for something like an IM or RPG game, yes? (so you could still interface with he user and animate stuff if the server was lagging)
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

thegamefreak0134 wrote:Cool. apache.org gives me a blank window (prolly our stupid filter at work) but I am able to see the text game, which is cool.
It won't echo what you type back to you, so you won't see anything until you press return.
I looked at the socket examples, and they look like exactly the examples I needed. I'm sorry for ever mistrusting you ben. :oops:
Well, apart from being .NET-specific...
Anywho, I don't have access to the server I'm currently on, which is on our network. Could I manually specify the IP address in the code (rather than using a function to find it) to put the server on virtually any machine, and not necessarily an actual server?
A server is just a normal machine. Nothing magic about them.

Click Start->Run and enter:

Code: Select all

notepad %systemroot%\system32\drivers\etc\hosts
This will open your hosts file, which maps domain names to IP addresses. If you put an entry here, it will override the DNS server lookup which turns a name into an IP address. For example, if you intend on hosting your app on some.funky.site.com, you could add some.funky.site.com to your hosts file (copy the example for localhost) and map it to your own IP address (or 127.0.0.1 to automatically point to your own machine).
Also, How would I compile said .NET program so that it could run under linux? I have Microsoft Visual Studio and support for Visual Basic and C++ as languages. (don't have access to C#, unfortunately) I am aware that linux tends to not like to run .exe files, so I assume you have to compile for linux, yes? How do you do this?
Nothing. :) .NET binaries are not native code, just bytecode compiled from MSIL. The Mono project provides the Linux equivalent of the .NET framework; once installed you can just run the .NET binaries (yes, even with the .EXE extension) under Mono.

Note that not all of the .NET class libraries (such as System.Windows.Forms) are fully implemented under Mono, but there are cross-platform alternatives (such as GTK#).

If you intend on running your app under Linux, it might be advisable to frequently test by recompiling it under Mono to make sure you don't use a feature that isn't supported. Most common features are implemented, though.
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

benryves wrote:

A server is just a normal machine. Nothing magic about them.

Click Start->Run and enter:

Code: Select all

notepad %systemroot%\system32\drivers\etc\hosts
This will open your hosts file, which maps domain names to IP addresses. If you put an entry here, it will override the DNS server lookup which turns a name into an IP address. For example, if you intend on hosting your app on some.funky.site.com, you could add some.funky.site.com to your hosts file (copy the example for localhost) and map it to your own IP address (or 127.0.0.1 to automatically point to your own machine).
(writes this all down for later reference) - I never knew you could do that. I just assumed that you needed to be running server software or something like that. So stuff like Windows Server 2003 just basically comes with a list of tools for you to use? Not that I would ever use windows as a server anyway, you can do a lot more with linux... This will definately help out a lot with testing. (I just have to remember to un-set it to go live with the real server.)
benryves wrote:
Also, How would I compile said .NET program so that it could run under linux? I have Microsoft Visual Studio and support for Visual Basic and C++ as languages. (don't have access to C#, unfortunately) I am aware that linux tends to not like to run .exe files, so I assume you have to compile for linux, yes? How do you do this?
Nothing. :) .NET binaries are not native code, just bytecode compiled from MSIL. The Mono project provides the Linux equivalent of the .NET framework; once installed you can just run the .NET binaries (yes, even with the .EXE extension) under Mono.

Note that not all of the .NET class libraries (such as System.Windows.Forms) are fully implemented under Mono, but there are cross-platform alternatives (such as GTK#).

If you intend on running your app under Linux, it might be advisable to frequently test by recompiling it under Mono to make sure you don't use a feature that isn't supported. Most common features are implemented, though.
So I basically just run the .exe in linux and if it has this installed then I'm set and it will run? Cool. I dont think my server side software will need any more than a command line, so that shouldn't be a problem.

Um... I had something else to ask, really I did...

Thinks...

Oh Yeah! Um... Not that this is important at all, but when you type in a web address (say google.com) how does that name become an IP address to communicate to? Is there a server somewhere with a list of all the registered domains?

-thegamefreak
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
User avatar
hop
Extreme Poster
Posts: 378
Joined: Sat 09 Dec, 2006 3:42 pm

Post by hop »

benryves wrote:and would have nothing to do with Apache.
Unless the game is, of course, web based.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

thegamefreak0134 wrote:So stuff like Windows Server 2003 just basically comes with a list of tools for you to use? Not that I would ever use windows as a server anyway, you can do a lot more with linux...
Not really. Windows (now) is a perfectly capable server OS. In the days of olde it wasn't exactly a stable OS, and server downtime is bad. ;)

Server versions of Windows will come with all the stuff required for running a Windows domain server - much in the same way that versions differ with otehr versions of Windows (eg Windows Home will not come with a web server or mail server, and won't let you join a domain without mucking around a bit, but Windows Pro will come with those useful extras).
Oh Yeah! Um... Not that this is important at all, but when you type in a web address (say google.com) how does that name become an IP address to communicate to? Is there a server somewhere with a list of all the registered domains?
Yes, and usually ISP-specific. It's called a DNS (Domain Name Server), and to get it to it you need to have an IP address (if you look in your TCP/IP settings, you'll see two boxes for two available DNS IPs). When you request a website via a domain name, it's sent to the DNS, which returns the IP address.

This is the reason you have domain name registrars, who get your requested domain name/IP pairing listed for you. :)
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

I see. This is all very new to me, and very useful too.

I managed to get the server and client example software up and running, and I got some simple stuff going between the two on one computer. I haven't tried with two computers yet, mainly because my laptop was being stupid with its poor network card and I didn't feel like messing with it. I assume of course that it will work with a bit of IP address tweaking in the setup of the network stuff.

I am playing mainly with the synchronous examples. However, I notice a few things. First of all, if a send fails, the program crashes. (The server sits happily forever, like it should, so I don't have any problems with it being synchronous.) Second of all, when I try to swamp the network with traffic using a while loop to test the speed, it has random crashes.

I assume of course that this can all be fixed with some try and catch statements. However, is there a black art to making it all go smoothly, or do I need to hand tailor the error catching to my software?

I was thinking of generating a simple timeout script, which after a certain number of failed sends, shuts down all connection attempts and alerts the user that the connection is not working. This will fix it for now, but I have a few questions.

Will VB.NET basically handle all of my server communication for me? As in, if a send fails on the client side, is it safe to assume that the information never reached the server side at all? Or do I have to account for the fact that perhaps the server recieved and processed the data, but failed to send back confirmation? (It seems like this should be the case, but I haven't tried on our school network quite yet. Trust me, if it works there, it will work anywhere else in the world.)

Also, for the IP address bit, can I safely just provide the IP for the client as a string "http://www.example.com" and not do all the DNS stuff to find the host? (This seems most logical to me, Im just confirming it.)

Oh yeah! I need a way to access a MYSQL database in VB.NET, so I can actually manipulate the data on the server side. (I've opted to use it since it should be easier to work with.) Can someone provide relavent information on doing so? Thanks!

-thegamefreak

PS: This is striking up that familiar flame again. This seems so possible! Yay!
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

With network communications, always fear the worst. Assume the lowest speeds and a large margin for errors - the data coming in or out has to go a long way, after all!

Also, for the IP address bit, can I safely just provide the IP for the client as a string "http://www.example.com" and not do all the DNS stuff to find the host? (This seems most logical to me, Im just confirming it.)
http://www.example.com/ is a domain name (www.example.com) and a protocol specifier (http://), not an IP address. I'm not sure what you're getting at here.
Oh yeah! I need a way to access a MYSQL database in VB.NET, so I can actually manipulate the data on the server side. (I've opted to use it since it should be easier to work with.) Can someone provide relavent information on doing so? Thanks!
Straight from the horse's mouth.
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

He probably wonders if he needs to query the DNS server himself to get the IP address for a hostname, or if this will work automatically. Gamefreak: the latter is the case, since the DNS translation is handled by the underlying networking layer, not the application that uses it.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
User avatar
thegamefreak0134
Extreme Poster
Posts: 455
Joined: Mon 23 Jan, 2006 10:09 pm
Location: In front of a Computer, coding
Contact:

Post by thegamefreak0134 »

Thank you timendus, thats exactly what I needed to know.

The MYSQL stuff looks quite scary. However, I'm sure I can manage. Thanks again! I'll post here when (notice when, not if) I have more errors.

^_^

-thegamefreak
I'm not mad, just a little crazy.

DarkNova - a little side project I run.
Post Reply