Game Development Community

Starting a server with a script...

by raa brubb · in Torque 3D Professional · 02/15/2014 (8:36 pm) · 8 replies

Hey all,

I hate to bother you, but I was wondering if there was anyway to start the Torque server with a script. You see, I have a VPS from host1free.com that does not allow you to use wine, so I don't know how to start the application to start the server. Can anyone enlighten me on how to start the server with a script in Linux?

#1
02/15/2014 (8:57 pm)
I think this is another one that could have kept in your previous thread. The topics are very related.

You don't need wine, you need to compile the server in linux. There's instructions floating around if you search for compiling a dedicated server in linux.

When you say "start with a script" what scripting language are you talking about ? Still PHP?
#2
02/15/2014 (9:01 pm)
No specific programming language, just wondering how to start that server. I am really not that experienced enough to start the server, and the other forum seamed dead. Again, I apologize if I seem to repeat forums and was only looking for help.
#3
02/15/2014 (9:13 pm)
If you aren't familiar with linux you should start by downloading Ubuntu or Linux Mint and try to compile and run your game server on there first. Once you succeed at that, you'll find it a lot easier to remotely compile your game on your VPS.
#4
02/16/2014 (9:35 pm)
Well I have used Linux many times, I actually have three linux servers that host my websites. Compiling shouldn't be a problem, I just haven't found a way to start the server with a simple script instead of starting the application and using the GUI to start it.
#5
02/16/2014 (9:44 pm)
What linux distro is the server running? If it's debian based just google how to make a init.d script. It's pretty simple, and will let your server run as a service that starts/stops with the distro.

If you still want to start it with PHP (security hazard in my opinion) then make a script that runs shell_exec("./myserver -dedicated"); and then have another php script (the one you open in your browser) fork the script that runs the server. If I remember correctly if you don't fork it the server process will be killed when you close your session with the webserver.
#6
02/17/2014 (7:43 am)
Also, see the game's root main.cs, scripts/main.cs and core/parseArgs.cs for Torque 3D's default command line options.

To start T3D as a dedicated server from the command line:

torque3d -dedicated -mission levels/mymission.mis

Sprinkle with quotes as needed....
#7
02/17/2014 (1:49 pm)
Ok, so thanks for the input.

Whatever language works. It seems pretty east to just start torque3d -dedicated -mission levels/mymission.mis. I don't think that's even PHP (although I don't know anything about PHP except what it does), if it starts the server I guess that works. The commands are kind of hard to find, but I guess that's fine. Anyways, I'm am going to need the server for the FPS I'm making. Including Speedtree, Spark Particle Engine (hopefully), and some cutscenes are needed. Also, I know this is off topic, but does anyone know any (very) good voice changers for storyline?
#8
02/17/2014 (5:45 pm)
Well, in Lua you'd use os.execute(), in PHP I'm sure there is some similar construct for executing a program from within script. In a regular linux shell script you'd just type the command line in the script as if you were at the command line - just like DOS batch files (but way more feature-rich).