Game Development Community

dev|Pro Game Development Curriculum

T3D 1.1 - Separating a poject in to server and client parts

by Lee Wickham · 04/28/2011 (11:16 am) · 16 comments

As requested here is a step by step procedure on separating a Torque 3D 1.1 Preview poject in to seporate server and client projects.

Torque 3D Version: 1.1 Preview
Platform: Windows
Credits for information and help go to:
Pitfall
Michael Hall
Sam Kitzmiller
JulianR
Scot Kinney
QuintonD

Thank you all for replying to my request post and providing the information you did!

Disclamer:
This step by step procedure is only known to work on a blank full project!
I have not been able to test any further, if this process does work on a more developed game please feel free to add a reply stating so.


Step by Step Procedure:


Note: Majority of the code blocks have been removed due to word out limit.
Please see The following Thred Post 14 onward for the code blocks.

  1. Create a new project named "test" using the "full" template.
  2. Duplicate the "test" project and rename the folder to "test - server".
  3. Rename "test.exe" to "test_w32ded.exe".
  4. Rename "test.dll" to test_w32ded.dll".
  5. Rename "test.torison" to "test_w32ded.torison".
  6. Remove the following files: - If you need the web browser plugin skip this step.
    • IE test Plugin.dll
    • NP test Plugin.dll
  7. Remove the following Directories: - If you need the web browser plugin Dont remove the gameweb folder!
    • game/web
    • game/shaders
    • game/art/gui
    • game/core/fonts
    • game/core/unifiedshell
    • game/core/scripts/client
    • game/core/scripts/gui
    • game/core/art/gui
    • game/scripts/gui
    • game/scripts/client
  8. Remove any referances to client material in game/main.cs
  9. Remove any referances to client material in game/core/main.cs
  10. Remove any referances to client material in game/scripts/main.cs
  11. Copy the following files from %client project%/game/core/scripts/client to %server project%/game/core/scripts/server
    • audio/Ambiences.cs
    • audio/Descriptions.cs
    • audio/Environments.cs
    • audio/States.cs
    • canvas.cs
  12. Copy the content of %client project%/game/core/scripts/client/audio.cs into %server project%/game/core/scripts/server/audio.cs
    • Do not overwrite the function in server/audio.cs as there needed to, simply place the client functions above them.
  13. Create a file named "core.cs" in %server project%/game/core/scripts/server containing the following functions
    • This resolved alot of SFX warnings!!
    //---------------------------------------------------------------------------------------------
    // Torque Game Builder
    // Copyright (C) GarageGames.com, Inc.
    //---------------------------------------------------------------------------------------------
    
    //---------------------------------------------------------------------------------------------
    // initializeCore
    // Initializes core game functionality.
    //---------------------------------------------------------------------------------------------
    function initializeCore()
    {
       // Not Reentrant
       if( $coreInitialized == true )
          return;
    	  
    	// Very basic functions used by everyone.
       exec("./audio.cs");
       exec("./canvas.cs");
       
       // Content.
       exec("./audioDescriptions.cs");
       
       // Seed the random number generator.
       setRandomSeed();
       
       // Set up networking.
       setNetPort(0);
      
       // Initialize the canvas.
       initializeCanvas();
         
       $coreInitialized = true;
    }
    
    //---------------------------------------------------------------------------------------------
    // shutdownCore
    // Shuts down core game functionality.
    //---------------------------------------------------------------------------------------------
    function shutdownCore()
    {      
       // Stop file change events.
       stopFileChangeNotifications();
       
       sfxShutdown();
    }

  14. Created "start server.bat" in %server project%/game with the following code:
  15. test_w32ded.exe -log 2 -dedicated -mission "levels/Empty Terrain.mis"

  16. run the batch file and you will see your dedicated server start up.

  17. img821.imageshack.us/img821/2538/testdediserver.png

End of Step by Step Procedure


If iv not forgoten any steps there should be 0 errors when you run your newly created dedicated server.
If however i have forgotten any steps i will update this resorce with those steps that are missing and make a note at the beginning of the resorce stating what additional steps have been added.

Hope this helps

Regards
Lee Wickham

About the author

A Founder of IGD Studios


#1
04/28/2011 (3:56 pm)
nice resource, ty very much.
#2
04/29/2011 (5:06 am)
post Content removed: Added to main thread step by step
#3
06/03/2011 (8:28 pm)
In step 4 there is something that didnt make sense kinda looks like a copy paste mistake

Line 4 says:
Rename "test.dll" to test_w32ded.exe".
and probable should say
Rename "test.dll" to test_w32ded.dll".

Ill let you know if I find anymore :)

Also in steps 8 9 10 and 12. Not everyone will understand what you mean here can you provide more details on what to remove?

And lastly When i run this on windows 7 the server crashes after initialization but i may have missed something in 8 9 or 10 maybe even messed up 12 so ill keep checking
#4
06/04/2011 (1:14 am)
Hi Manni, thank you for spotting the typo in step 4 it should indeed state .dll insted of .exe, ill updated that shortly.

as for steps 8-12

as stated on the top of the resource if you Click here and follow post 14 onward you understand those steps alot better, as that was the initial thread i had made with all of the code block examples before i made the resource post.
#5
06/04/2011 (9:45 am)
Thanks Lee,

I found my mistake in the new core.cs file. I forgot to delete the extra stuff that copy & paste enters in lol. Also apparently with 8 9 and 10 I got it completely right by myself, although I wish I would have seen the link earlier as that would have helped. But i can now state that everything is working perfectly.
#6
07/05/2011 (5:45 pm)
Very help full. I now have a server up and running. Have some questions tho. Which can be found Here.
#7
07/05/2011 (8:08 pm)
@ Justin - have replied answering your questions the best i could (its 04:07 here so i apologize if i don't make a lot of scene in some of those answers lol)

any way hope those answers help or point you in the right direction, if you have any more please just ask.
#8
07/06/2011 (3:00 pm)
@Lee Wickham - Thanks for the reply. Didn't understand some of them but i think i know what you are talking about.
#9
08/22/2011 (6:20 am)
serveraudio.cs appears to be deprecated.

It's not in the current version.

Any suggestions on how to proceed from step 12?
#10
08/22/2011 (7:08 am)
I figured it out from the earlier article. It's server/audio.cs
#11
08/22/2011 (12:31 pm)
@Jack Dingler

sorry about the missing shash there must of happend when i last edited the thread, iv not re edited replacing the backslashes with forward slashes so they dont automaticaly get removed should i need to edit in the future.


I have also cleaned up the main thread information a little to.
#12
10/30/2011 (10:38 pm)
Just wanted to post an update.


I now have this working with Torque 3D 1.1 Pro although im having problems connecting using my Internet IP but that is probably down to my computers security settings.

As soon as Torque 3D 1.2 is out and i have upgraded to it, ill go through the process again and report back on my findings.
#13
01/01/2012 (8:34 am)
Any word on 1.2?
#14
01/01/2012 (1:22 pm)
Unfortunatly i will no longer be keeping this resource up to date as a have since moved over to using a new engine.
#15
05/25/2012 (12:36 pm)
Has anyone done this with the 1.2 engine?
#16
05/25/2012 (3:10 pm)
Has anyone done this with the 1.2 engine?