Game Development Community

Tutorial.base multiplayer

by Justin Woodman · in Torque Game Engine · 07/24/2005 (9:42 pm) · 15 replies

Ok, I have been trying to add a simple multiplayer to tutorial.base, and it is quite the headache.

heres my console.log:

//-------------------------- 7/25/2005 -- 00:30:55 -----
Processor Init:
   AMD Athlon, ~2.05 Ghz
     (timed at roughly 2.06 Ghz)
   FPU detected
   MMX detected
   3DNow detected
   SSE detected

Math Init:
   Installing Standard C extensions
   Installing Assembly extensions
   Installing FPU extensions
   Installing MMX extensions
   Installing 3DNow extensions
   Installing SSE extensions

Input Init:
   keyboard0 input device created.
   mouse0 input device created.
   DirectInput enabled.

--------- Loading MODS ---------
Loading compiled script tutorial.base/main.cs.
Loading compiled script common/main.cs.
Missing file: common/defaults.cs!
Loading compiled script tutorial.base/client/defaults.cs.
Loading compiled script tutorial.base/server/defaults.cs.
Compiling tutorial.base/prefs.cs...
Loading compiled script tutorial.base/prefs.cs.

--------- Parsing Arguments ---------

--------- Initializing MOD: Common ---------
Loading compiled script common/client/canvas.cs.
Loading compiled script common/client/audio.cs.

--------- Initializing TTB: Server ---------
Loading compiled script common/server/audio.cs.
Loading compiled script common/server/server.cs.
Loading compiled script common/server/message.cs.
Loading compiled script common/server/commands.cs.
Loading compiled script common/server/missionInfo.cs.
Loading compiled script common/server/missionLoad.cs.
Loading compiled script common/server/missionDownload.cs.
Loading compiled script common/server/clientConnection.cs.
Loading compiled script common/server/kickban.cs.
Loading compiled script common/server/game.cs.
Loading compiled script tutorial.base/server/game.cs.
Loading compiled script tutorial.base/server/centerPrint.cs.

--------- Initializing TTB: Client ---------
Loading compiled script common/client/message.cs.
Loading compiled script common/client/mission.cs.
Loading compiled script common/client/missionDownload.cs.
Loading compiled script common/client/actionMap.cs.
Loading compiled script common/editor/editor.cs.
Loading compiled script common/editor/particleEditor.cs.
Loading compiled script common/client/scriptDoc.cs.
Video Init:
   Accelerated OpenGL display device detected.
   Accelerated D3D device not detected.
   Voodoo 2 display device not detected.

Activating the OpenGL display device...
Activating the OpenGL display device...
Setting screen mode to 800x600x32 (w)...
Creating a new window...
Acquiring a new device context...
Pixel format set:
  32 color bits, 24 depth bits, 8 stencil bits
Creating a new rendering context...
Making the new rendering context current...
OpenGL driver information:
  Vendor: NVIDIA Corporation
  Renderer: GeForce 6800 GT/AGP/SSE/3DNOW!
  Version: 2.0.0
OpenGL Init: Enabled Extensions
  ARB_multitexture (Max Texture Units: 4)
  EXT_compiled_vertex_array
  NV_vertex_array_range
  EXT_texture_env_combine
  EXT_packed_pixels
  EXT_fog_coord
  ARB_texture_compression
  EXT_texture_compression_s3tc
  (ARB|EXT)_texture_env_add
  EXT_texture_filter_anisotropic (Max anisotropy: 16.000000)
  WGL_EXT_swap_control
OpenGL Init: Disabled Extensions
  EXT_paletted_texture
  3DFX_texture_compression_FXT1

