PC Games

Orb
Lasagne Monsters
Three Guys Apocalypse
Water Closet
Blob Wars : Attrition
The Legend of Edgar
TBFTSS: The Pandoran War
Three Guys
Blob Wars : Blob and Conquer
Blob Wars : Metal Blob Solid
Project: Starfighter
TANX Squadron

Android Games

DDDDD
Number Blocks
Match 3 Warriors

Tutorials

2D shoot 'em up
2D top-down shooter
2D platform game
Sprite atlas tutorial
Working with TTF fonts
2D adventure game
Widget tutorial
2D shoot 'em up sequel
2D run and gun
Roguelike
SDL 1 tutorials (outdated)

Latest Updates

SDL2 Rogue tutorial
Wed, 29th September 2021

SDL2 Gunner tutorial
Thu, 26th August 2021

SDL2 Shooter 2 tutorial
Tue, 13th July 2021

SDL2 Widget tutorial
Fri, 18th June 2021

SDL2 Adventure tutorial
Tue, 8th June 2021

All Updates »

Tags

android (3)
battle-for-the-solar-system (9)
blob-wars (9)
brexit (1)
code (6)
edgar (6)
games (37)
lasagne-monsters (1)
making-of (5)
match3 (1)
numberblocksonline (1)
orb (2)
site (1)
tanx (4)
three-guys (3)
three-guys-apocalypse (3)
tutorials (8)
water-closet (3)

Books

SDL2 Game Tutorials

Overview

This series of tutorials focuses on creating games using SDL2. The tutorials are split into several parts, to make it easier to understand the steps involved and not to overload the reader with information from the start.

Note: These tutorials assume that you are already familiar with C programming and you are comfortable with advanced topics such as pointers, as well as using Makefiles. You are also advised to follow the tutorials in order, rather than just jumping around as prior knowledge is assumed throughout. You can read more about setting up SDL2 on the API's wiki page: https://wiki.libsdl.org/Installation.

The SDL1 tutorials have moved here. Since these use SDL 1, they are considered out of date and it is suggested you use the SDL 2 tutorials instead.

Purchase

The full source code and assets for all the listed tutorials is available for purchase.

From itch.io

You may purchase the complete set of tutorials (with on-going updates) from itch.io, using the link below.

Directly

It is recommended that you purchase the tutorials from itch.io. However, if you do not wish to create an itch.io account, you can purchase the tutorial bundle directly from this website. If you wish to do so this way, use the PayPal button below. Once your payment has been approved by PayPal, enter the transaction id from the PayPal receipt into the download form below, to download the tutorials.

Download

If you've already paid, you can use the form below to download the tutorials by entering your PayPal transaction id and clicking Download. If you have any trouble, please contact info@parallelrealities.co.uk.

SDL2_Tutorials.tar.gz 41.85MB 1st October 2021

Other

You can also download some of the games created by these tutorials by clicking here.

Creating a 2D shoot 'em up

This tutorial will show how to create a simple 2D shoot 'em up, starting with opening a window, all the way to building a highscore table. If you're new to SDL2, this would be a good place to start.

  1. Opening a window
  2. Drawing the player
  3. Moving the player
  4. Firing
  5. Refactoring
  6. Enemies
  7. Shooting enemies
  8. Enemies fighting back!
  9. Effects and background graphics
  10. Sound and music
  11. Bitmap fonts and scoring
  12. Score pods
  13. Highscore table (Part 1)
  14. Highscore table (Part 2)
  15. Title screen and finishing touches

Creating a 2D top-down shooter

This tutorial will show how to create a simple top-down 2D shooter that we're going to call Battle Arena Donk! Mouse controls will be used extensively throughout.

  1. Reading the mouse
  2. Angles and rotation
  3. Mouse buttons and shooting
  4. Battling enemies
  5. Scrolling the arena
  6. Finishing touches

Creating a 2D platformer

Learn how to create a simple multi-scrolling 2D platformer, code-named Pete's Pizza Party.

  1. Loading and displaying the map
  2. Scrolling the map
  3. Controlling the character
  4. Interacting with entities
  5. Moving platforms
  6. Finishing touches

Creating a sprite atlas

In this tutorial, we'll demonstrate how to create and use a sprite atlas.

  1. Preparing the files
  2. Creating the atlas texture
  3. Creating the atlas meta data
  4. Using the atlas with SDL2
  5. Rotating, scaling, blending, and colour modulation

Working with TTF fonts

In this tutorial, we'll demonstrate how to use SDL2 TTF for text rendering.

  1. Basic font rendering
  2. Creating a glyph atlas
  3. Wrapping, aligning, and typewriter effect
  4. Unicode support

Creating a simple 2D adventure game

Learn how to make a basic 2D adventure game.

  1. Movement and map rendering
  2. Map scrolling and collisions
  3. Loading a map
  4. Entity interactions, part 1
  5. Inventory management
  6. Entity interactions, part 2
  7. Fog of war
  8. Message boxes
  9. Loading the dungeon
  10. The Grumpy Goblin
  11. The Cursed Maze
  12. Vampire Bats!
  13. The Escape Room
  14. Finishing touches

Creating a basic widget system

Learn how to make a widget system, for use with in-game menus.

  1. Basic non-functional menu
  2. Actionable menu
  3. Loading a widget set
  4. Select widget
  5. Slider widget
  6. Text input widget
  7. Control widget
  8. In-game menu
  9. Widget groups

Creating a 2D vertical shoot 'em up

Learn how to create a vertical 2D shoot 'em up, that includes power-ups and enemy attack patterns.

  1. Setting up
  2. Enemy attack patterns (first sequence)
  3. Power-ups
  4. Return fire!
  5. Enemy attack patterns (full sequence)
  6. Bosses
  7. More power-ups
  8. Enemy attack patterns (final sequence)
  9. Finishing touches

Creating a 2D run and gun game

Learn how to create a 2D run and gun game, like Contra, Turrican, and Duke Nukem.

  1. First steps
  2. Aiming, shooting, and ducking
  3. Destroying targets
  4. Enemies
  5. Basic map
  6. Gameplay tweaks
  7. Larger, scrolling map
  8. Player health + power-ups
  9. Keycards, doors, and other solid entities
  10. Adding a quadtree
  11. More gameplay tweaks
  12. Player death + effects
  13. A full level!
  14. Game controller support
  15. Finishing touches

Creating a roguelike

Learn how to create a simple roguelike.

  1. Map generation
  2. First monster
  3. Combat
  4. Adding the HUD
  5. Monsters attacking!
  6. A* Pathfinding
  7. Items and inventory display
  8. Using items
  9. Equipping items
  10. Comparing stats
  11. XP and levelling
  12. Stairs
  13. More monsters, more loot!
  14. Doors
  15. Death and Highscores
  16. Status effects
  17. Saving
  18. Loading
  19. The Mouse King
  20. Finishing touches

Downloads

Binary downloads (Linux + Windows) for some of the tutorials included here:

Mobile site