Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

There are several applications like Blitz3D or other kinds of game construction tools that compile scripts or other game data to a single executable file. How do they do that?

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

Different tools approach that in different ways, but the way Blitz3D does it is to wrap the code and an interpreter into a bundle. Then when you run the exe, that launches the interpreter and passes in the bundled code. It's pretty much the same as how, say, Python works when using py2exe.

In many game development tools, the code that is bundled along with the executable is simply raw text that the interpreter parses. However some take a bytecode approach like Java, where the source-code is turned into an intermediate form that the virtual machine uses. I think Unity uses this latter approach but I'm not sure.

Off the top of my head all game development tools I can think of that package executables are either based on this approach of a core interpreter/virtual machine and then packaging it with the code, or are libraries that you compile in Visual Studio or whatever.

share|improve this answer
    
Is the second approach is faster than the first? –  iamcreasy Oct 11 '11 at 6:46
    
There are pros and cons, but the main thing to bear in mind with regards to speed is that all the really speed critical code (eg. rendering routines) is in the interpreter and thus the speed of the interpreted code isn't as important. The interpreted code simply calls a function like loadMesh() and the interpreter does the rest. It's the exact same situation as using a scripting language embedded in a game engine; indeed, there are frequent debates on Blitz3D's forum about whether or not it is a "game engine". –  jhocking Oct 11 '11 at 12:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.