Can the comments of your game be seen in the final .exe?

Started by bx83, Thu 16/11/2017 11:24:19

Previous topic - Next topic

bx83

I realise that compiling generally means taking all non-commented code, converting it to object code, and finally to binary. However, since AGS is a script engine (correct me if I'm wrong), and has a copy of the game scripts within the interpretor within an .exe file, it could be thought of as an exe which is really just one giant complex zip file?

So basically, what conditions are scripts in when they're compiled/'published'? Do they contain words but not comments; verbatim without line breaks; absolutely the same as original; or pure binary?

Danvzare

Hmm, now that you bring it up, I would like to know too. Well that and would it be possible to reverse the compilation process to read these comments?
And also, would we be able to lower the size of the game by deleting all comments before compiling?

Crimson Wizard

#2
Comments are skipped during compilation, that's general rule for compilers.
Comment tag (//, /* */) tells compiler to "ignore this text".

Quote from: bx83 on Thu 16/11/2017 11:24:19However, since AGS is a script engine (correct me if I'm wrong), and has a copy of the game scripts within the interpretor within an .exe file, it could be thought of as an exe which is really just one giant complex zip file?

AGS Editor compiles the script source to byte code, where each command from your script may be represented by one or more numberic codes, basically.
AGS does not have a copy of original scripts withing exe file, only the compiled byte-code. **Before AGS 3.0 it actually contained room script sources for some reason, but it no longer does.
Text from the actual script commands (character speech, etc) is contained "as-is", from what I remember, in a separate table. Some texts are stored encrypted, but I do not remember which ones (AGS is pretty non-consistent there).

bx83

So, would *anyone* be able to reverse engineer a game based on what was commented in their code? A catagoric no?
Are names of variables recorded or are they also translated to just numeric code (like variable 'GotTheCoins' becomes '&102'?)

Crimson Wizard

#4
Quote from: bx83 on Thu 16/11/2017 13:15:46
So, would *anyone* be able to reverse engineer a game based on what was commented in their code? A catagoric no?
Comments are not saved in compiled code.
Compiled code on its own can be reverse-engineered, there is already an utility that decrypts AGS compiled scripts into human-readable list of operations (the result is not actual AGS script source, but in theory may be used to understand what is going on in the program and try to recreate it).

Quote from: bx83 on Thu 16/11/2017 13:15:46
Are names of variables recorded or are they also translated to just numeric code (like variable 'GotTheCoins' becomes '&102'?)
Names of exported variables and functions are recorded for some reason, non-exported variables are known only by their relative offset in memory.

Snarky

Quote from: Crimson Wizard on Thu 16/11/2017 13:39:17
Names of exported variables and functions are recorded for some reason

Used in error messages, perhaps? Maybe I'm confusing what you see when the game crashes with the debugger and what you see when it crashes outside it, but I seem to remember that you see the name of the function where the crash happened? (And perhaps the name of the script? I actually thought you get the line number as well, though I don't understand how that can be available after compilation.)

Crimson Wizard

Quote from: Snarky on Thu 16/11/2017 13:48:44I actually thought you get the line number as well, though I don't understand how that can be available after compilation.)

Line numbers are saved also, in a form of special command code "beginning of line".

SMF spam blocked by CleanTalk