Game Development Community

Questions about recompiling engine

by Mark J A Smith · in Torque Game Builder · 05/22/2008 (9:18 am) · 6 replies

Hi, I've successfully recompiled TGB, and have also made changes to the engine that I have been able to see in action. I had to jump through some hoops to get up and running though, and that's where my questions come in:

All tutorials about recompiling the engine simply stop at the point where you get the engine recompiled. But what is the proper method for implementing a modified engine into an existing project? No one really discusses this. Maybe it's trivial and I'm missing something? I tried simply dropping the new TorqueGameBuilder.exe, as well as glu2d3d.dll and Opengl2d3d.dll into my games/MyProject folder. But when I run my game, I end up with a bunch of "behavior missing" errors, and getModPaths, setModPaths gives me an error, saying that those functions can't be found. I also noticed that, because of where it stops, none of my scripts get compiled, and all of the compiled scripts are gone (I'm guessing they get cleared out as part of the startup process?).

I decided to try running the new TorqueGameBuilder.exe from in Program Files (the one that I had recompiled), then created a new project, and dropped all of my scripts and resources from the old project, into the new one. Everything works fine at this point! Why is that?

Also, when everyone out there is making/testing engine modifications, what process do you use to test your changes? What I mean is - I can't possibly imagine having to recreate a project from scratch, everytime I recompile the engine, just to test some changes. What if I'm doing miniscule modifications, changing a single line of code - do I really have to recreate my project each time? Is there a simpler way to handle this? What does everyone else do?

Should I be recompiling the engine in a different folder than the one it is installed in? If not, do I have to update some environment variables or something?

Lastly, when you create a new .exe and check off the "copy .exe to game directory", does that simply make a copy of TorqueGameBuilder from "Program Files" folder, and rename it to ProjectName.exe, or is there something else involved in the process?

Thanks for any and all help everyone - I've really come to understand a lot of thing in the last month about TGB, but have just recently delved into engine modifications. : )

#1
05/22/2008 (10:12 am)
I admit the engine compilation process is somewhat confusing--we're looking at how to make it easier to work with in the future.

In the meanwhile, here are some things to keep in mind:

--When you recompile the solution, (assuming you are doing a build on the entire solution), there are two executables that are created:

* /tgb/TorqueGameBuilder.exe : this executable is the Torque builder itself..what is run when you normally run TGB (level editing, etc.)

* /tgb/gameData/T2DProject/TGBGame.exe : this is the executable that is run when you hit the "play" button from the Builder, as well as the executable that is copied over into your game directory when you create a new project and select the "copy .exe to game directory" option.

Normally when you are working on source code changes, the second executable is the one that is important to you. In normal operations, all you need to do is to copy this (the second) executable over into your game directory, and use Torsion to test, or double click that new icon within the game directory itself.

You shouldn't ever have to re-create your project or do anything other than what is listed above, as long as you are both having a successful compile (including linking) that results in a new TGBGame.exe, and didn't have any design/logic flaws in the changes you made.
#2
05/22/2008 (3:05 pm)
Thanks so much Stephen, the little bit of info about TGBGame.exe is exactly what I was missing. I've now got everything set up and working properly, and everything's peachy! I figured I was probably doing something wrong, haha.
#3
11/01/2008 (8:43 pm)
I have a few more questions on this subject.

I've just managed to recompile the source in both debug and release mode, making no changes to the code apart from those listed in the Visual C++ 2008 setup thread. My TGBGame.exe is 2620KB (release) and 6213KB (debug). Is it THIS file I'm meant to copy over into the project folder and rename to whatever my game name is? THAT file is only 887KB. But when I do it, my game runs from both the TGB editor and Torsion.

So first, am I copying from/to the correct files?
and second, why the difference in file size? What can I do to make my compiled exe as small as the one shipped with TGB?
#4
11/02/2008 (12:10 am)
You can UPX compress your exe to make it smaller.
#5
11/02/2008 (1:06 am)
Thanks Stefan. I'll give it a go.
#6
11/04/2008 (4:03 pm)
There are also many options that can be selected in the compiler to optimize for size. Personally, I tend to optimize for speed. I'm happy with a complete game folder under 30 gig.