I love to look behind the scenes. I wonder how things are done. It seems to me that most people are interested too.
Historically, video games do not share source code. Of course, they are intended for players. But for programmers there is always something to look at. And some games still released their source. And I had long intended to make such a selection.
Unfortunately, almost all games are for PC. Finding sources for consoles or arcades is almost impossible, and most programmers are not aware of the differences in approaches to programs on platforms other than PCs.
')
Many of the games after the release of the source have been improved and supplemented by the community - I deliberately give links only to the original source. So, if you are suddenly interested in upgrades - they may exist.
Many games have been reviewed on
the Fabien Sanglard website . If you are interested in the details of their work, then welcome to him.
You may notice that many games belong to id Software / Apogee. Coincidence? I do not think. id is famous for its openness and habit of releasing sources. Old commercial games no longer have any value and would be lost - is it not better that someone learns something useful based on them?
So let's get started (in chronological order):
Colossal Cave Adventure (1976)

Developer:
William Crowther and
Don WoodsPublisher: Miscellaneous.
Platform: PDP-10 and friends.
“You are in a maze of twisty little passages, all alike.” (“You are in a maze of small, winding passages indistinguishable from each other”).
Perhaps this is not a 100% commercial game. But it was sold, in addition, it has historical importance. And, by the way, precisely based on the name of this game, all adventure games are called adventure.
The original was written in Fortran, which will be difficult for modern programmers to understand. But the latest versions were in C.
Sources:
rickadams.org/adventureCatacomb (1989)

Developer:
John CarmackPublisher:
SoftdiskPlatform: Apple II / DOS
Do not confuse with Catacomb 3D. This is an early two-dimensional version of the game. Designed by Carmack before creating an id and written entirely in Turbo Pascal.
Sources (DOS):
github.com/FlatRockSoft/CatacombPrince Of Persia (1989)

Developer:
Jordan MechnerPublisher:
BrøderbundPlatform: Apple II / DOS / many more
Code review:
fabiensanglard.netPrince Of Persia created a sensation thanks to the smooth animation, Hollywood style of presenting the story and interesting gameplay.
It is written entirely in assembler, which makes it difficult to review the code. I recommend watching the
interview with Jordan Mehner , where he shares the details about creating the game.
Source (Apple II):
github.com/jmechner/Prince-of-Persia-Apple-IISimCity (1989)

Developer:
MaxisPublisher:
Maxis /
BrøderbundPlatform: All
The game began a new genre. The algorithm is based on the simulation of a city by means of cellular algorithms. A good example of code that is worth studying for understanding the principles of operation. Sources for the 1990 unix port were released in 2008.
Sources (Unix version):
weblogs.asp.net/bsimser/simcity-source-code-released-to-the-wild-let-the-ports-beginHovertank 3D / Catacomb 3D (1991)

Developer:
id SoftwarePublisher:
SoftdiskPlatform: DOS
The first milestone in the history of three-dimensional shooter id Software. These games use raycasting technique, which was improved in the next hit, Wolfenstein, where textures were added.
Sources:
github.com/FlatRockSoft/Catacomb3Dgithub.com/FlatRockSoft/Hovertank3DStar Control II (1992)

Developer:
Toys for BobPublisher:
AccoladePlatform: DOS / 3D0
A unique game that does not fit into any of the strict genres. The appearance clearly reminds us of the 90s and the VGA system, where the colors were chosen not for beauty, but from the standard DPaint palette.
I recommend reading the review code from
The Escapist .
The source code was received from the port on 3D0, the original one was lost. This often happens with old games when developers leave the company.
Sources (3D0):
sourceforge.net/projects/sc2/files/UQM/0.1Wolfenstein 3D / Blake Stone (1992/3)

