How To See Other Games' Code (current info posted in OP and Post 146 on 6/18/19)

So sorry to necro this thread,and so sorry if this question has already been asked.

Can a game’s code be viewed on an Android device?And if yes,how?

The game in question is Zombie Exodus:Safe Haven.

Two ways I know of first is the one the big guy himself told me here:

The second is to use this python extension, instructions here. If you want to mod and repack you need to follow the first and more involved method, since the python thingy unfortunately only extracts archives to directories and cannot (yet) do the process in reverse in order to play your modded games on Steam, which I guess was one of CoG’s reasons to begin with.

Personally I prefer the python method for now.

5 Likes

Shifted that post over here since it’s super useful.

The link to the Python extension isn’t working.

Furthermore, apparently there’s an app.asar on the new steam version of TLH 3, but the extraction isn’t getting the scenes out.

You can look the code at the site version of the games. Just send CoG the receipt of your purchase and they will unlock it for you.

1 Like

This method is now required for games downloaded on Steam – the “Use 7-Zip on the .EXE file” won’t work on games that have been packaged recently. In particular, it won’t work for Lost Heir 3, and (when I re-downloaded it from Steam to check) the “Use 7-Zip on the .EXE file” won’t work on Lost Heir 2 either (and it used to work).

Note that you are still able to open the .EXE file with 7-Zip, but it opens it as a “PE file” (= “Windows EXE”) and shows you a list of resources, including the uncompressed compiled code, that make up the EXE. This isn’t useful in the slightest for the purposes of “Viewing the source code of a ChoiceScript game”, so…

To add some more detail to the instructions:

  1. Go to https://nodejs.org/, download and install the software you find there. You must note the installation directory, as you’ll need it for the next step. By default, it will be “C:\Program Files\NodeJS”.
  2. Open a command prompt (Start / Run and type “cmd” works prior to Windows 10 – in Windows 10, click on the “Find anything” button next to the start button (its a circle) and type “cmd” in that box to do this.
  3. Type “cd [path you installed NodeJS too]” – note that you will need to use double quotes around the path name if it contains spaces, and it almost certainly does. For example: cd “C:\Program Files\NodeJS”.
  4. Type npm install -g asar into the command window. After a fairly short (< 30 second) pause, a text rendition of a file / folder tree will appear and you’ll end up back at the command prompt.
  5. Open (or change) the current directory to the location where Steam installed the game you are investigating. This tends to be a long path – in most cases it will be easier to right click on the game in Steam, select “Properties”, then “Local Files”, then “Browse Local Files”, then while holding the shift key, right click on an empty area of the window that appears and select “Open Command Window Here”. If you don’t see this option, you aren’t pressing and holding the shift key before right clicking – this isn’t a documented feature, but it does work. :slight_smile: This is hardly the only way to get to the right directory, but it is the easiest to explain without screenshots (I think).
  6. Once you have a command prompt opened in the right directory, type cd resources (this is where the app.asar file actually resides).
  7. Finally, type asar e app.asar dest. Nothing at all will seem to happen (although you shouldn’t get an error message). However, if you go back to file explorer, there will be a new directory “dest” in the resources folder for your game, which contains the source code of the game.

Good grief, cheating has never been this hard before… :slight_smile:

For the record:

  • dest in Step #7 is the name of a directory where the files will be decompressed to, and you can change it. But the instructions are complex enough as it is, so…
15 Likes

Yes, but that only allows you to look, if you’ve got more comprehensive plans such as my “it’s raining men” mod on @Havenstone’s upcoming game merely looking won’t be enough.

I know, that seems to be the sole purpose of that whole .asar thingy in the first place.

Of course to really cheat we’d need to re-pack it and have Steam read it, that will be the real challenge in series that need saved games.

If you modify the extracted files, then delete rename (or delete, I suppose) the original app.asar file, then asar p dest app.asar should recreate the file. The other (more sensible!) option is to simply open the index.html file that is located in the dest/deploy folder (if you extracted to dest) – that will enable you to play the modified game locally, which should be sufficient unless you want Steam achievements to work properly.

In either case, of course, you’ll need to delete the *.json files and optionally recompile the game (using the utilities provided for this purpose with the standard CoG development kit). If present, the .json files are used instead of the .txt files.

how do i fix this ? : Non-existent variable 'heroine
sorry for asking im just a beginner :confused:

It’s difficult to say without seeing the code.
But I think you didn’t declare the variable heroine.

Ummm can anyone help me out with Sabres of Infinity I can’t seem to find any scenes. I can pull up the startup text but none of the chapters

I tried and had no problems, what is happening when you try it?

Error Couldn’t find Scene

https://www.choiceofgames.com/user-contributed/sabres-of-infinity/scenes/chap1.txt

It’s because you are writing chap1, it should be Chapter1.

1 Like

Ahhh the capital ‘C’ In Chapter1 messed with me when I tried chapter thanks for the help

1 Like

When does it say {"error":"not registered"}?

Mean you either don’t have the game or you aren’t logged with your account.

So now what do I have to do to get the game (Guns of Infinity) for free on the website? Because I currently own it on Google Play Store, and I would certainly prefer not to buy it multiple times.

Just send the receipt of the purchase to CoG’s email and they will unlock the game for you.

I hope it wouldn’t matter if the email addresses don’t match?