This is somewhat a coding tutorial / introduction. The best way to learn to code is of course just to actually code. The most fun way to start coding is by writing small little games.
This repository contains various resources for doing exactly that. (It's mostly a work-in-progress at the moment. Just look around what's already there. It might already be helpful.)
Coding games actually covers a lot of topics, like AI, cross-platform, low-level, graphics, audio, networking, and more. Read here why game development is a great learning playground.
With some little coding knowledge, it also makes sense to take existing Open Source games as a base. You can either join their team, or just take the code and extend it for yourself. In any case, the project team people will most likely be very happy to introduce you to their code and help you to extend it by some fun idea of you.
The programming language doesn't really matter that much. Don't be scared about C++. It isn't really that complicated. Or maybe Rust, or Nim, or some of the other newer native languages. Python is of course also a very good starting language. But this tutorial here is not about a programming language comparison. You will find many such comparisons via Google. And many people also have different opinions about it.
- 2D side-based action jump-n-run / shooter game. Remember Commander Keen?
- 2D top-down action / shooter / puzzle game. Like my Robot, original Robot, Zelda, GTA 2.
- Some sort of Snake.
- Some other simple puzzle / arcade game. Like 2048, Minesweeper, Frozen Bubble, Tetris etc.
- Some card game.
- Some turn-based game.
C++ comes with its own standard template library (STL). And you can use all of the C library. However, that only covers some standard structures (string, list, map, set, ...), file IO, and some more. Then, your OS usually comes with its own libraries, for doing anything more complex, like writing GUIs, graphics, sounds, etc. The OS libraries are usually OS dependent and Windows, Linux and MacOSX differ a lot from each other. If you want your game to be runable on many different systems, there are many cross-platform libraries which you can use. Just avoid using anything from the OS libraries directly and use some cross-platform library instead to do graphics, sounds, networking, etc.
Here are some useful ones, for C++.
- Raylib. Very simple, more recent.
- SDL. Very simple, has a lot of functionality, and supports many many platforms. Somewhat low-level, 2D graphics, OpenGL, sound, input event, GamePad support, etc. This is the most famous and often used game library.
- Allegro. Somewhat like SDL, but a bit less features and a bit less often used. It's slightly more high level than SDL.
- GLFW, GLEW. Mostly for OpenGL.
- PhoenixCore. 2D OpenGL based drawing library.
- NanoVG. OpenGL based 2D vector drawing library.
- skia - 2D Graphics Library. Read also here.
- Troll2D (2008). Simple 2D game engine.
- SFML. Multimedia library, system, window, 2D graphics, audio, network. SFGUI or TGUI for GUI.
- Fast Light Toolkit (FLTK). Comes with many GUI widgets.
- librocket
- Picasso graphic (2013)
- Polycode. OpenGL, with Lua scripting.
- Angel2D. Big and powerful. Maybe overkill.
- Torque2D. Big and powerful. Maybe overkill.
- Godot Engine. Maybe overkill.
- Unity or Unreal are the big commercial ones. Maybe overkill. Also not fully open source licences.
- Ogre. 3D graphics rendering engine. Probably overkill for the beginning.
- Proton SDK. Might be overkill.
- Rainbow. Might be overkill.
- ClanLib SDK. OpenGL, GUI framework, network engine, physics, etc. Might be overkill.
- openFrameworks
- Lua. Most famous embedded scripting language, very often used in games. Also very fast.
- Box2D. 2D physics engine.
- OpenAL. For 3D sound.
- Gameplay3D, full framework.
- Qt. This is more for standard GUI application development, not so much for games. You probably don't need/want that for a game. However, in the application development world, this is probably the most important library.
- EntityX. Fast, type-safe C++ Entity Component System. Article 'Evolve Your Hierarchy' covering the theory of Entity Component Systems (ECS).
- Protogame asset management. Protogame itself is Mongo-based. But it has some nice concepts.
- Some GUI frameworks: CEGUI (OpenGL, MIT license), MyGUI (MIT license), OtterUI, Agar, OUI, Turbo Badger, blog post summary, IMGUI, GLIMGUI, GWEN, Guichan
Other relevant non-C++ frameworks:
- LÖVE. For Lua. Examples, more examples, tutorials. Löve itself might be a good base for a C++ framework, too. There are even many extension libraries. Here are some supporting dev software.
- Planimeter's Grid Engine. For Lua. Based on Quakeworld architecture and comes with fully client-side predicted multiplayer (ref).
- Pyxel for Python
- Pygame for Python
- Arcade for Python
- OpenLieroX, my own game. 2D side-based shooter. Read here for more. And then, this is probably a good guideline. Here is the source code on GitHub.
- Commander Genius. Commander Keen compatible clone, i.e. 2D side-based jump-n-run.
- SafeTheRock. Source code on GitHub.
- Teeworlds. 2D side-based shooter, similar to OpenLieroX but aiming is with mouse.
- Secret Maryo and SuperTux. 2D jump-n-runs. Mario.
- Mari0. 2D jump-n-run. Mario + Portal.
- ASCIIpOrtal. 2D side-based jump-n-run puzzle game. Portal.
- Enigma. Puzzle game.
- Craft. Minecraft clone. Simple and small C code base.
- zSILENCER
- OpenClonk
- Mr. Rescue
- The Battle for Wesnoth. 2D turn-based strategy game. Long development history. Quite complex now.
- Xonotic (earlier Nexuiz). 3D FPS. Big project, so you should bring at least medium experience already, but still, developing a new game mode or so might not be too hard.
- Destination Sol
- space-shooter.c. simple and pure C. also see its architecture
- pacman.c
See also these lists:
You can create your own graphics and sounds. Some useful tools:
- sfxr for creating sounds. bfxr (Web version).
- SunVox for sound
- LMMS for creating music.
- SoundHelix for algorithmic random music.
- Gimp for graphics. Might be too powerful, though, because most likely, you just want to create pixel graphics.
- GrafX2 (old homepage), bitmap paint program
- Pixel image editor
- MyPaint graphics application
- Pinta, drawing/editing program modeled after Paint.NET.
- Aseprite (GitHub), animated sprite editor & pixel art tool. Seems to have become comercial now.
- Tiled map editor
- Tile studio
- Toast Editor, web-based level editor
- Overview for Pixel Art Programs
- 2D game art for programmers blog
There are some useful existing resources you can use:
- OpenGameArt.org. And this. See also. Nice one, some more.
- Freesound.org
- Glitch the game
- Oddball's small offerings. Font, characters, tiles, items.
- Coding for absolute dummies (in German) (by me), tries to explain the very basics of programming, the idea of an algorithm and such
- Trivial C++ console catch-me game (in German) (by me). You develop a very simple catch-me-if-you-can C++ console sort-of game step by step.
- 40 game development tutorial overview
- Game Programming in C and C++
- SDL / Game Programming tutorial
- OpenGL Programming Wikibooks
- OpenGL / Game programming tutorials
- OpenGL tutorial
- Aron's SDL tutorials
- GameDevGeek
- Game from scratch in C++ and SFML
- What every programmer needs to know about networking, The Quake3 network model, The Unreal networking architecture
- Handmade Hero. Screen recordings of the full development of a game, over 600 days.
There are a few game coding competitions, where you have to code a full small game in a very short time, like 24 hours, or 72 hours, or maybe a week.
- Ludum Dare. This is probably the most famous competition. The creator of Minecraft, alias Notch, as often take part here.
- more on Wikipedia
- How to get the most out of a Game Jam
Some developers, such as Notch, sometimes make their coding screencast publicly available. This is often very entertaining and rewarding to watch. You will most probably learn a lot. And you will see how other developers are developing a small game in a short time.
Many developers write some post mortem about their development during such competition. This is interesting because it shows you what tools to use to develop a fun game in a short time period.
- Ludum Dare 27, 10corp. C++11, SFML, custom framework SSV.
- Ludum Dare 29, N.A.M.E.. C++11, SFML. Code on GitHub.
- Ludum Dare 28, BlockDodger. C++, SDL, OpenGL, GLEW, GLM, FreeImage.
- Ludum Dare 28, incomplete source on GitHub. C++, Lua, EntityX.