70

This question has been preserved for historical reasons, but it is not considered on-topic, so don't use it as an excuse to post something similar.

More info at https://stackoverflow.com/faq.


For me to read code and learn, not to play...

...of course ;-)

Community
  • 1
  • 1
Marcin K
  • 751
  • 1
  • 8
  • 13

55 Answers55

70

Quake (1,2 and 3) and DukeNukem 3D source code is available under the GPL.

Michał Piaskowski
  • 3,800
  • 2
  • 34
  • 46
  • Although originally commercial, the fact that these games are now released under the GPL make them the best open source games. Ever. You can't compete with Quake. You can't compete with what it means. – Vicent Marti Oct 22 '08 at 20:00
  • 12
    Just a quick "legalese" comment: the source code of the "game engines" for these games is open source now. The graphics, maps, characters, story, etc. are still proprietary copyrighted items. If you want to play them, you have to either use the files provided with the shareware version or buy it :( – Joe Pineda Oct 22 '08 at 21:21
  • Agreed, but for learning games programming, these sources are invaluable! – Gary Willoughby Oct 23 '08 at 17:25
  • Another thing you can learn from these is historic, how they managed to get it to work on the hardware of the day. – Brad Gilbert Oct 24 '08 at 16:30
  • 3
    Although being good games this doesn't mean the code is readable and good to play with. It's also heavily optimized, that will bring you some headaches in understanding the real inner workings. Anyway, if you like the procedural approach in games you'll be pretty much satisfied with it. – Manuel Jan 02 '09 at 17:28
  • Agreed, can't beat quake. Try OpenArena for a fully free package, and ioquake3 for a somewhat modernized version –  Jan 06 '09 at 07:15
67

If part of the reason for open-source code is for code to be reused and recycled as it evolves, then I think influence and legacy would be two large factors in this decision. On this basis, I would probably vote Rogue / Hack / Nethack. It was one of the seminal influences behind the hack-and-slash dungeon-crawling genre, living on today in thriving communities that still play these old ASCII games, as well as having a significant influence on some of the most popular graphical games of all time, such as Diablo and Diablo 2.

Epaga
  • 38,231
  • 58
  • 157
  • 245
HanClinto
  • 9,423
  • 3
  • 30
  • 31
  • 1
    Don't forget the Moria/Angband development tree. – David Thornley Nov 14 '08 at 21:41
  • 5
    And Nethack has a a lot of technology in the code. UI abstraction layer, serialzation, domain specific data description language with a compiler, etc. – Darron Jan 06 '09 at 18:26
  • 3
    And remember the reason it's called NetHack is because it was one of the first programs written collaboratively over the net. It was so new that deserved a special distinction in the name! – ilya n. Jun 21 '09 at 08:57
  • I think you can put MUDs in that tree as well: multiplayer realtime Internet text adventure game. CircleMUD has very good documentation and I started with that a few years ago: http://www.circlemud.org/ – karlphillip Oct 18 '11 at 16:47
46

Battle for Wesnoth

That said, you can devote some time reading http://en.wikipedia.org/wiki/List_of_open_source_games

It also depends what exactly do you want to learn... For instance there is an annual competition for games written in Pygame

Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373
37

What about OpenTransportTycoon? :) Come one people - that's got to be the best!

http://www.openttd.org FTW! ;)

Israr Khan
  • 199
  • 1
  • 4
  • 12
  • 1
    the best ever, now only if they could create good API for programming your own bots. – lubos hasko Nov 14 '08 at 10:47
  • 1
    ..They've come close with NoAI now. oTTD is an interesting read, I've been able to learn a fair bit just by reading the oTTD source code. – Sukasa Mar 03 '09 at 19:39
31

How about FreeCiv?

Thomas Owens
  • 114,398
  • 98
  • 311
  • 431
  • One problem I have with FreeCiv is it doesn't run smoothly on older hardware. Otherwise I love it. – Brad Gilbert Oct 24 '08 at 16:31
  • I've got a really really old original Pentium running BSD that I run Freeciv on, it runs fine, except for the graphics in the client, the window is too large to fit on my older resolution monitor. So, i can't see the tabs on the bottom. – stephenbayer Nov 14 '08 at 21:26
  • Try the trident tileset for older computers. Should work fine. – u0b34a0f6ae Mar 10 '10 at 21:28
31