Developer:
id SoftwarePublisher:
Apogee SoftwarePlatform: DOS
Based on the previous Catacomb engine, a serious upgrade to VGA graphics was made. And it became more interesting to play. As in most cases with the id company, the source code is relatively easy to read, although the key parts are written in a 16-bit assembler (you will not see this in Doom).
It is interesting to note that for drawing vertical lines they dynamically generate different functions for each of the possible heights of the walls.
At Fabien, you can find
instructions on how to compile the source for modern tools.
Blake Stone, an offshoot from Apogee on the same engine, was released in 1993, a week before Doom. You can imagine why it has sunk into oblivion.
Sources:
github.com/id-Software/wolf3dSources:
www.apogeesoftware.com/uncategorized/apogee-releases-blake-stone-source-codeDoom (1993)

Developer:
id SoftwarePublisher:
GT InteractivePlatform: DOS
Code review:
fabiensanglard.netIn a sense, this is the most important engine for studying. At one time it was a revolution - the world from the first person, not flat, like Wolf3D. Lighting, textures and deathMatch invention.
One of the most iconic things was the invention of the “engine” idea. Before this game were strongly associated with the data. Doom promoted the decoupling of game data from the engine. This gave rise to entire communities that modified the game (Aliens TC, Fistful Of Doom).
Sources:
github.com/id-Software/DOOMDescent (1994)

Developer:
Parallax SoftwarePublisher:
Interplay ProductionsPlatform: DOS
Many companies rushed to catch up with Doom, launching a wave of "Doom Clones." Parallax managed to do something completely different.
In the game, it was possible to fly a ship through a three-dimensional maze of aisles, in contrast to the 2.5D Doom corridors (in id, full three-dimensionality appeared only in Quake a year later).
Sources:
www.codersnotes.com/files/gamesrc/d1srcpc.zipGravity Force 2 (1994)

Developer: Jens Andersson and Jan Kronqvist
Publisher: Shareware
Platform: Amiga
Many contemporaries will remember this game. Amiga Power once called it the second best game of all time.
This is not a completely commercial game, it was released on the principle of paid shareware, and then it was distributed free of charge on the Amiga Power disc. Included it in the list because at that time in general rare games gave out their source code. If you are interested in how 16-bit games were made, pay attention.
Also do not miss the
interview with the authors of the game .
Sources:
www.lysator.liu.se/~jensa/gf2Heretic / Hexen (1994/5)

Developer:
Raven SoftwarePublisher:
id Software /
GT InteractivePlatform: DOS
It was a unique Doom clone for two reasons: 1) a licensed Doom engine and 2) good gameplay
Noticeable improvements: the ability to look up and down scripting engine for in-game events (a new idea at the time).
Sources:
sourceforge.net/projects/hereticRise Of The Triad: Dark War (1995)

Developer:
Apogee SoftwarePublisher:
Apogee Software /
FormGenPlatform: DOS
ROTT it was a strange game. It was generated by the Wolfenstein 3D engine, while the creators managed to emulate the sensations of different heights. But still the game could not compete with Doom from 1993.
Sources:
www.codersnotes.com/files/gamesrc/rottsource.zipMarathon 2: Durandal (1995)

Developer:
Bungie SoftwarePublisher:
Bungie SoftwarePlatform: Apple Macintosh / Windows 95
The series is distinguished by the fact that in its time it hit the extremely small list of games available on the Apple Macintosh. And, in general, this is a clone of Doom. And 3 months after its release, id Software released the famous “qtest”, which allowed to look at the Quake engine.
Since Macs was then used only by writers with artists, despite their best efforts, the series failed. A small development company had a
good success on various other platforms.
Sources:
www.codersnotes.com/files/gamesrc/marathon2_src.tar.gzDuke Nukem 3D / Shadow Warrior (1996)

