Dedicated Server builds - Mac OSX -> Linux
by Carsten Tusk · in Torque 3D Professional · 05/26/2009 (11:54 am) · 17 replies
I spent a little time recently with compiling T3D Beta 1 on linux, I made it pretty far until I hit the platform layer where the old 1.5.2 linux platform base simply differs too much from todays platform layers.
My goal is simply to be able to get a working dedicated server build of T3D ported to linux, motivation is mainly that my planned project will need a lot of backend servers, potentially spawned on demand and I cannot see myself using Windows for that purpose ( maintenance, licensing, lots of reasons ).
Has anyone attempted a dedicated linux server build yet?
Are there any plans to introduce dedicated server builds to the C++ codebase, not just as a script option? It would make the porting so much more easy if I could deduct which parts of the platform layer a dedicated server would even utilize ( i.e. skip all window or input related functionality, null drivers for GFX and SFX).
Is there anyplace where I could possibly read up on changes to the platform layer ( specifically the input and window handling ) that would help me port the 1.5.2 unix platform layer? Or at least cut out the right things that a dedicated server would not need?
I am mainly looking for pointers here that would help my effort, any insight is appreciated.
Thanks,
Carsten
About the author
#2
Following along the same line that Playlore suggest, depending on how outdated platformUnix really is (haven't checked myself) I'd wait for the final T3D release and then start by porting over the OSX platform code and merging in stuff from platformUnix which is still relevant.
For a dedicated server, one could pretty much hack out most Mac-specific code from platformMac as that mostly relates to higher-level functions like input, GUI stuff, etc. The rest is either POSIX code or easily ported.
05/26/2009 (5:48 pm)
Following along the same line that Playlore suggest, depending on how outdated platformUnix really is (haven't checked myself) I'd wait for the final T3D release and then start by porting over the OSX platform code and merging in stuff from platformUnix which is still relevant.
For a dedicated server, one could pretty much hack out most Mac-specific code from platformMac as that mostly relates to higher-level functions like input, GUI stuff, etc. The rest is either POSIX code or easily ported.
#3
05/26/2009 (6:04 pm)
I would also recommend looking at using the Project Generator and its module definitions to strip out the Mac and Windows specific stuff (like the windowManager's, the platform layers, and the GFX layers). There is quite a bit of platform specific files and folders in there that the Project Generator could probably be trimmed for a dedicated Linux build. This is more the approach we take now-a-days rather than littering the engine with a ton of #ifdef's. Also be aware of the setDontCompilePatterns()'s set in the target definitions.
#4
@Rene & Matt: Thanks for the pointers. I like the project generator system, I recently added libtomcrypt and libcurl to it and I must say it makes integration a lot more easy. Now if I could only convince it to spit out unix Makefiles. I will have to dive deeper into its template engine for that I fear :) But I will take a look at the win/mac differentiations in the current templates to get an idea what to strip.
I think the main problem I ran into is that the event system around the input manager has changed and I wonder if I should even try to adapt it or if a dedicated server can live completely without it. Same for the platform window management.
05/26/2009 (8:08 pm)
@Playlore: Same here, I was curious how hard it would be to attempt a port so I wouldn't hit a brick wall later on and I must say I was pleasantly surprised. I spent maybe a day on it and aside from a few asm glitches ( local labels vs global since the code is inlined ) I did not have too much trouble compiling the whole codebase, until I ran into the platform layer. I think I will indeed wait for the official release and the mac version and then go from there. It looks very promising.@Rene & Matt: Thanks for the pointers. I like the project generator system, I recently added libtomcrypt and libcurl to it and I must say it makes integration a lot more easy. Now if I could only convince it to spit out unix Makefiles. I will have to dive deeper into its template engine for that I fear :) But I will take a look at the win/mac differentiations in the current templates to get an idea what to strip.
I think the main problem I ran into is that the event system around the input manager has changed and I wonder if I should even try to adapt it or if a dedicated server can live completely without it. Same for the platform window management.
#5
05/27/2009 (1:01 am)
Carsten, would you like to share the makefile you made so far ? I'm also interested to make an linux/bsd build and I would spend some time on the X86 platform code :)
#6
05/27/2009 (1:11 am)
Supporting Linux at least for the server is a must for the project I'm working on as well. Haven't done any work on porting the engine however, so would love to hear any progress made by anyone else here! :)
#7
1) Create a pure POSIX build in Windows. The only platform-ish things it would need are the ability of reading/writing/listing files and networking. Remove or dummy-fy the rest.
2) Make the remaining platform systems use cross-platform POSIX-compatible libraries if needed.
3) Port it to Linux.
Maybe with this you can get going without having to wait for the OSX port.
05/27/2009 (8:09 am)
You don't need the input system. Pure command-line doesn't need one. My current porting plan is:1) Create a pure POSIX build in Windows. The only platform-ish things it would need are the ability of reading/writing/listing files and networking. Remove or dummy-fy the rest.
2) Make the remaining platform systems use cross-platform POSIX-compatible libraries if needed.
3) Port it to Linux.
Maybe with this you can get going without having to wait for the OSX port.
#8
TGEA isn't too different in the dedicated server related things to T3D, so a port over should be straight forward.
Wasn't there a thread on TGEA dedicated server for Linux as well?
05/27/2009 (8:17 am)
I don't think there is any real need to wait for an OSX port.TGEA isn't too different in the dedicated server related things to T3D, so a port over should be straight forward.
Wasn't there a thread on TGEA dedicated server for Linux as well?
#9
Please treat it with caution, I did not spend a ton of time on it,
it is very rough around the edges. But maybe it saves you a little time ...
The Makefiles are a port from the 1.5.2 TGE build.
Linux system:
Ubuntu 8.10
gcc/g++ 4.2, make that the default by switching symlinks in /usr/bin
apt-get install libfreetype6-dev libopenal-dev nasm xserver-xorg-dev libxft-dev libsdl-dev
( those I managed to rememeber )
I started from a windows install of T3D Beta 2,
On linux, create t3d-beta-2
Engine/lib -> t3d-beta-2/lib
Engine/source -> t3d-beta-2/source
run end of line fix
$ sh source/ggEndOfLineFix.txt
apply patches in order from zip
@ http://www.seamoon.com/~cat/torque/t3dbeta2-linux-patches.tar.gz
(note: not sure how long I'll keep them there, if you read this months from now they're likely gone ( and hopefully much improved elsewhere ) )
$ cd t3d-beta-2
$ patch -p1 [--dry-run] < [...]
0002-Initial-Makefiles.patch
0003-Makefile-update.patch
0004-Source-code-adjustments.patch
0005-Add-torqueConfig.h.patch
( Yeah, I use git for my source control if you wonder about the odd filenames )
and compile, it should work until you hit the two platform layer dirs
source/platformX86UNIX
source/platformPOSIX
That's as far as I got so far ...
Todo:
- Make it past the platform layers
- Add the remaining lib/* projects and compile them properly
- See what happens when it actually tries to link
- Run it :)
05/27/2009 (8:29 pm)
@Thomas: Certainly.Please treat it with caution, I did not spend a ton of time on it,
it is very rough around the edges. But maybe it saves you a little time ...
The Makefiles are a port from the 1.5.2 TGE build.
Linux system:
Ubuntu 8.10
gcc/g++ 4.2, make that the default by switching symlinks in /usr/bin
apt-get install libfreetype6-dev libopenal-dev nasm xserver-xorg-dev libxft-dev libsdl-dev
( those I managed to rememeber )
I started from a windows install of T3D Beta 2,
On linux, create t3d-beta-2
Engine/lib -> t3d-beta-2/lib
Engine/source -> t3d-beta-2/source
run end of line fix
$ sh source/ggEndOfLineFix.txt
apply patches in order from zip
@ http://www.seamoon.com/~cat/torque/t3dbeta2-linux-patches.tar.gz
(note: not sure how long I'll keep them there, if you read this months from now they're likely gone ( and hopefully much improved elsewhere ) )
$ cd t3d-beta-2
$ patch -p1 [--dry-run] < [...]
0002-Initial-Makefiles.patch
0003-Makefile-update.patch
0004-Source-code-adjustments.patch
0005-Add-torqueConfig.h.patch
( Yeah, I use git for my source control if you wonder about the odd filenames )
and compile, it should work until you hit the two platform layer dirs
source/platformX86UNIX
source/platformPOSIX
That's as far as I got so far ...
Todo:
- Make it past the platform layers
- Add the remaining lib/* projects and compile them properly
- See what happens when it actually tries to link
- Run it :)
#10
05/27/2009 (8:42 pm)
Definately a lot of interest in this as I would love to get our zone servers on linux (having a client would be nice, but not nearly as important).
#11
05/28/2009 (1:02 am)
I'm also interested, and willing to help any way I can.
#12
I stuck a bit earlier in platform/platformIntrinsics.gcc.h because of undefined __sync_val_compare_and_swap and __sync_fetch_and_add. I guess my gcc is too old on that machine (4.0.3). I'll give it a try on my newer FreeBSD box.
05/28/2009 (1:38 am)
Excellent work Carsten and thank you for sharing :) I stuck a bit earlier in platform/platformIntrinsics.gcc.h because of undefined __sync_val_compare_and_swap and __sync_fetch_and_add. I guess my gcc is too old on that machine (4.0.3). I'll give it a try on my newer FreeBSD box.
#13
1.) lungif problem on bsd
=> exchange with source from my woring TGE build directory as a fast fix
2.) platform/platformCPUCount.cpp
Example: http://listas.es.freebsd.org/pipermail/freebsd/2000-February/004428.html
Modified => Is like Mac OS but had no way to determinate the physcial cpu's :(
3.) platform/platformNet.cpp
Modified => Same includes as on MAC
4.) platformX86UNIX/x86UNIXConsole.cpp
#include <signal.h> problem see also @17
5.) platformX86UNIX/x86UNIXDedicatedStub.cpp
removed from targets.torque!
6.) platformPOSIX/posixVolume.cpp
Modified ... some strange case errors , replaced with "if" ;)
7.) targets.torque.mk modifications because of dedicated build
"no rule to make target" on empty object
8.) x86UNIXMath.cpp
added: #include "core/strings/stringFunctions.h"
9.) removed from build:
./platformX86UNIX/x86UNIXGL.cpp
10.) x86UNIXMemory.cpp
platformX86UNIX/x86UNIXMemory.cpp:38: error: redefinition of 'void* operator new(dsize_t, void*)'
/usr/include/c++/4.2/new:105: error: 'void* operator new(size_t, void*)' previously defined here
11.)x86UNIXMessageBox.cpp
fixed: #include "core/util/tVector.h"
12.) x86UNIXMutex.cpp
replaced with mac code
13.)x86UNIXNet.cpp => FIXME platform/platformNet.h TORQUE_OS_FREEBSD
removed
14.) ***
15.)x86UNIXOGLVideo.cpp
removed >> dedicated
16.) x86UNIXOpenAL.cpp
removed >> dedicated
17.) eeeps .. now I know why signal.h makes trouble:
!!!! same as in signal.h!
core/util/tSignal.h:#ifndef _SIGNAL_H_
core/util/tSignal.h:#define _SIGNAL_H_
core/util/tSignal.h:#endif // _SIGNAL_H_
!!!!
=> replaced all with _T3D_SIGNAL_H_
T3D/physics/physicsPlugin.h:#ifndef _SIGNAL_H_
T3D/physics/physicsStatic.h:#ifndef _SIGNAL_H_
T3D/physics/physx/pxUserData.h:#ifndef _SIGNAL_H_
T3D/physics/physx/pxWorld.h:#ifndef _SIGNAL_H_
core/resource.h:#ifndef _SIGNAL_H_
core/util/tSignal.h:#ifndef _SIGNAL_H_
core/util/tSignal.h:#define _SIGNAL_H_
core/util/tSignal.h:#endif // _SIGNAL_H_
core/volume.h:#ifndef _SIGNAL_H_
gfx/gfxDevice.h:#ifndef _SIGNAL_H_
gfx/gfxTextureManager.h:#ifndef _SIGNAL_H_
gui/missionEditor/worldEditor.h:#ifndef _SIGNAL_H_
lighting/lightManager.h:#ifndef _SIGNAL_H_
lighting/shadowManager.h:#ifndef _SIGNAL_H_
materials/baseMatInstance.h:#ifndef _SIGNAL_H_
sfx/sfxDevice.h:#ifndef _SIGNAL_H_
sfx/sfxSystem.h:#ifndef _SIGNAL_H_
sim/processList.h:#ifndef _SIGNAL_H_
terrain/terrData.h:#ifndef _SIGNAL_H_
18.) x86UNIXProcessControl.cpp
some fixme hacks and added stripped down x86UNIXDedicatedStub.cpp again
19.) x86UNIXSemaphore.cpp
replaced with mac code mhh maybe it works maybe not since there is nothing left from sdl
... stucking with "no rule to make target" on empty object again .. need a break ;)
05/28/2009 (9:30 am)
I'd some progress but far away from "ready to run" ;)1.) lungif problem on bsd
=> exchange with source from my woring TGE build directory as a fast fix
2.) platform/platformCPUCount.cpp
Example: http://listas.es.freebsd.org/pipermail/freebsd/2000-February/004428.html
Modified => Is like Mac OS but had no way to determinate the physcial cpu's :(
3.) platform/platformNet.cpp
Modified => Same includes as on MAC
4.) platformX86UNIX/x86UNIXConsole.cpp
#include <signal.h> problem see also @17
5.) platformX86UNIX/x86UNIXDedicatedStub.cpp
removed from targets.torque!
6.) platformPOSIX/posixVolume.cpp
Modified ... some strange case errors , replaced with "if" ;)
7.) targets.torque.mk modifications because of dedicated build
"no rule to make target" on empty object
8.) x86UNIXMath.cpp
added: #include "core/strings/stringFunctions.h"
9.) removed from build:
./platformX86UNIX/x86UNIXGL.cpp
10.) x86UNIXMemory.cpp
platformX86UNIX/x86UNIXMemory.cpp:38: error: redefinition of 'void* operator new(dsize_t, void*)'
/usr/include/c++/4.2/new:105: error: 'void* operator new(size_t, void*)' previously defined here
11.)x86UNIXMessageBox.cpp
fixed: #include "core/util/tVector.h"
12.) x86UNIXMutex.cpp
replaced with mac code
13.)x86UNIXNet.cpp => FIXME platform/platformNet.h TORQUE_OS_FREEBSD
removed
14.) ***
15.)x86UNIXOGLVideo.cpp
removed >> dedicated
16.) x86UNIXOpenAL.cpp
removed >> dedicated
17.) eeeps .. now I know why signal.h makes trouble:
!!!! same as in signal.h!
core/util/tSignal.h:#ifndef _SIGNAL_H_
core/util/tSignal.h:#define _SIGNAL_H_
core/util/tSignal.h:#endif // _SIGNAL_H_
!!!!
=> replaced all with _T3D_SIGNAL_H_
T3D/physics/physicsPlugin.h:#ifndef _SIGNAL_H_
T3D/physics/physicsStatic.h:#ifndef _SIGNAL_H_
T3D/physics/physx/pxUserData.h:#ifndef _SIGNAL_H_
T3D/physics/physx/pxWorld.h:#ifndef _SIGNAL_H_
core/resource.h:#ifndef _SIGNAL_H_
core/util/tSignal.h:#ifndef _SIGNAL_H_
core/util/tSignal.h:#define _SIGNAL_H_
core/util/tSignal.h:#endif // _SIGNAL_H_
core/volume.h:#ifndef _SIGNAL_H_
gfx/gfxDevice.h:#ifndef _SIGNAL_H_
gfx/gfxTextureManager.h:#ifndef _SIGNAL_H_
gui/missionEditor/worldEditor.h:#ifndef _SIGNAL_H_
lighting/lightManager.h:#ifndef _SIGNAL_H_
lighting/shadowManager.h:#ifndef _SIGNAL_H_
materials/baseMatInstance.h:#ifndef _SIGNAL_H_
sfx/sfxDevice.h:#ifndef _SIGNAL_H_
sfx/sfxSystem.h:#ifndef _SIGNAL_H_
sim/processList.h:#ifndef _SIGNAL_H_
terrain/terrData.h:#ifndef _SIGNAL_H_
18.) x86UNIXProcessControl.cpp
some fixme hacks and added stripped down x86UNIXDedicatedStub.cpp again
19.) x86UNIXSemaphore.cpp
replaced with mac code mhh maybe it works maybe not since there is nothing left from sdl
... stucking with "no rule to make target" on empty object again .. need a break ;)
#14
make dedicated
Beside the missing libs collada,pcre,opcode,squisch and tinyxml
there are also some missing things in the platformX86UNIX source
which make it not link.
Hope the patch work I made it against carsten's patch with diff
but didn't tried it out:
thunderous.de/torque/source_patch_xxth_090529.patch.gz
User: tge
pwd : very!secret1
05/30/2009 (3:51 am)
I made it pass all source files with make dedicated
Beside the missing libs collada,pcre,opcode,squisch and tinyxml
there are also some missing things in the platformX86UNIX source
which make it not link.
Hope the patch work I made it against carsten's patch with diff
but didn't tried it out:
thunderous.de/torque/source_patch_xxth_090529.patch.gz
User: tge
pwd : very!secret1
#15
01/29/2010 (5:43 am)
Hi all I am also trying for Linux port. any hint. What are the libraries should i added for torque 3d.
#16
01/29/2010 (2:36 pm)
I believe some work is being done on this so unless you have some immediate need you might want to wait to see what gets released. It was my understanding some work was being done to make it easier to get a Linux dedicated server up and running.
#17
http://www.torquepowered.com/community/forums/viewthread/111257/1#comment-780997
09/28/2010 (2:54 pm)
Update:http://www.torquepowered.com/community/forums/viewthread/111257/1#comment-780997
Torque 3D Owner Playlore
Did you try looking into the TGEA 1.8.1 OSX platform layer? Maybe it can offer some aid on what to do.