Check out Kenta Cho's games: http://www.asahi-net.or.jp/~cs8k-cyu/index_e.html. Most of them are written in D and use Simple DirectMedia Layer.

They're a lot of fun and the source is extremely readable - a great showcase for the D language.

Torus Trooper screenshot:

alt text http://images.macworld.com/images/legacy/images/content/torus.jpg

Corbin March
  • 25,526
  • 6
  • 73
  • 100
25

There is a very good text based role playing game called 'make', you are on a quest to find hidden dependancies guarded by bearded sages and wrestle patches from them.

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
20

Robocode is pretty awesome. See also its entry at Wikipedia.

Martijn
  • 6,713
  • 3
  • 31
  • 38
16
. . . . . . . . . .
. . . . S . . . . .
. . * . . . . * . .
. . . . . . . . . *
. * . . . * . . . .
. . . . . . . . . .
. . . E . . . . . .
. . . . . * . . . .
. . . . . . . . . . 
. . . * . . . . . .

This one... the original Star Trek. PDP11 rulez! :)

Kevin Little
  • 12,436
  • 5
  • 39
  • 47
16

alt text http://sc2.sourceforge.net/screenshots/melee2.png

Ur Quan Masters - Star Control 2 update.

jle
  • 9,316
  • 5
  • 48
  • 67
  • Just wanted to say this is *excellent*. The feel of the space combat is spot on. – Alex Sep 05 '09 at 14:10
  • Excellent game. This screenshot perhaps doesn't do it justice; Star Control II is often rated one of the best games ever (http://en.wikipedia.org/wiki/Star_Control_II#Accolades). – Josh Kelley Jan 25 '10 at 01:57
12

I'd have to go with GNU Chess.

If you're really interested in looking at the code. From the wiki: "Version 5 was essentially a complete rewrite from scratch of GNU Chess to eliminate spaghetti code and replace antiquated data structures with more advanced computer chess implementation techniques."

Aaron Palmer
  • 8,912
  • 9
  • 48
  • 77
11

I can't believe Hunt the Wumpus hasn't been mentioned.

Or Star Trek?

Michael Burr
  • 333,147
  • 50
  • 533
  • 760
10

two words: Frozen Bubble.

Chad
  • 2,064
  • 1
  • 22
  • 29
9

My personal favorite is UFO Alien Invasion. I loved the original UFO and this is a really good clone.

Mnementh
  • 50,487
  • 48
  • 148
  • 202
8

What? No one here likes Tux Racer?

I just LOVE that game!!! It's fast paced and can run on almost any decent modern computer (no need for expensive video cards). And it runs on Windows, too!! Furthermore, it demonstrates that "penguins can fly" (and even surpass speed of sound :P)

Joe Pineda
  • 5,521
  • 3
  • 31
  • 40
8

No question in my mind, GL Tron. How can you not love it?

http://en.wikipedia.org/wiki/GLtron

jeph perro
  • 6,242
  • 26
  • 90
  • 124
7

Jagged Alliance 2

Its source code was released in 2004 (I think) and since then it has been improved very much by the mod community. The mod goes under the name JA2 v1.13 and the community resides at Bear's Pit.

P.S. For reading and learning from the code, this might not be the best project. It's old C code with many functions spanning hundreds of lines. Unless you want to learn how to work with legacy code, playing it is more fun. ;)

Esko Luontola
  • 73,184
  • 17
  • 117
  • 128
  • Jagged Alliance 2 would be a good start if you want to practice your review skills. – mbx Aug 23 '11 at 19:01
5

well....

If you'r into Flight simulators the definitively check out Free Space just can

http://scp.indiegames.us/

There are also tons of mods... a very nice one is on the battlestar gallactica universe where you actually fly the viper mark VII

http://www.game-warden.com/bsg/

have fun... errr, of course, where's my head...

happy code reading ;-)

Newtopian
  • 7,543
  • 4
  • 48
  • 71
5

If your intent is to see how a game works and are willing to spend a small amount of money to see it, I highly recommend the Torque Gaming Engine from GarageGames. For $150 you get the entire engine source code of a AAA game title (Tribes 2). The content was ripped so you aren't buying Tribes 2, but content is easy to replace. Compared to the cost of other comparable engines, Torque is an amazing bargain. And if you ever decide to produce a game, you can do so without overbearing licensing restrictions.

