PokéBase - Pokémon Q&A
1 vote
51,495 views

RBY, GSC, FRLG, RSE, DPPt, HGSS, BW, BW2, XY, and ORAS

If different versions were written in different languages, please list them all. Also, please do not question my curiosity.

by
edited by

2 Answers

1 vote
 
Best answer

tl;dr Assembly early on, C later on, C++ recently

Since the 2020 Nintendo leaks (most of which I've seen personally), a good amount of this information has been known for certain. I will summarise it here alongside some technical/historical info (which goes 90% of the way to answering this question on its own, short of the absolute certainty that source code offers).

RBY and GSC are written in assembly language. This comes more or less as a necessity -- the Game Boy has very basic hardware where low-level access to memory (in particular, CPU registers) is required to program the console effectively. There would've been C compilers out there writing instructions for the Game Boy CPU, but those would've been worse in the '90s and come with drawbacks, as described by the Game Boy development community:

[C compilers] won't always generate code that runs as fast as skilled, hand-optimized assembly. ... There is overhead due to C being a stack-oriented language, whereas the Game Boy's CPU is rather built for a register-oriented strategy.

If the above is interesting to you, check out the GBDev community's Pan Docs. Here is a guide to Game Boy opcodes (instructions that its CPU understands). There are also disassembly projects for Pokemon Red and Pokemon Crystal, which are generally reflective of the source code and assemble back into working ROMs that you can play on an emulator (for example).

RSE, FRLG, DPPt, and HGSS are written in C (and BW/BW2 likely were as well). This is a higher-level language that compiles down to assembly language, hiding from programmers the ugly aspects of assembly language. The GBA and DS feature less constrained hardware that doesn't care as much about the mild inefficiencies of compiled languages. According to this guide, Nintendo released development kits with libraries and compilers aimed toward C (which, along with C++, dominated game development on handhelds).

Source code for all of the above games except HGSS has leaked, which confirms what we would suspect based on the information above. We also know from the leaks that Game Freak used Ruby and Perl for tools/scripting during development of these games, and that assembly was still used for some purposes (move animations and logic, which surprised me). BW and BW2 have not leaked, but it's basically certain they were written using C or C++ or both.

Decompilation projects exist for Pokemon Emerald and Pokemon FireRed (as well as other games, including Gen 4, though considerably less progress has been made for those). Decompilation is less scientific than the disassemblies of Gen 1/2 games above, as C is yet another layer of abstraction above the binary ROM (but as usual, you can build the code in these repositories back into the real game).

SM and USUM are written in C++ (and XY/ORAS almost certainly were as well). C++ interfaces with hardware similarly to C (which is good, as the 3DS is not a resource-abundant system) but it belongs to the object-oriented programming paradigm, which has become popular in proprietary software development in recent decades.

From the leaks, we know that SM and USUM are built with an in-house game engine called gflib ("Game Freak library"), which is written in C++. Source code for XY and ORAS hasn't leaked (and I haven't seen the SM leak), but nevertheless, I can confidently speculate that those games were built with C++ and gflib as well. People who know more than I do actually say gflib is still being used as recently as Gen 8, so loop Sw/Sh in with C++ as well.

The only exception to the above is BD/SP, which was famously outsourced to a different developer and made in Unity, which is a game engine anybody can use. Unity's runtime is C++, but its API (which is what developers actually use) is made available through C#. Unity games are really easy to reverse engineer; here's a fun video about that if you're interested.

by
selected by
–1 vote

Pokemon RBY were programmed in the era of C and converted to readable Binary, just as most retail level Gameboy games were done before the introduction of C++ and several non-universal "trade secret" coding languages became the norm.

source: decompilation records from old emulator rips.

Edit: just specifying because I wasn't thorough when I stated it earlier. After gen one, game freak was using more advanced writing techniques based off of C and C++, but they are technically trade secrets meant to hinder piracy.

So in short, gen 2 used C and C++ essentials formed the core for the games since, with GF having their in house formative mutation of the software kept in secret for privacy requirements.

I admit, though, that I'm not able to find many margins regarding Gen VI.

by
what about the other games?
See the edit. Sorry for not being thorough
Pretty sure you have no idea how programming languages work. As as a software developer your comment makes zero sense.

Anyhow, Gen1+2 are written in assembly. Gen 3 was in C, gen 4 a mix of C and C++, and as of gen 6 it's C++ all over.
What secret coding languages?