#1
07/24/2005 (9:50 pm)
(console.log continued)
Loading compiled script common/ui/defaultProfiles.cs.
Loading compiled script common/ui/GuiEditorGui.gui.
Loading compiled script common/ui/ConsoleDlg.gui.
Loading compiled script common/ui/InspectDlg.gui.
Loading compiled script common/ui/InspectAddFieldDlg.gui.
Loading compiled script common/ui/LoadFileDlg.gui.
Loading compiled script common/ui/SaveFileDlg.gui.
Loading compiled script common/ui/MessageBoxOkDlg.gui.
Loading compiled script common/ui/MessageBoxYesNoDlg.gui.
Loading compiled script common/ui/MessageBoxOKCancelDlg.gui.
Loading compiled script common/ui/MessagePopupDlg.gui.
Loading compiled script common/ui/HelpDlg.gui.
Loading compiled script common/ui/RecordingsDlg.gui.
Loading compiled script common/ui/NetGraphGui.gui.
Loading compiled script common/client/metrics.cs.
Loading compiled script common/ui/FrameOverlayGui.gui.
Loading compiled script common/client/messageBox.cs.
Loading compiled script common/client/screenshot.cs.
Loading compiled script common/client/cursor.cs.
Loading compiled script common/client/help.cs.
Loading compiled script common/client/recordings.cs.

OpenAL Driver Init:
OpenAL
   Vendor: Creative Labs Inc.
   Version: OpenAL version 1.0
   Renderer: Sound Blaster Audigy 2
   Extensions: EAX
EAX1.0
EAX2.0
EAX3.0
EAX4.0
EAX-AC3

Loading compiled script tutorial.base/client/audioProfiles.cs.
Loading compiled script tutorial.base/client/ui/PlayGui.gui.
Loading compiled script tutorial.base/client/ui/mainMenuGui.gui.
Loading compiled script tutorial.base/client/ui/loadingGui.gui.
Loading compiled script tutorial.base/client/missionDownload.cs.
Loading compiled script tutorial.base/client/serverConnection.cs.
Loading compiled script tutorial.base/client/loadingGui.cs.
Loading compiled script tutorial.base/client/playGui.cs.
Loading compiled script tutorial.base/client/centerPrint.cs.
Loading compiled script tutorial.base/client/default.bind.cs.
Binding server port to default IP
UDP initialized on port 0
Engine initialized...
Exporting server prefs...
Starting multiplayer mode
Binding server port to default IP
UDP initialized on port 28000
Loading compiled script tutorial.base/server/audioProfiles.cs.
Loading compiled script tutorial.base/server/camera.cs.
Loading compiled script tutorial.base/server/editor.cs.
... Shape with old version.
Loading compiled script tutorial.base/server/player.cs.
Loading compiled script tutorial.base/data/shapes/player/player.cs.
Validation required for shape: tutorial.base/data/shapes/player/player.dts
*** LOADING MISSION: tutorial.base/data/missions/test1.mis
*** Stage 1 load
*** Stage 2 load
Executing tutorial.base/data/missions/test1.mis.
*** Mission loaded
Adding a pending connection
Sending Connect challenge Request
Sending heartbeat to master server [IP:216.116.32.49:28002]
Got Connect challenge Request from IP:192.168.1.102:28000
Got Connect challenge Response
Sending Connect Request
Got Connect Request
Connect request from: IP:192.168.1.102:28000
CADD: 1242 IP:192.168.1.102:28000
*** Sending mission load to client: tutorial.base/data/missions/test1.mis
Connection established 1241
Mapping string: ServerMessage to index: 0
Mapping string: MsgConnectionError to index: 1
Mapping string: MsgLoadInfo to index: 2
Mapping string: MsgLoadDescripition to index: 3
Mapping string: MsgLoadInfoDone to index: 4
Mapping string: MsgClientJoin to index: 5
Mapping string: Welcome to the Torque demo app %1. to index: 6
Mapping string: Player to index: 7
Mapping string: MissionStartPhase1 to index: 8
*** New Mission: tutorial.base/data/missions/test1.mis
*** Phase 1: Download Datablocks & Targets
#2
07/24/2005 (10:02 pm)
Notice how it just stops at "Phase 1: Download Datablocks & Targets"? When it gets there it freezes and I have to CtrlAltDlt out of it. All I did to modify the code was change the original function loadTestMission() to:
function loadTestMission()
{
   // Create the server and load the mission
   createServer("MultiPlayer",expandFilename("./data/missions/test1.mis"));

   // Make a local connection
   %conn = new GameConnection(ServerConnection);
   RootGroup.add(ServerConnection);
   %conn.setConnectArgs("Player");
   %conn.setJoinPassword("None");
   %conn.connect("192.168.1.102");
}

