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

I saw an explanation of how to look at “/scenes” for a game in a long-ago Choice of Vamp comment thread. If I hadn’t seen it, it wouldn’t have occurred to me that it was possible… and I’d have missed out on a whole lot of learning that’s come from digging into how other people coded their games!

[Edit: Reaperoa’s original explanation was back when mygame.js was where your scene list lived. Now it lives in startup.txt. So here are some Choice of Rebels examples to complement/update his explanation. Here’s my start up scene:

https://www.choiceofgames.com/rebels/scenes/startup.txt

And once you’re there, you can see the names of the other scenes in the scene list; to view them, just cut and paste their names instead of “startup” in the url]

[Edit II: if you’re trying to look at the scene list for a compiled WiP, have a look at CJW’s suggestion here.]

[original post, no longer valid:]

@Reaperoa just gave a good concise explanation of how it’s done, which I’m reposting here for easy reference:

Any CS game you can view online, you can view the code for. It just takes a tiny bit of poking around. Simply start up the game, it’ll shoot you over to the inner index.html (links may be to the outer one, so you’ll want to visit the game and let it load to get the link to the inner one), from there you can replace index.html with mygame.js in the address bar, and from there it’s just a matter of /scenes/foo.txt.

Too technical? Let me give you an example:

Compare this link (The actual link, not the page itself):
dl.dropboxusercontent.com/u/45314691/CoG Games/8Thrones/index.html

With this one:
dl.dropboxusercontent.com/u/45314691/CoG Games/8Thrones/mygame.js

Then, once you visit the mygame, you should be able to figure out this one:
dl.dropboxusercontent.com/u/45314691/CoG Games/8Thrones/scenes/startup.txt


Edit III (18 June, 2019):

If you're still confused, here's a visual guide on how to look at a game's code (CoG Webstore Only)

First thing you have to do is choose the game whose code you want to see!

I’m using Community College Hero 2 because I love staring at Hedonist’s beautiful nose as I work.

Click on Play Online.

You should arrive at this screen:

If you want to look at a full game's code, make certain that you are logged into the account that you bought the game with. If you are logged in, you will be able to see the option to sign out on the right-hand corner of the screen.

Note: You don’t have to be logged in to see a game’s code, but you will be blocked from seeing scenes you haven’t paid for. I don’t know how, please don’t ask me why, I’m assuming it’s actual wizardry. Ask Gandalf.

Next. Highlight the jumble of text after the game's name (excluding the forward slash).

Delete that sucker.

In its place, write the following: scenes/startup.txt

Then, of course, hit enter on that bad boy.

You should now arrive at this screen:

People experienced in code-diving or even game writers will recognize this screen, but for the newbies, this is the file that lists the game scenes and its stats (and achievement, if it has any).

Those $ in front of those scenes means that they’re locked behind a paywall. If you’re not logged into an account where you’ve bought this game then you will only be able to follow the next steps with the demo scenes (i.e. the ones without the $ in front of them).

Here's how you look at a specific scene:

I like to just copy & paste from the file itself, like so.

Highlight the startup in the url.

And replace it with the name of the scene whose file you wish to see.

Again, I just copy & paste it, but you do you. If your fingers need the workout, go for it!

Press enter and you'll be rewarded with the sweet, sweet code, oh yeah baby–


And that’s how you look at a game’s code!

129 Likes

Question…But if you can do this wont that mean you could edit the files? And then possibly if you want to be a Arse then change a couple things so the entire game wouldnt work? Then that would kinda give the author/ coder a bad name due to one troll…

Thanks for reposting this, @Havenstone I love poking at code, seeing how people accomplish things. There’s some really interesting tricks that some coders use which I find utterly fascinating. I think I actually get more enjoyment from reading the code than I do from playing the games.

Just to add, it’s much easier on any game on the Choice of Games website. You can look directly in the scenes directory.

So

becomes

http://www.choiceofgames.com/dragon/scenes/

4 Likes

@Greenwolf No, you can’t alter the files without direct access. It’s sort of like, when you download a file, you can’t just turn around and upload something in it’s place. Think Youtube, you can download the videos easily enough, (in fact that’s technically what you’re doing when you watch them on the site) but you can’t upload or alter the videos unless Youtube gives you access (such as them being your videos).

@FairyGodfeather Yea, to my knowledge the way dropbox handles things precludes that from working, though I actually prefer to use mygame.js anyways, as it gives me the same view as the writer, meaning it’s easier to get into their head to help debug.

2 Likes

@Reaperoa Yep, the raw scenes folder is not much use for dropbox and similar hosts where you can’t directly access directories. I’m nosy, I like poking about in scenes especially finding files not listed in mygame.js