EDIT: I know its not Open Source, but for your purpose of learning code it should qualify. The engine is coded in C++ and there is a script layer that is similar in syntax to C#/Java.

Chris Porter
  • 3,627
  • 25
  • 28
5

alt text http://www.classicempire.com/emlogo.jpg

Empire, the Wargame of the Century, naturally. You can download it from classicempire.com. Empire has been flunking out students and wrecking marriages since the 1970's.

Walter Bright
  • 4,277
  • 1
  • 23
  • 28
  • anything that can get this has got to be good: http://www.classicempire.com/epyx.html – BCS Dec 03 '08 at 17:39
5

Sauerbraten Very nice FPS

GvS
  • 52,015
  • 16
  • 101
  • 139
  • 1
    also the code is extremely elegant and clean, a master piece of software development. – levhita Nov 14 '08 at 20:43
  • The code follows a certain philosophy and really does well in being minimalistic. It's actually a great piece of code if you wish to see how clean and elegantly optimizations can be done. – Hakkar Feb 24 '10 at 03:01
4

Wormux really has a fantastic architechture. i'm a professional game developer and i think that these guys really might be too. the quality of the work smells of years of game dev experience.

DavidG
  • 1,796
  • 4
  • 21
  • 33
4

It's got to be either Rogue

Rogue Screenshot http://upload.wikimedia.org/wikipedia/en/a/af/Rogue_Unix_Screenshot_CAR.PNG

or Empire I've invested (lost) so much time in both of those.

John Gietzen
  • 48,783
  • 32
  • 145
  • 190
Denis Hennessy
  • 7,243
  • 4
  • 25
  • 31
4

I've spent many hours playing FreeCol (a clone of Sid Meier's Colonization).

I mean "studying the source code of FreeCol".

JPLemme
  • 4,374
  • 6
  • 31
  • 35
4

Quite recently a few of the games from the Humble Indie Bundle went open source and are probably pretty interesting for people to look into. Gish, Lugaru, and Penumbra were all opened.

http://www.wolfire.com/humble

Tyler
  • 1,377
  • 1
  • 11
  • 18
3

Dopewars is fun to play on the internet or on a LAN with friends. And it runs on Windows, OSX, Linux, iPhone and there is an adaptation on Facebook.

Adam Bellaire
  • 108,003
  • 19
  • 148
  • 163
Pascal Paradis
  • 4,275
  • 5
  • 37
  • 50
3

Depending on what platform you're going for, the XNA guys have a few "starter kits" of ready to build projects, the code is available, but it's not explicitly open source:

http://creators.xna.com/education/starterkits/

user17956
  • 21
  • 1
3

So many games, so little time.

pmg
  • 106,608
  • 13
  • 126
  • 198
2

Hedgewars it's fun, runs smoothly, has nice graphics and everyone who liked Worms World Party will enjoy it.

  To compile and install you need:

  Qt >= 4.4
  FreePascal >= 2.2.0
  SDL >= 1.2.5
  SDL_net >= 1.2.5
  SDL_mixer >= 1.2
  SDL_image >= 1.2
  SDL_ttf >= 2.0
  CMake >= 2.6.0

alt text

alt text

Community
  • 1
  • 1
xadoc
  • 113
  • 1
  • 1
  • 6
2

Warsow, obviously.

It's a FPS, technically advanced as Quake 3, open source, with nicely documented code and a great community.

friol
  • 6,996
  • 4
  • 44
  • 81
2

I can't believe, nobody mentioned Armagetron Advanced yet!

For fans of the movie Tron, this is a nice way to waste some time online with other players worldwide.

HS.
  • 2,593
  • 2
  • 20
  • 28
2

Duke3D released their source code. That's the best game ever. Source code is number 15 under duke3d

wusher
  • 12,291
  • 22
  • 72
  • 95
2

A classic: Crowther/Woods Adventure ;-)

Andreas Scherer
  • 171
  • 2
  • 5
2

No shout outs to Angband yet? It went under new "ownership" in March of this year and is still the most addictive fantasty/dungeon style game I've seen. Source is readily available and it is pretty slick to see how a program can still be heavily active after its initial release back in 1993, or even later, if memory serves on its lifetime.

Dillie-O
  • 29,277
  • 14
  • 101
  • 140
2

No one mentioned freedroidrpg yet.

Mnementh
  • 50,487
  • 48
  • 148
  • 202
2

