Create your own games from beginning to end on popular, crossplatform, SDL 2.0

What you will learn

Program your own 2d games using SDL 2.0

Understand the discrete nature of games and the “game loop”

Play sfx & music in your game

Do body body collision detection and resolution

Description

Have you ever wanted to program your own game in C++ from scratch? Do you want to enjoy easy & free multiplatform deployment (Windows, Mac, Linux iOS and Android?). In this course, we will have a basic introduction to programming games in C++ using the SDL 2.0 library. We will use SDL 2.0 to:

  • Get a window on the screen
  • Draw line and rectangle primitives
  • Draw sprites on the screen
  • Use object-oriented principles to manage Sprites and game character data
  • Load and play sounds & music from disk
  • Do collision detection using Rectangles
  • Manage game state & game state transitions using finite state machines

Overview & Motivation

Why use SDL 2.0? Many people opt to go with complete game engines, such as Unity or Unreal Engine 4, to create their games. Unity and Unreal have licensing costs associated with them. Are you prepared to take on that extra cost? What if you can avoid spending that money on the engine and spend it on licensing assets and other resources instead?

What about using a free and open source sound, graphics and input API to deploy your game to all devices? And the freedom to program in pure C or C++?


Get Instant Notification of New Courses on our Telegram channel.


LibSDL lets you do all that. Simple C commands will enable you to load sounds & music, load & display hardware accelerated graphics easily. The simple framework I provide in the code examples here will make it easy for you to get started creating your own games from scratch.

Programming from C++ directly (instead of using an engine) will give you much more control over how things get done inside your game. If you like raw programming and always wanted to see how games like Super Mario Brothers, Dragon Warrior, and other classic NES games would get assembled, try this course!

Many professional & indie games use libsdl already, including:

Robin hood – the Legend of Sherwood, Left 4 Dead 2, Steel Storm, Edna & Harvey, Proteus, Psychonauts, Amnesia, FastForward, Syberia, AwesomeNauts and more.

English
language

Content

Structure of a Game

Game software is complex!
Game loop
The discreteness of the game loop

Setting up SDL

SDL sample program
Installing SDL 2.0 on Windows
Installing SDL 2.0 on Mac OS X
[Part 1/2] SDL 2.0 Barebones Bootstrap/Starter Explained (SDL_Init())
[Part 2/2] SDL 2.0 Barebones Bootstrap/Starter Explained (draw function)

Basic Sprites

CONTENT: Spriting
Installing SDL_Image 2.0
Sprite class data members overview
Sprite::Sprite ctor and image load
Moving the Sprite 1 – Controller class update()
Moving the Sprite 2 – sprite displacement
Moving the Sprite 3 – Sprite::update() (bounds)
Sprite::draw()

Basic game structure using PING: FSM’s & Sounds

CONTENT: Ping
Sound & Music: Loading
Sound and Music: Playback
FSM – finite state machines for game state

Side Scroller game using “Adventures of Dario”

CONTENT: Adventures of Dario
Collision Detection using Rectangles