@FairyGodfeather Yea, I keep a lot of my notes in the scenes folder to, such as my file named |<font color = "white>youdidn’tactuallythinkI’dsay,didyou?|

Of course it’s worth noting that it would be possible to restructure your game, so while it will work in most, it may not work in every case.

And I think it goes without saying, but I’ll say it anyway: While people should feel encouraged to look at other author’s game files and learn from them, don’t rip stuff directly, try and put your own spin on it. I’m not even suggesting you have to ask for their permission (some author’s want it, others don’t) - but you won’t learn anything if you copy and paste a stats screen and just change some variable names.
Take systems apart, mix them with others and put them back together, it’s the best way to learn!

3 Likes

I’m bumping this because I keep getting asked how to see game code. Bump bump bump. Nowadays you just need to go to the startup.txt file instead of mygame.js since the scenes list is in startup.txt

@Samuel_H_Young, since you asked…

@Havenstone
Awesome, I’ll use this for future reference

Wow, that was incredibly useful.

In five minutes of browsing havenstone’s code i’ve learned an awful lot.

Glad to hear it! By proper coding standards it’s sloppy, but it gets the job done. (: Now go look at other people’s code for more and better ideas!

If you want to see the code of games purchased in Google Chrome Store. (Note this is not the same as the Play Store). What you need to do is first purchase the game on Google Chrome. (I’ll use Curse of the Black Cat as my example.)

Thieves' Gambit: The Curse of the Black Cat - Chrome Web Store - this is the webpage you buy it from. (Take a note of those letters at the end.)

Now you need to browse to where google chrome stores app data on your computer.

Navigate to chrome://version/ and look for Profile Path, it is the default directory that chrome apps are stored in. (For instance C:\Users\USERNAME\AppData\Local\Google\Chrome\User%20Data\Default)

Then click on the extensions folder (C:\Users\USERNAME\AppData\Local\Google\Chrome\User%20Data\Default\extensions)

Now there’s a folder with a bunch of confusing folder names in there, but I remembered that the jick one is the game I want to look at. From there you want to find the scenes folder.

(file:///C:/Users/USERNAME/AppData/Local/Google/Chrome/User%20Data/Default/Extensions/jickpmgeolbdpldfpefcadbjoninpelg/1.0.5_0/scenes/)

And there! Code!

If this doesn’t make sense, sorry. :slight_smile: It’ll only work if you own the games on Google Chrome, and this is how I do it on a Windows 8 PC. Other Windows versions might be different.

6 Likes

I know this thread is old, but the method described here is not working for me…

How do I see the code for my game?
https://dl.dropboxusercontent.com/s/d8y63t3wvpbwfc9/Element.htm?dl=0

Replacing Element.htm?dl=0 with scenes/startup.txt gave me an error.

It’s a newer game? Is it compiled? If so then it’s like it’s all wrapped up in a box so we can’t use the above method to look at the code.

If it’s compiled as that game is, the best you can do to get the lines is to load the page, open your web browser’s console and type in: allScenes[“startup”].lines.join("\n");
Then hit enter.

This will output all the lines of that scene into the console, which you can then copy out into a text editor.
Of course you can replace “startup” with the name of any desired scene.

14 Likes

I AM SO EXCITED I FOUND THIS

I’m still taking baby steps but I feel much more confident by being able to see how others did this!

3 Likes

@Hell_Satan, how familiar are you with this sort of scripting?

The Choice of Games website has a few good introductions you’ll want to read and understand. The wikis are good too for explaining other techniques you’ll have available. Reading the introduction first is very useful. Most importantly, it gives you a concept of what to look for in a game’s code.

Reading the code of other games that you’re familiar with is a super handy way to find out how the writer accomplished specific things. How did they allow you to create a custom name? How did they move from one scene to the next? How did they track relationships stats, skill proficiency, etc? This has actually been the most useful tool for me so far. What have other people done that you want to do? Find the code and see how they do it!

If the issue is that you’re compiling and receiving errors that you don’t understand, what I do is search the error on the forums; 9/10 times, someone else has solved it.

It’s a lot to figure out, especially if you’re new to thinking like this. It’ll take some trial and error. Luckily, people on these forums tend to be very helpful! So if you bring a specific question to their attention, they more likely than not will be happy to help. :slight_smile:

1 Like

Good luck! It’s a lot like learning a new, vaguely mathematical language. But once you follow the internal logic of what’s going on, I promise you, it gets simpler and simpler. :grin:

I’m confuse… Need to know the codes for Boxhead Bounty Hunter. I tried everything you said, but I can’t find it.

How can I find the coding to this game:
[Removed Link]