Fundamentals of 2D Game Engines with C++ SDL and Lua
4.6 (367 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,652 students enrolled

Fundamentals of 2D Game Engines with C++ SDL and Lua

Learn game development fundamentals with a simple 2D game engine and create one from scratch using C++ SDL and Lua
4.6 (367 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
1,652 students enrolled
Last updated 3/2020
English
English [Auto]
Current price: $121.99 Original price: $174.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 10.5 hours on-demand video
  • 14 articles
  • 20 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • C++
  • Object-oriented programming
  • Game engine architecture
  • SDL library
  • Embedding Lua scripts inside C++ applications
  • 2D game development
  • Game Development Fundamentals
Course content
Expand all 53 lectures 10:48:54
+ Introduction
1 lecture 09:11

This session covers the expectations and the learning outcomes of our course.

Preview 09:11
+ Dependencies and Project Structure
10 lectures 01:08:09

This session goes over the project dependencies and environment setup for Linux, MacOS, and Windows.

Project Dependencies
13:34

Let's quickly talk about our options to edit our course source code.

Choosing a Code Editor
00:38
Additional Links and Resources for Windows
00:41

Let's review our initial folder structure and the project tree.

Files and Folder Structure
10:01

Let's create a Makefile to help us build our project.

Makefile
14:56
Quick Makefile Remarks
00:26

This is a quick walkthrough to go over the steps on how to install MinGW, SDL, and Lua under Windows.

Windows MinGW Installation
27:04

Attached is a resource with the Makefile that works for most Windows students.

Makefile for Windows using MinGW
00:12

Some students complained about a MinGW bug when using std::to_string function. Here is an alternative.

MinGW Error std::to_string
00:19

Let's try to build the project and see if all the dependencies are correctly installed.

Activity: Building the Project
00:16
+ Game Loop and Time Step
5 lectures 01:38:00

Implementing a very basic game loop.

The Game Loop
51:19

Making sure your game loop works with a consistent time step.

Fixing the Time Step
25:22
Using a Delay Function
08:09

Using the GLM to work with mathematical structures.

Using GLM to work with Vector2 values
08:49

This session reviews the flow of SDL rendering, including the idea of double buffering.

SDL Rendering and Double Buffering
04:21
+ Entity-Component Implementation
7 lectures 01:21:05

Here we cover the fundamentals of an entity-component game engine implementation.

Preview 16:11

Creating the headers for Entity and Component classes.

Entity and Component Prototypes
07:22

Creating the implementation for Entity and Component classes.

Entity and Component Implementation
30:55

Let's add a new function to add components and learn more about using C++ templates.

Working with C++ Generics
14:35

Just a generic cup...

Just a Generic Cup
00:07

Let's check if our entities and our components are running correctly.

Entities and Components in Action
09:37

Activity: Write a simple function that lists all entities and components that were added to our game.

Activity: List All Entities
02:18
+ Sprites and Animations
6 lectures 01:24:09

This session reviews the fundamentals of working with SDL sprites and images.

Sprites
06:20

Let's create an asset manager that holds the textures of our project.

Managing our Assets
21:35

Implementing a new component to work with Sprites.

The Sprite Component
17:10

Activity: Write a function that checks if a certain entity has a component of a given type.

Activity: Function HasComponent
05:46

Implementing sprite animation.

Animated Sprites
31:08

This session shows how we can have an animation that contains several frames.

Example of Animation with Several Frames
02:10
+ Handling Keyboard Input
2 lectures 29:07

Let's create a new component that allows some flexibility for keyboard input.

The Keyboard Control Component
28:56

Let's write a couple of tests to keep the main player inside our game window.

Activity: Keeping the Player in the Window
00:11
+ Maps and Tiles
2 lectures 35:42

This session explains the basic ideas behind using tiles to build our game map.

Maps and Tiles
05:05

Let's create a new component to hold the functionality of map tiles.

The Tile Component
30:37
+ Layers and Camera Movement
2 lectures 30:58

Grouping entities by layer.

Working with Layers
15:33

Let's also add the idea of a 2D camera that follows our player.

Implementing a Moving Camera
15:25
+ Collisions
3 lectures 56:10

This session covers the basic implementation of collisions between objects.

Identifying Collisions
36:23

Activity: Add a "render" function to our collider component so we can also see the bounding box around the game objects that have a collider.

Activity: Rendering Bounding Boxes
02:16

Let's improve our collision check and discuss how we could reduce the complexity of our code

Improving our Collision Check
17:31
+ Text and Labels
1 lecture 27:36
The Label Component
27:36
Requirements
  • Basic knowledge of the Linux command-line (creating directories, copying files, etc.)
  • Basic knowledge of programming fundamentals (variables, loops, functions, etc.)
  • Basic experience with a C-style OOP language (such as Java, C++, C#, etc.)
Description

Do you want to be more than "yet another applicant that only knows Unity3D or Unreal"?

Or, do you want to really get your knowledge of C++ and object-oriented programming to the next level? And on top of that learn the fundamentals of how a simple 2D game engine works?

If that's the case... this course is for you!

We are going to implement, together, the basic architecture of a simple 2D game engine using C++, SDL, and Lua scripting.

Here is what we will cover:

  • The basics of a game loop and fixing our time step

  • Using the SDL library to handle graphics and hardware input/output

  • Loading dynamic entities to your game scene (enemies, vegetation, obstacles, etc.)

  • Creating a flexible tile-based game map

  • Adding components to your game objects:

    • Sprites

    • Animation

    • Transform (position, rotation, scale)

    • Colliders

    • Text labels

    • Projectile emitters

  • Managing game assets, such as textures, sounds, and fonts

  • Displaying UI text and HUD elements.

  • Using Lua language for scripting and configuring levels

...and so much more.

It is expected that you know the basics of the Linux command line (creating directories, copying files, etc). Also, a very basic knowledge of programming (variables, loops, conditionals, functions) and object-oriented principles will help you get the most out of this course.

You will be able to use the code developed in this course in Linux, macOS, and Windows. But, be aware that the lecturer does not use any IDE in this course and we will build our project using just GCC and Makefile directly via the Linux command line.

Join us, and learn the fundamentals of game architecture by creating a basic 2D game engine... from scratch!

Who this course is for:
  • Programmers curious about the fundamentals of game development