C++ Games with Source Code
0 AD - RTS Game
2D Tiled Map Editor
Tiled is a general purpose easy to use tile map editor and is free, built with the QT framework. It uses ah XML-based map format and also supports orthogonal and isometric maps.
Advanced Strategic Command - Battle Isle Close
Advanced Strategic Command is a free, turn based strategy game written in C++ and GPL licensed. It is designed to be pretty much like the Battle Isle series from Bluebyte and is currently available for Windows and Linux. ASC can be played both against the AI other human players, using hotseat or PlayByMail. It is also used to run the multiplayer universe Project Battle Planets.
Allegro Low LEvel Game Routines
Allegro is a portable library mainly aimed at video game and multimedia programming, originally started by Shawn Hargreaves for the DJGPP compiler in a mixture of C and assembler. There is also a community website for this at http://allegro.cc with several hundred games.
Angel - Cross Platform Game Prototyping Engine
Angel is a cross-platform 2D game prototyping engine based on OpenGL and C++. It has texturing with transparency, animations using texture swapping at defined intervals, rigid-body physics, text rendering with multiple fonts, particle systems and some basic AI with state machine and path-finding. Plus lots more.
Arx Fatalis - Dungeon Questing
Arx Fatalis is an open source first-person role-playing video game for the Xbox and PC, released on November 2002 by Arkane Studios, a video game developer based in Lyon, France. It was open sourced in January 2011
Battle for Wesnoth- Open Source Fantasy Turn based game
The Battle for Wesnoth is a turn-based strategy game with a fantasy theme. Written in C++, it's cross platform through use of the SDL. You can also run it as a server to host multi-player games.
Bullet - Open Source 3D Physics Library
Bullet is a 3D Collision Detection and Rigid Body Dynamics Library for games and animation. It's free for commercial use, including on the PlayStation 3, and is written in Open Source multiplatform C++ under the ZLib License.
Civilization IV Software Development Kit, which contains the core game
The link goes to the downloads page which includes the Civilization IV Software Development Kit with the core game DLL source code, allowing gamers to completely rewrite or modify their own Civilization world to their heart's content. You will of course need a copy of Civilization IV to play it.
Colliosion Avoidance Code
If you have multiple objects moving around in 2D or even 3D space, like sparrows, it's amazing how the objects never collide. RVO2 is a library that can be used for research and non commercial use. It was developed at the University of North Carolina at Chapel Hill.
Direct3D 9 API Interceptor
By Stanford PhD student Matthew Fisher, this intercepts Direct3D API calls and is used by his StarWars 2 AI to play games very competitively.
DosBox - Dos Emulator
DOSBox is a DOS-emulator that uses the SDL-library which makes DOSBox very easy to port to different platforms. DOSBox has already been ported to many different platforms: Windows, BeOS, Linux, MacOS X...
DungeonHack - Cross Platform Role Playing Game
For Windows and Linux with Mac in the future, DungeonHack is a Free / Open Source Software project to build a Role-Playing Games (RPG) engine. Games that are non-linear with large scale environments using procedural generation, modern 3D graphics, and dynamic, interesting worlds and characters.
eGUI- Simplify Windows GUI Programming with John Torjo's library
eGUI is a library that makes Win 32 GUI development a lot simpler with cleaner code, and no including of windows.h. Plus no message maps needed!
Empire Classic - A Turn Based Game
Empire is a turn based strategy game of global conquest and diplomacy. Originally developed at the Evergreen state college in 1974 where it was called Civilization. It's played on a series of islands scattered throughout a watery world. Note- games are no longer run on the site but source code is available.
Emulator for the Sony PSP
Potemkin is an open source Playstation Portable emulator able to play commercial games. It was released under the GNU GPL License.
Evydron - Open Source 3D MMORPG
Evidyon is a real-time, fast-paced, multi-player online role-playing game. It has a World editor, special effect design tools, dozens of spells, hundreds of custom items, working character models with varying equipment, 150 planned levels of player advancement, chat, guilds, a "Geosid" system to allow ownership of world areas, item marketplace, storyline and history, NPCs, many kinds of monsters.
Explosions using SDL
Written by a Greek Professor Dr. Thanassis Tsiodras, these examples use SDL to show water and explosions in C++ using SDL. They are cross platform and compile with GCC although he has provided precompiled Windows binaries.
Falling Sands Game
This is an implementation of the falling Sands game (as found at http://chir.ag/stuff/sand/ ) in C++ with wx Widgets by developer Owen Piette.
FreeOrion - Open Source Space game Inspired by Masters of Orions
FreeOrion is a free, open source, cross platform (Windows, Linux and Mac) turn-based space empire and galactic conquest (4X) computer game. It's designed and built by the FreeOrion project. FreeOrion is inspired by the tradition of the Master of Orion games, but is not a clone or remake of that series or any other game.
Frqative - Cross platform Fractal Generator
Fraqtive is an open source, multi-platform generator of the Mandelbrot family fractals. It uses very fast algorithms supporting SSE2 and multi-core processors. It generates high quality anti-aliased images and renders 3D scenes using OpenGL. It allows real-time navigation and dynamic generation of the Julia fractal preview.
Glest - Free 3D real-time strategy game,
Glest is an award winning free 3D real-time strategy game written in C++/OpenGL, where you control the armies of two different factions: Tech versus Magic, warriors versus Mages. It's not just a game, but also an engine to make strategy games, based on XML and a set of tools. A few mods already exist.
Learn about C++ by programming a simple text game
The first C++ game programming tutorial uses a simple text game to demonstrate objects, references, vectors, printf and cout.
Lincity-NG - an open source city management game
Based on an earlier C game, lincity-NG is a city simulation game where you are required to build and maintain a city. You can win the game either by building a sustainable economy or by evacuating all citizens with spaceships.
Micropolis- Open Source version of SimCity
Micropolis is the Open Source version of Will Wright's classic game SimCity for Linux by Don Hopkins and the OLPC (One Laptop Per Child) XO computer. The game is written in C++ for Linux with Tcl/Tk scripting engine. Note that EA allows this to exist as Micropolis with their SImCity trademark removed and no mention of SimCity in the source.
OpenClonk - Settlers meets Worms
Clonk is a multiplayer-action-tactic-skill game, described as a mixture of The Settlers and Worms. In a simple 2D antfarm-style landscape, the player controls his crew of Clonks, who are small but robust humanoid beings. The game encourages free play but the normal goal is to build a mine and exploit the earth from valuable resources or fight each other on an arena-like map.
Open Real Time Strategy Game Engine
ORTS is a programming environment for studying real-time AI problems such as path-finding, dealing with imperfect information, scheduling, and planning in a GPL Open Source Real time Strategy game engine. Games are fast-paced and it's ideal for testing real-time AI research. Plus there's an annual programming contest.
Open Source Physics Engine
ODE is an open source, high performance library for simulating rigid body dynamics. It is fully featured, stable, mature and platform independent with an easy to use C/C++ API.
Opencity - A City simulator
OpenCity is a full 3D city simulator game project written in standard C++ with OpenGL and SDL from scratch. It is not a clone of Sim City. It's also an OpenGL/SDL/C++ game programming tutorial. In the resources section, you can find the micro simulators' algorithm, design document, UML diagram and information about other issues.
PixelCity - a Fly through a computer generated city by night
Look for "Procedural City, Part 1: Introduction" down the page. This is the first of 13 articles on writing the code to generate a city (by night) and then fly through it. the 13th article has a link to the code and it's also here, where there's a youtube video of it as well.
QT - Adventure Game Interpreter
QT AGI Studio is a program that allows you to view, create and edit AGI games. This is the adventure game engine used by Sierra On-Line™ to create some of their early games.
Quake II - Updating of the Source Code to Managed
Developer Greg Dooley has taken an existing port of Quake II (by Vertigo software) and converted that to the modern C++/CLI so it can be compiled by Visual C++ 2005/2008.
Quake III Source Code- Ported to Managed C++
Programmer Greg Dooley has ported the C++ code for Quake III to managed code so it compiles under Visual C++ 2005/2008 using the C++/CLI syntax.
Raw Interpreter for Another World
The game Another World which came out in 1991 used a very clever polygon method combined with a bytecode interpreter and was the result of two years of work of a 20 year old Eric Chahi. Fabien Sanglard has developed the Piotr Padkowski's newRaw interpreter which was based on Gregory Montoir's reverse engineering of Eric Chahi's assembly code.
Role Play Dungeon Level Map and Contents Generator
Full C and C++ Source Code for a Windows application for generating Role Playing game maps for dungeons.
Russian Soccer Simulator
Use Google Language translation to view this link in English. It has an article and source code in C++ for a simple soccer simulation. It won an award for best simulator in 2001.
Ryzom Core - Open Sourceed Ryzom MMORPG
Ryzom Core is the open-source project related to the Ryzom Game. It contains the whole code (client, server, tools) used to make the commercial MMORPG Ryzom. Ryzom Core is a toolkit for the development of massively multiplayer online universes. It provides the base technologies and a set of development methodologies for the development of both client and server code.
SFML is a portable and easy to use multimedia API.
SFML is a portable and easy to use object oriented multimedia API written in C++ for Windows and Linux. It has bindings for C, C++, C# and some other languages and includes support for windowing, audio, graphics and networking.
A fork off the TORCS project, Speed Dreams is a cross platform (Windows and Linux with Mac version 95% done) open source Motorsport Simulator with high-quality 3D graphics and an accurate physics engine, all targeting maximum realism.
This is an add-on library for BWAPI, the Starcraft Broodwar API that is used in the Starcraft AI competition. It provides functions for analyzing maps and checking if tile locations are connected and shortest routes in between.
TADS- Designing Interactive Fiction Games
TADS is a freeware programming system that can help you create high-quality interactive fiction. Written in C++ (the latest version), it is available on many platforms including Windows, Linux and Mac.
TORCS - The Open Car Racing SImulator
TORCS is a multi platform car racing simulation that can be platyed as ordinary car racing game, or as AI racing game and as a research platform. It runs on Linux (all architectures, 32 and 64 bit, little and big endian), FreeBSD, OpenSolaris, MacOSX and Windows (32 and 64 bit).
Torque 3D Engine Open Sourced
This will be happening sometime late in 2012, and I'll update this once it's happened. The Torque 3d Game engine is going to be opn sourced under the permissive MIT licence. The link goes to the announcement.
Tron Server to run Google AI Challenge Games
Written and run by developer Daniel Hartmeier, this is a Tron server written in C++ that runs games according to the Google AI Challenge. A C library is provided so that bots can run on your PC and download game maps and send orders to the server. See contest for details of the contest.
UOX3 - Ultima Online Server Emulator
Warzone 2100 - Futuristic RTS with Massive Tech Tree
Warzone 2100 is a real-time strategy game, originally developed by Pumpkin Studios and published by Eidos Interactive. The emphasis is on greater focus on artillery, radar, and counter-battery technologies, more frequent in-game cinematic updates as game play progresses, a massive research tree, as well as a vehicle design system.
Widelands - Open Source Settlers Lookalike
Widelands is an open source (GPLed) real-time strategy game, built upon the SDL and other open source libraries and is under heavy development. Widelands is inspired by and similar to Settlers I & II™ (© Bluebyte).