Game Development Community

Compiling all .cs files?

by Mitchell Talmadge · in General Discussion · 06/12/2011 (2:54 pm) · 7 replies

How do I compile all the .cs files into .dso's? I can't find any batch file that does it, only the ones that remove them.

About the author

I have been scripting mods for a game called "Blockland" and I decided to take a shot at making my own game. I am currently working on my own game titled "Celestial Online".


#1
06/12/2011 (3:04 pm)
Several different ways.

Automatic compilation of scripts is turned off by default. You can turn it back on by finding the following #define in torqueConfig.h and commenting/removing it:
/// Define me if you don't want Torque to compile dso's
#define TORQUE_NO_DSO_GENERATION
If this is removed then scripts will be compiled automatically and saved as DSOs whenever the game is run.

Or, from the console, within the game, you can run the compileFiles() helper method located in main.cs.

Or you could set the $compileAll global when launching the game and it will do the work for you.

And lastly, I *think* that the Toolbox has the option to compile scripts for you when packaging a project. Don't know for sure 'cause I don't use the Toolbox.
#2
06/12/2011 (4:35 pm)
Thanks Michael!
#3
06/16/2011 (11:16 am)
What about main.cs in the root directory, the script has it so it won't compile, but what is the reason for this? What will happen if I do compile it?
#4
06/16/2011 (2:05 pm)
Main.cs has to remain uncompiled and must be included for the game to run. The engine looks for that main.cs to start up all the scripts.

The Toolbox doesn't compile scripts, I believe it did in a previous version but not now.

There's also -compileAll command line argument that you can use compile them. Using that argument is how $compileAll is normally set. That's my usual reccomended method as it's fast, you don't forget to flip a flag on or off during dev so you don't have to keep running DeleteDSOs, and it also ensures .gui's are compiled as well.

#5
06/16/2011 (4:11 pm)
What if someone edits the code? I have a login system, couldn't someone who knows TorqueScript be able to get past that by adding a bit of code? Could I change the path the engine looks for to main.cs.dso?

Thanks for the reply! :)
#6
06/19/2011 (4:34 am)
genEpak works great with T3D.
You can split your scripts into several packs,that nobody can change.
#7
06/19/2011 (4:51 am)
@Mitchell - If your login system is written in a way that someone can bypass it by editing the client code, it is very badly flawed. "Never trust the client" is one of the first axioms of computer security.