Developer:
3D RealmsPublisher:
GT Interactive SoftwarePlatform: DOS
Code review: fabiensanglard.net
Of the many clones, 3D Realms games have distinguished themselves by good attempts to bring something new into the game. The Ken Silverman engine of the
Build Engine has added many interesting features such as sloping floors, rooms located above each other and mirrors.
Unfortunately, unlike the game itself, the source is just awful. I rummaged through them several times and still can not figure out what's where. Fortunately, the
review from Fabien sheds some light on what is happening in the code.
For more information, refer to the page of the author.
Duke Nukem 3D / Sources:
www.codersnotes.com/files/gamesrc/duke3dsource.zipShadow Warrior / Sources:
www.codersnotes.com/files/gamesrc/Shadow_Warrior_1.2_Source_Code.zipBuild engine / Sources:
advsys.net/ken/buildsrc/default.htmQuake 1/2/3 (1996-1999)

Developer:
id SoftwarePublisher:
GT Interactive /
ActivisionPlatform: DOS / Windows / others
Code review:
fabiensanglard.net (Quake 1)
Code review:
fabiensanglard.net (Quake 3)
There is nothing special to write, you yourself know everything. Notable milestone in the creation of a fully three-dimensional engines, without any hacks like 2.5D
I will mention some interesting details. Perhaps this is the first commercial game compiled with an open source compiler (DJGPP for DOS, early gcc port).
The game had its own scripting language “Quake C” (later on lcc for Quake 3). It was built specifically to allow players to make modifications. This, coupled with the PWAD resource system, gave rise to a huge community of modders.
Quake 1 had an innovative shading results caching mechanism. But after the spread of 3D accelerators, it lost its meaning. The next game from id, Rage, used the same idea.
In addition, Quake was a very reliable engine. No raster glitches or collision calculations.
Quake / Sources:
github.com/id-Software/QuakeQuake 2 / Sources:
github.com/id-Software/Quake-2Quake 3 / Sources:
github.com/id-Software/Quake-III-ArenaAbuse (1996)

Developer:
Crack dot ComPublisher:
Electronic Arts /
Origin SystemsPlatform: DOS / Linux / Mac
I love Abuse.
The game has used several innovations. Cool control system at the same time with the mouse and keyboard. Dynamic lighting (an unheard of thing for platformers).
But most of all, as a programmer, I liked the “visual Lisp” system. The whole game is scripted in a language resembling Lisp. The behavior of enemies can be changed during the execution of the game, and not just included in the code.
Another interesting point was the way in which events can be connected in the built-in map editor - visually drag lines from the switch to the door, or from a trap to the place where enemies appear. There is an opportunity to set the logic AND / OR in the form of hidden objects on the level. This I have not seen in other editors.
The game did not earn commercial success, and in two years the source code was published. The next game from Crack Dot Com, Golgotha, was released on an open-source basis, including all graphics.
Abuse / Sources:
www.codersnotes.com/files/gamesrc/abuse_pd.tgzGolgotha ​​/ Sources:
abuse.zoy.org/wiki/downloadAliens versus Predator (1999)

Developer:
RebellionPublisher:
Fox Interactive /
Electronic Arts /
Sierra On-LinePlatform: Windows / Mac
What a relief to see a shooter here not id authorship. Although there wasn’t much technical innovation in the game, the single-campaign came out amazingly. And the game remains a good example of the engine not from id.
Sources:
www.codersnotes.com/files/gamesrc/avptools.zipFreespace 2 (1999)

Developer:
Volition, Inc.Publisher:
Interplay EntertainmentPlatform: Windows
As if the heir to the Descent franchise, but not quite. Campaign and multiplayer are completely in outer space.
A great example of how the publication of the source extends the life of games for years. For the game all sorts of sets of new content and upgrades are released.
Sources:
www.codersnotes.com/files/gamesrc/fs2source.zipThe Operative: No One Lives Forever (2000)

