How To See Other Games' Code


#1

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


Viewing Game Code
How Much Choice is too Much Choice? Per Scene, not Overall
Guns of Infinity
Am I the only one who doesn't replay games?
Guns of Infinity
Viewing Game Code
Editing, modding...cheating?
Guns of Infinity
Guns of Infinity
How do I look at game code
Keeper of Day and Night (WIP - Updated 3/15/19)
Children of the Gods (Important poll #12306)
Save system similar to Zombie Exodus?
Master List: Links for Beginners
Opinions on romance options
Looking at a game's code?
Monsters(WIP)- updated 04/27/17 -Link is updated
Looking for some source code
Samurai of Hyuga Book 2
VERSUS: The Elite Trials — Infiltrate the Elite gods, or turn double agent?
Choice of Rebels Part 1 WIP thread
Rider (New WIP)
Combat Systems in Text-based games--Yea or Nay?
Purchasing from the webstore while a game is on sale?
Walkthrough for Guns of Infinity?
Saving progress through restarts in ChoiceScript
Code diving?
Totem Force [Estimated release: April 4th]
Keeper of the Sun and Moon (WIP)
Sabres of Infinity Walkthrough
What is the right step to make HG or COG games?
What is the right step to make HG or COG games?
Guenevere (WIP)
Choice of Rebels: Uprising — Lead the revolt against a bloodthirsty empire!
Possible to extract choice script from HTML?
Monsters of New Haven High - last update 4/02
Project Legends: The Battlemage (WIP)
Children of the Gods (Important poll #12306)
Kingdoms: Embers In Ashes[WIP] Last Updated Oct. 8(On Hiatus)
Choice of Rebels Part 1 WIP thread
The Lost Heir Trilogy
Zombie Exodus: Safe Haven Discussion Thread 1
(26/03/18 Update!) [WIP] 神龍之土 Land of the Dragon
Guns of Infinity
Choice of Rebels-Uprising Help/Hints
Fallen Hero: Rebirth is released - discussion thread!
A thought on Hollywood Visionary and cisgenderism
Dashingdon: Free ChoiceScript Game Hosting
Fallen Hero update 5 april 2015
Fallen Hero update 5 april 2015
Shepherds of Haven (WIP) [Poll on #3001!]
Choice of Rebels Part 1 WIP thread
Please can someone help me decide if I should have my stats page be super long or try to figure out how to make it several pages?
Battle System on Script
Choice of Robots Bug Hunt [Spoilers Ahoy]
Advice Needed from a Complete Beginner
Knights Templar
Creating a Show/Hide Element
Guns of Infinity(Pt 2)
The Wayhaven Chronicles: Book One (Discussion) FAQ Located on Post 2
WIP: Fallen Hero 2: Retribution - updated 24 march 2019 (SPOILER WARNING!)
Gilded Rails hints
What's the difference between a scene and a vignette?
How To View Code
The Dragoon Saga (Sabres of Infinity, Guns of Infinity, Lords of Infinity) - General Discussion
WIP: Fallen Hero 2: Retribution - updated 24 march 2019 (SPOILER WARNING!)
Dragon Racer (Discussion)
The Seven Heirs of Ophaesia: Part One (WIP) - Nethica Portrait on Post #3407
#2

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…


#3

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/


Can I see the code of the games I bought on my android in the PC? If I buy a game on the PC, can I play it on my android?
Newbie writer questions about statistics?
Interest Gauge - 3 Possible Projects
#4

@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.


#5

@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


#6

@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?|


#7

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!


#8

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


#9

@Samuel_H_Young, since you asked…


Quicktest Error: "It is illegal to fall out of a *choice statement"
#10

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


#11

Wow, that was incredibly useful.

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


#12

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!


#13

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.)

https://chrome.google.com/webstore/detail/thieves-gambit-the-curse/jickpmgeolbdpldfpefcadbjoninpelg - 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.


Any way to read the whole thing?
Seeing game codes
#14

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.


#15

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.


#16

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.


Guenevere (WIP)
Children of the Gods (Important poll #12306)
Guenevere (WIP)
#17

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!


#19

@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:


#21

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:


#22

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]