Freespace 2 source code. It is based off of the original Volition Freespace 2 (released as open source). This is production (and thus "battle tested") code and will give you a good look at how shipping titles look (with all of the warts).

You can gain access to the FS2_open source through SVN here:

http://scp.indiegames.us/links.php

Jeff Thompson
  • 2,662
  • 2
  • 18
  • 17
2

I've spent more time with Glubulation 2 Than any other open source game. Its an innovative and fresh variation on the RTS genre.

SingleNegationElimination
  • 151,563
  • 33
  • 264
  • 304
2

Tremulous is a good multiplayer-game.

Mnementh
  • 50,487
  • 48
  • 148
  • 202
1

Completely surprised that FreeCiv didn't get a mention yet. It is truly the best online multiplayer game out there. And I have played it for hours.

As for compiling, you can pick between the SDL client and the GTK client.

Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
1

Distributed by Microsoft MechCommander 2 (good mech game).

gorsky
  • 2,282
  • 1
  • 16
  • 22
1

TeeWorlds alt text

Community
  • 1
  • 1
Tim
  • 19,793
  • 8
  • 70
  • 95
1

And I will add a console-game: Meteora Evolution. It is a homebrew-game for the Nintendo DS and Open-Source.

Mnementh
  • 50,487
  • 48
  • 148
  • 202
1

Gnu-Backgammon.

alexmeia
  • 5,241
  • 4
  • 24
  • 24
1

Torcs, the Open Racing Simulator http://torcs.sourceforge.net/

1

I don't think it counts as "open-source", but I loved QBasic Gorilla.Bas grin I used to edit it to make all buildings disappear when the banana hits the sun; then it's a Banana Free-For-All! xD

I also took the liberty to rename the game QBrian Gorilla to make fun of a friend of mine... Lame, I know, but hey, I was 14. Haha..

QBasic was the first programming language I got into, before later moving on to VB, and then ASP, PHP and VB.Net. Ah, nostalgia... =)

Darkwoof
  • 359
  • 4
  • 14
1

Open Arena, the best of Quake 3 engine, entirely open-source.

rogeriopvl
  • 51,659
  • 8
  • 55
  • 58
0

Do unintentional source releases count? If so, Half-Life 2 and EVE (though it was only the client code)

Chris Porter
  • 3,627
  • 25
  • 28
0

The MMORPG Ryzom was open sourced a few days ago (blog post).

While I'm not that well versed in game programming, paroneayea's comment on reddit makes me think it's worth a look:

It's hard to understate how big of a release this is. The volume of assets here, the size of the codebase.. The fact that anyone can run their own MMORPG server, or contribute back useful assets to make it into the main server!

Honestly I don't think I've been this excited about the freeing of a project since Blender was released as free and open source software nearly a decade ago.

Source code - Media assets

Community
  • 1
  • 1
Etienne Neveu
  • 12,604
  • 9
  • 36
  • 59
0

Global Thermonuclear War (http://en.wikipedia.org/wiki/WOPR) or, tic tac toe

Tim
  • 20,184
  • 24
  • 117
  • 214
0

If you're looking for a very quick C#.NET implementation of the classic Balderdash, check out the Digger source here:

http://www.lutzroeder.com/silverlight/

Nick Gotch
  • 9,167
  • 14
  • 70
  • 97
0

It's clearly AssaultCube ;) a fast and fun first-person-shooter that comes as a 40mb package.

alt text http://assault.cubers.net/pics/main_actioncube.jpg

Written in messy C++ using SDL, OpenGL and OpenAL :P

driAn
  • 3,245
  • 4
  • 41
  • 57
0

GNU Chess is the best. but game play wise people prefer Warsaw first person shooter game.

KnightScott
  • 123
  • 3
  • 10
0

Ubran terror is a great counter strike like game. http://www.urbanterror.info/news/home/

mcginleyr1
  • 11
  • 1
0

Megaroids on the Atari ST. Was the demo application for the Megamax C compiler. Played it in Midres (640x200x4colors). Simple game that have this "one more" spirit.

ThorN
  • 1
0

I played a lot myself at Chromium. Back in 2005 it was ship with Mandrake distribution. All my no-I-will-never-use-Linux-but-only-consider-Windows friends where amazed by its quality, beauty and fast pace style.

Chromium screenshot. A must according to me.

yves Baumes
  • 8,836
  • 7
  • 45
  • 74