Game Development Community

Minimal networking example - Hello Network

by Tom Bentz · in Torque Game Builder · 12/06/2006 (9:56 pm) · 29 replies

After going through the TGB boot camp I came away with the basics of networking knowledge among other things. The checkers tutorial was over my head so I went about creating the most basic example you will find. A 'Hello Network' example. It is less than 50 lines of script (without comments). I am happy to be giving back to the community!

REQUIREMENTS!!!!!!
-To test this on only one computer you will need a debug version of TGB
-I had problems with my firewall so I needed to disable it. You might also.

How to use this example
Copy the hellonetwork folder to your TGB/games directory then follow the steps below.

1. Launch two versions of TGB (one must be a debug build if using one computer)
2. In the console on your server run 'startserver();'. You should see a connected message (the server computer connects as a client to itself).
3. In the console on your client run 'connect("SERVERIP");". Where SERVERIP is the ip address of the server. YOU NEED THE QUOTES AROUND THE IP ADDRESS. You should see a connected message.
4. In the console on the server run 'serversayhi("NAME")'. Where NAME is your name or whatever.
5. Check the console on the client and you should see "NAME (server) says hi!"
6. In the console on the client run 'clientsayhi("NAME")'. Where NAME is your name or whatever.
7. Check the console on the server and you should see "NAME (client) says hi!"

The simplechat.cs script file contains all the basic stuff that should get you going creating your server and client calls.

Download hellonetwork

Tom Bentz
digitalblur entertainment
whoosier daddy?
Page «Previous 1 2
#1
12/06/2006 (10:43 pm)
Wow thank you for that, it's so simple but it explains so much and is very easy to follow thanks for getting me in the right direction and showing it's so much easier then I thought
#2
12/06/2006 (10:48 pm)
Glad to help :)
#3
12/07/2006 (12:44 am)
I want to thank Tom for taking the time to write this up and share--not everyone has the opportunity to attend one of our Boot Camps, and I for one love to see what comes out of them back to the community!

It might make sense to go ahead and put this up as an article on TDN as well once it goes through a question/answer cycle or two!

Thanks again.
#4
12/07/2006 (12:51 am)
No prob Stephen! I couldnt have dont it without picking your brain in class. There's more stuff to come over time :D I'll add this to TDN once I see what a few people think of it.
#5
12/07/2006 (3:55 pm)
Very cool, been wanting to make some basic networking tutorials for a while thoughjust haven't had the tame... Huge thanks Tom.
#6
12/07/2006 (5:02 pm)
Matt - My pleasure!
#7
12/08/2006 (11:25 pm)
THANK YOU!!! This is wonderful :)
#8
12/09/2006 (5:59 pm)
The link isnt working :(
#9
12/09/2006 (6:01 pm)
Hmm... weird I just checked it... and it works for me?? try it again. If not I can email it to you.
#10
12/09/2006 (6:15 pm)
Weird, I cant connect to the digitalblur site at all, an email would be apreciated :)
Thanks in advance
#11
12/09/2006 (6:19 pm)
Link works for me also.
Thanks for the source, BTW. Much appreciated!

Here's a mirror link for you to try Ben.
(link removed =o)
#12
12/09/2006 (6:22 pm)
Thanks a ton Phillip :)
#13
12/09/2006 (6:26 pm)
Cool :)
#14
12/09/2006 (7:57 pm)
Seems like people get it so its now posted on TDN - link here linked from the Specific Function Tutorials
#15
01/12/2007 (12:03 am)
Tight. :)
#16
04/24/2008 (6:27 am)
This is not working for me.

Your file doesn't include an executable, so I copied all the files to the "Tutorial Base" folder. I try to run the .exe and nothing happens. I can see in my Task Manager that TGBGame.exe is running and using 99% of my CPU, but nothing at all happens.

I picked apart your 'simplechat.cs' file and found 'createServer(true)'. When I try to run that command manually in any of my projects, it says "Command not found".

I have TGB 1.7.2
#17
04/24/2008 (6:41 am)
I had to start out with:

initBaseServer();

I had to do that before I could create a server...
#18
04/24/2008 (7:15 am)
Quote:1. Launch two versions of TGB (one must be a debug build if using one computer)

I do not have a "source code" version of TGB. How would I get a debug build?
#19
04/24/2008 (8:17 am)
Nicolai, that's outdated advice (but wasn't when it was posted), you can now run multiple copies on one system.
#20
07/02/2008 (11:05 pm)
Gratz, thanks for the resource champ!
-nic
Page «Previous 1 2