Author Topic: Can the comments of your game be seen in the final .exe?  (Read 478 times)

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

  • The Man with No Name
    • I can help with AGS tutoring
    •  
    • I can help with play testing
    •  
    • I can help with proof reading
    •  
    • I can help with story design
    •  
    • I can help with voice acting
    •  
Re: Can the comments of your game be seen in the final .exe?
« Reply #1 on: 16 Nov 2017, 11:40 »
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

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: Can the comments of your game be seen in the final .exe?
« Reply #2 on: 16 Nov 2017, 12:39 »
Comments are skipped during compilation, that's general rule for compilers.
Comment tag (//, /* */) tells compiler to "ignore this text".

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?

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).
« Last Edit: 16 Nov 2017, 12:51 by Crimson Wizard »

Re: Can the comments of your game be seen in the final .exe?
« Reply #3 on: 16 Nov 2017, 13:15 »
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'?)
« Last Edit: 16 Nov 2017, 13:23 by bx83 »

Crimson Wizard

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: Can the comments of your game be seen in the final .exe?
« Reply #4 on: 16 Nov 2017, 13:39 »
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).

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.
« Last Edit: 16 Nov 2017, 13:43 by Crimson Wizard »

Snarky

  • Local Moderator
  • Mittens Earl
  • Private Insultant
    • I can help with proof reading
    •  
    • I can help with translating
    •  
Re: Can the comments of your game be seen in the final .exe?
« Reply #5 on: 16 Nov 2017, 13:48 »
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

  • Local Moderator
  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
Re: Can the comments of your game be seen in the final .exe?
« Reply #6 on: 16 Nov 2017, 13:53 »
I 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".