Open source code that can be a good read

Started by
7 comments, last by pyirrlicht 10 years, 6 months ago

I recently read many articles that justify how reading others code is so beneficial. I guess this is a very good skill (reading others code) that I wish to strengthen. So do you guys have any pointers to open source projects that I can read for learning. I have no restrictions on what kind of code I read as long as it is beautifully written code by masters who know what they are doing smile.png. So games, game engines, tools, or any other piece of software that I can read and study in my spare time.

Advertisement

I really love the NGINX source code. It's documented very well but it's a bit too large to start with and not game related.

So that's my suggestion.

I recently read many articles that justify how reading others code is so beneficial. I guess this is a very good skill (reading others code) that I wish to strengthen. So do you guys have any pointers to open source projects that I can read for learning. I have no restrictions on what kind of code I read as long as it is beautifully written code by masters who know what they are doing smile.png. So games, game engines, tools, or any other piece of software that I can read and study in my spare time.

The source for the SFML Game Development book. I'm reading the book now and I really like the code.

A word of caution: the book is NOT for absolute beginners. The authors assume intermediate C++, and use quite a bit of C++11 on top of that.

I like interpreters, so I've enjoyed taking a few peeks into Lua, though I have no desire to read beautiful code, whatever that means.

Okay big link dump coming:

G3D

Designed as an academic game engine, has very clean implementation of concepts and extremely well commented source.

GameCode4

"A Game Engine on training wheels", accompanying the book Game Coding Complete, 4th edition.

GamePlay

A cleanly designed game engine primarily for mobile, includes GUI, physics, sound integration. Simple implementations of complex concepts. Also good study material for beginners.

GraphicsEngine

Layered design, clean implementations of game engine foundations.

Helium Project

Quite advanced, sophisticated foundations including memory management, mathemetics, asset handling, editor application functionality and much more. There's a lot to like but I love this engine's implementation of it's task based main loop and how it integrated into the component system in particular, as well as it's no-overhead serialization & rtti strategy.

OverDose

A beautifully modernized idTech2 based engine.

RBDOOM3-BFG

Cleaned and ported Doom3-BFG code.

OGRE3D

The best commented code I have ever seen. Does an fantastic job demonstrating how a renderer works.

Pixellight

Sadly discontinued 3D framework. Comprehensive & modular.

Horde3D

Small, tight renderer.

SAGE Engine

Simple Academic Game Engine. Getting a bit dated, otherwise would be an absolutely perfect "My First Engine" for beginners. Great tutorial series and documentation.

R5GE

Surprisingly sophisticated game engine despite it's small size. Sadly no longer maintained possibly because it's creator is now employed at Unity.

Torque3D

Torque doesn't deserve it the bad rap it gets. There are some great ideas here--a task based main loop. Nice separation of client and server. The most well integrated scripting engine you will find anywhere. A well designed, versitile, extensible renderer, and still great networking code. It's not perfect as the engine was continuously iterated on since Tribes, but it's gradually moving towards a better and better design.

Torque2D

A 2D fork of Torque3D. Cleaned and simplified a bit.

Wild Magic

One of the most influential books/engines in the industry. A bit dated now. Heavily depends upon the scenegraph, deep class hierarchy, directx 9/ opengl 2.0 level renderer using CG shaders. But some bits are still a great reference like the Physics, Imagics and Mathematics libraries. Also nice if you've every worked with Gamebryo (hey Gamebryo was a *great* engine!).

Edit::

I forgot a couple engines I've enjoyed reading.

First is Hieroglyph3. Accompanies the book "Practical Rendering and Computation with Direct3D 11", but IIRC was Jason Zink's pet project long before that? Has a straightforward, unclutterd implementation of the basics but where it shines is as a reference for the *application* of Direct3D 11.

Lastly, one really oddball pick: the Google O3D plugin, prior to it's Javascript/WebGL port. It's located here in the bowels of the Chromium repository. The easiest way to get at it is with this: svn co http://src.chromium.org/chrome/trunk/o3d/ o3d

Most of the interesting code is in the core/cross directory. It needs the Chromium base, here

svn co http://src.chromium.org/viewvc/trunk/src/base/ base

which is also a great read!

Reading code will only benefit you if you fully understand the language. +1 for ogre. But it fully depends on what you need to learn. Look for patterns within the codebase. Developers adopt very different paradigms within even the same language. Try to understand the design decisions (implications) behind the architecture.

Nice list from xenobrain biggrin.png

I learned a huge part of my initial C++ and game programming skills from reading the original Half Life source code. I actually modded it for over 5 years until I'd read and understood almost the entire code base (they gave out all the server and client game code, just not the engine code and some of the tool code) -- it was a great practical tutor for gameplay, AI, player movement, animation, effects, networking, HUDs, etc... It's pretty outdated now, probably not even standards-compliant C++ seeing it was made with MSVC6... The modern replacement would be the Source SDK.

There's also all the ID software games, with the old quake/doom games all being open sourced.

I dump some of my own engine code here: https://code.google.com/p/eight/source/browse/

...but it's not documented, barely commented, doesn't contain published examples, and uses a lot of low-level C++ tricks, so it's not very beginner friendly. Might be interesting as a kind of puzzle though tongue.png

Thank you all guys for the useful links and ideas. That's a good list of links :).

Allegro - mainly 2D game engine;

Irrlicht - mainly 3D game engine;

wxWidgets - A cross-platform GUI and tools library.

All is very structual and simple for reading, also you can see base of C++ programming and many porting to other develop languages.

This topic is closed to new replies.

Advertisement