pretty much just created a Multiplayer server and did "%conn.connect("192.168.1.102");".
I also put setNetPort(0); in "function initClient()".

What else do I need to do to get this working?
Thank you very much,
Justin Woodman
#3
07/24/2005 (10:14 pm)
Well, what that last function is doing, is hosting a server off your own computer, And then trying to join a server with the that ip...you need to make it pick, one or the other.
#4
07/24/2005 (10:20 pm)
So you can't host a server and join it at the same time? how does starter.fps let you host a multiplayer game that you can play in and other can join that server?
#5
07/24/2005 (10:22 pm)
Well you can, but when you host a multplayer game, its just like starting a normal server but it lets people join. so your auto in the server, since its hosted off your computer.

Edit: so if you want everyone to just join one server, then call the start multplayer on the "master" server comp and the %conn.connect("192.168.1.102"); on the player comp
#6
07/24/2005 (10:32 pm)
Aah, I see, that explains quite a lot. The main problem now, is that I can't test it because I can't run two instances of torque on the same machine :(
well thank you very much for your help, I truly appreciate it after looking for sooo long for an answer :)
#7
07/24/2005 (10:33 pm)
Well, to run 2 copys try the debug mode if you own torque, then just compile into debug mode rather then release mode, how you change that...it depends on your compiler :P
#8
05/10/2006 (1:52 pm)
Does anyone know of a tutorial for implementing Multiplayer in the tutorial base?
#9
05/10/2006 (3:08 pm)
I had a similar problem. I was incrementally adding multiplayer GUIs and functions from starter.fps into tutorial.base, but after everything was apparently at place, our LAN tests wouldn't work no matter what. The server was simply not appearing on list, it wasn't even opening connections on the network at all.

Then I found this was missing:
setNetPort(0);

Call that somewhere before you attempt to create/join servers (putting it at initClient() will do).
#10
05/24/2006 (1:07 am)
Im also a little lost in how to create a and host a server starting from tutorial.base (all in the same machine)... Any one knows the best way of doing this?
#11
01/06/2008 (7:59 am)
Heh, over a year old on this post but I'll reply anyway.

I'm new to Torque and was trying to figure this out myself. Found this solution spread across a few threads, thought I'd gather them together in one place. Sorry if it's a duplicate of some other thread, but I sure couldn't find it.

First Off: I created two directories with source, one for my server and one for my client. That way all changes for server don't get included in the client and vice a versa.

Second: I compiled the source in both directories as debug

Third: Get the Master Server prototype

Fourth: In the server directory, I changed the address in the server\defaults.cs from $pref::Master0 = "2:master.garagegames.com:28002"; to $pref::Master0 = "2::28002";

Fifth: In the server directory I run Starter.FPS Dedicated.bat (Yes, I'm on a windoze box).

Sixth: In the client directory, I changed the address in client\prefs.cs from $pref::Master0 = "2:master.garagegames.com:28002"; to $pref::Master0 = "2::28002";

Seventh: I launched the client (started the torquedemo_DEBUG.exe file). It talked to my master server and then connected to my game server.

Hope this info will help someone else.
#12
01/06/2008 (9:48 am)
Very nice explanation, George! I'm sure it will help people making the leap between tutorial.base and starter.fps. It doesn't seem like it would be that big of a leap, but it is!
#13
01/06/2008 (10:50 am)
And just because nobody else said it, you cant give another person the IP address 192.168.1.102 because thats your routers IP, they (the world) cant see that, you would have to get your real IP from your router's main config program page. If your using D-link like me (my IP is 192.168.0.101 on my computer not my router) then just type in 192.168.0.1 -> then click on status tab and look down under the "WAN" area to see the real IP... please note that thats not for people on a LAN.

[edit] if i'm wrong someone please tell me. I want to make sure I have my own facts straight.
#14
01/27/2008 (6:04 pm)
You could also type in your default gateway address in your web browser, which will open-up the router configuration(after you enter your UserName and PWord of course).... just a thought... :)
#15
08/18/2008 (8:43 am)
So A couple of things one there is a dedicated server implemented in fps that is how you host and join the same game,

second with fps there is a connect function that allows an input of ip address and then it no longer needs the master server

my Question:

Has anyone had an issue withe engine checking versions when you connect to someone else and that list being so long it time out?