What's a good Open Source game to learn from?

| | August 11, 2015

I want to download the source code of an Open Source game, so I can get familiar with game architecture. Does any one know of a game with source code that’s legible, and easily understandable?

After some thinking, I’d like to make a game that can be played on the desktop or an Andriod phone with 2D graphics.

9 Responses to “What's a good Open Source game to learn from?”

  1. Charles Goodwin on November 30, -0001 @ 12:00 AM

    The stand out open source Android 2D platform game is Replica Island.

    The source is on Google Code and the development was chronicled in the author’s dev blog.

    Here’s a list of 15 open source games for Android which could also be useful to look at.

  2. I think perhaps a good approach is to pick a game that you like and check out any open source games like that. The Open source game clones list could possibly help with the last step, a lot.

  3. I’m not sure what type of game you are asking for but there is an opensource game named OpenTTD written in c++. I think you could use it as a good sample.

    some features that make this game unique:

    • It’s an strategy game.
    • It has multiplayer support over internet and local network.
    • It supports translation to other languages through configuration file (which is generated in from raw text files)
    • It is compiled on almost every platform I know.
    • Its project is still alive!
    • It has built-in AI support.
    • Graphical and Musical data are completely customizable through patches.
    • It supports scripting languages to develop custom AI. so you can also read other AI written for this game.
    • It’s relatively large project while it’s easy to read and understand it’s code.
    • It’s based on SDL, and from that point they developed everything from scratch.


    Just today I’ve started reading their code from the beginning. To understand what they’ve written you have to be a decent C and C++ programmer (although their code is well commented)! I mean you have to be a master of both languages since they are using structures from both! so if you are not confident enough about your programming skills don’t even go near that code! that’s the dirtiest code I’ve ever seen! (and I’m a dirty coder myself but they are something else!)

    I think now I can suggest you check supertux code. it’s a platformer game (just like super mario) and so far their code seems really clean (I’ve checked milestone 1.3). they have some comments in that code but only for places that you might get confused.

  4. Richard Marskell - Drackir on November 30, -0001 @ 12:00 AM

    I think one of the most important things you can do is choose a game that you enjoy playing. This will help keep you interested in it and will make you more familiar with how the code itself translates into the players perspective.

    Once you’ve picked that game, regardless of how big it is, you don’t have to try to figure out how every line of code works. Pick a piece of it and look at that. For example, try to figure out how player data is stored or how a menu item is drawn, etc.

    The next thing you can do, which goes along with my previous bit, is try to change something. Not something huge (at first), just something simple and noticeable in game. Even something as simple as the text on a button on a menu or adding a menu item or changing damage calculations. Maybe you think they should have done something differently, try to change it yourself.

    When I first got interested in developing games, I was really into 2D online RPGs. So I found the source for one online and I started building onto it. Adding my own features and tweaking things, fixing bugs, etc. That was in VB6 a few years ago and now I’m using C# and XNA and writing my own game from scratch. Because I enjoyed the games, it motivated me to want to work on it, to make it better. Coincidentally, this is also how I learned a lot of the programming, debugging and problem-solving techniques I use today in my non-gamedev related day job.

    It’s also very helpful if the game has a community of modders that you can ask questions and get help and examples from. But then again, even if that doesn’t exist, you’re already here and we’re ready to help.

  5. Even though reading code can be useful, if you’re a beginner in the domain, you won’t learn anything. Especially if you look at the code of big projects like Q3A or OpenTTD. Those were made by an entire team, with each person having different coding practices, different ideas on how to make things. You’ll only get the big picture, not the small details that make everything stick together.

    Develop, fail, try again until you find something that seems to be good, fail again, rinse and repeat until you have something good. Different developers means different ideas on how to implement stuff. Just because it has been coded by Carmack/Any famous developer that has made a good game doesn’t mean it’s the best thing since sliced bread, and a different implementation might be clearer and faster.

  6. The Scrolling Game Development Kit 2 allows you to actually create 2D games and play them using a GUI without writing code. But it also allows you to see and edit the code that is embedded in the project that represents the framework/engine behind the game. Most of the code is exposed via the GUI, although a small portion of it is generated code based on where you place sprites and what maps you create. However even this code is visible if you generate the project and then open the resulting files in Visual C# Express. The entire program (IDE) itself is also open source. It’s build on the OpenTK library (which it uses for interfacing with OpenGL from C#), which is also open source.

  7. Have a look at penumbra. It looks like a great place to learn from.

  8. I recommend you first narrow your focus about what type of game architecture you are interested in learning about– 3d pipeline, physics, AI, etc.

    With a generic request for a good example of game programming, I think space invaders gl is hard to beat since it has clean code and open gl game play and interface while keeping things fairly simple.


  9. There’s mainstays like Quake 3 or if you want something a bit simpler (and in 2D) look at the indie game Gish. They both use OpenGL and are cross-platform too.

    Gish is a little on the messy side, though.

Leave a Reply