Developer:
Monolith ProductionsPublisher:
Fox Interactive /
Sierra Entertainment /
MacPlayPlatform: Windows / Mac / PlayStation 2
The LithTech engine has a long history, although it is in the shadow of the more famous Quake and Unreal engine. I especially did not rummage in the NOLF source, but I suspect that there are only the sources of the game itself, but not the graphics engine. And definitely there will not be parts associated with the work on the PlayStation 2.
It's a pity - the development for PS2 today should look like an alien thing for programmers, since it was much more suited to the data orientation method than modern APIs do.
Sources:
www.codersnotes.com/files/gamesrc/NOLFSource003.zipMechCommander 2 (2001)

Developer:
FASA InteractivePublisher:
MicrosoftPlatform: Windows
Historically, Microsoft and open source together did not get along. But in his declining years, the situation begins to soften. Still, it's nice to see that large companies come to more open views on things - all these developments have zero commercial value, they are only historically valuable.
Last year, the source code for the earlier versions of MS-DOS and Word was even released, which was unheard of about 30 years ago.
Sources:
www.microsoft.com/downloads/details.aspx?FamilyID=6d790cde-c3e5-46be-b3a5-729581269a9c&DisplayLang=enDoom 3 (2004)

Developer:
id SoftwarePublisher:
ActivisionPlatform: Windows / Mac / Linux / Xbox / PS3
Code review:
fabiensanglard.netIf you want to explore the engines of modern high-end games, then Doom 3 is one of the best examples. At the time of release, he was innovative in many areas. The method of using high-resolution models on the elements of low resolution in the game is now the standard for commercial games. The source has a lot of interesting things - only one physics processing system is worth exploring, in particular, collision tracking.
This is the first game from id, written in C ++. Past games due to the use of C carried the simplicity. Doom 3 is also quite simple, but its movement vector change is already noticeable.
Also, the game is (sadly) known for using stencil shadows when calculating lighting. One can argue whether it was an interesting experiment or a field for further work, but today's games prefer to use shadow maps. Perhaps this technique ever come in handy.
An excellent
review of the code from Fabien Anglard is worth reading.
Sources:
github.com/id-Software/DOOM-3BFG edition Sources:
github.com/id-Software/DOOM-3-BFGGish (2004)

Developer:
Cryptic SeaPublisher:
Chronic Logic /
StardockPlatform: Windows / Linux
Gish was notable for soft-body physics and an interesting approach to time. It is interesting to understand its source code and find out how it works. There are no external physical engines here.
Interestingly, the game is completely written in C - now it is rare. This is not the tidiest source I've ever seen, but this is a good example of how a game may not turn into a giant sprawling code base with hundreds of external dependencies.
Sources:
www.crypticsea.com/download/gishsource153.zipCanabalt (2009)

Developer: Adam Saltsman
Publisher: Semi-Secret /
Beatshapers / Kittehface
Platform: Flash / iOS / PSP / Android / Ouya
Not the most difficult game, so what? If you want to learn how to make games, start with a simple one - just with this.
Prototyping took 5 days, porting to iOS - 10. An example of turning a simple idea into a worthy expression. This is like the return of the 8-bit era, when new genres could appear weekly. It is a pity that since then people prefer to clone ideas rather than create on their own.
Canabalt shows how things can be done easily, if you want.
Sources:
github.com/ericjohnson/canabalt-iosComments:
blog.semisecretsoftware.comWhat did i miss
Need to mention a few more games. They did not release the source code, but underwent fan reverse engineering. This, of course, is not the same as the real sources, but it can also be interesting:
Another World -
fabiensanglard.net/anotherWorld_code_review (and a
great interview on the subject of game creation)
Heart of the Alien -
hota.sourceforge.net (previous sequel)
Strike Commander -
fabiensanglard.net/reverse_engineering_strike_commander/index.phpLittle Big Adventure -
code.google.com/p/twin-eDo not hit the rating
Sorsy following games flowed into the network illegally, so they did not get into the hall of fame:
Half Life 2
Falcon 4.0
ReVolt
Turrican III
Mr. Nutz: Hoppin 'Mad
Trespasser (okay, here’s
a code review )