Source: https://mokxi.com/teachers/plans/game-dev-microcontrollers
Updated: 2026-11-19

Lesson plan

# Game dev on microcontrollers lesson plan

Write a space platformer in C++ on an ESP32-C3 with a tiny OLED, three buttons and a piezo: game loop, sprites, input, collision, gravity and sound, one idea at a time.

4 chapters, 7 lessons, about 5 hours, on the ESP32-C3-DevKitM-1. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## Objectives and materials

### By the end, students can

- A steady frame rate and sprites stored as bytes.
- Buttons read like a game reads them, and boxes that touch.
- Fixed-point gravity and sound effects that never freeze the game.
- Everything in one platformer, then a level of your own.

### Materials for the whole unit

- ESP32-C3-DevKitM-1
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3

Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.

Chapter 1. About 1 h 40 min

## Loop and pictures

A steady frame rate and sprites stored as bytes.

Lesson | Time | What students do

The game loop Read, update, draw, wait: a parallax starfield at a fixed 25 frames a second, a frame budget you can measure, and what happens when the work outgrows it. | 50 min

- One loop, forever
- A steady beat
- Where the time goes
- Ask for 50
- Fit the budget

Sprites and frames An 8x8 astronaut stored as eight bytes, a two-frame walk cycle, a mirrored turn that costs no memory, and erasing exactly what you drew. | 50 min

- A picture in eight bytes
- Two frames make a walk
- Turn around for free
- Redraw the helmet
- Walk faster

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3

### Check for understanding

Each student finishes "Sprites and frames" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Walk faster".

Chapter 2. About 1 h 20 min

## Make it playable

Buttons read like a game reads them, and boxes that touch.

Lesson | Time | What students do

Input Three buttons read once a frame into a snapshot: held for walking, pressed for jumping, and why reading once a frame also tames contact bounce. | 40 min

- Hold right
- Held versus pressed
- Bouncing contacts
- Walk speed

Collision Axis-aligned boxes and four comparisons: collect crystals, stop at a boulder by undoing the move, and tune a hitbox until the game feels fair. | 40 min

- Four comparisons
- Collect a crystal
- A solid boulder
- Tune the hitbox

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3

### Check for understanding

Each student finishes "Collision" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Tune the hitbox".

Chapter 3. About 1 h 20 min

## Physics and sound

Fixed-point gravity and sound effects that never freeze the game.

Lesson | Time | What students do

Gravity Velocity, acceleration and sixteenths of a pixel: a jump that is a true parabola, moon gravity in one constant, and landing on a ledge from above. | 40 min

- Speed changes place, gravity changes speed
- Why fixed point
- Moon gravity
- Land on the ledge

Sound effects A piezo, tone() and note tables: a start jingle, a rising jump and a crystal chime, played from the game loop by priority without ever freezing the game. | 40 min

- A jingle from a table
- A player that never waits
- Priorities
- Design your jump

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3

### Check for understanding

Each student finishes "Sound effects" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Design your jump".

Chapter 4. About 50 min

## Boss

Everything in one platformer, then a level of your own.

Lesson | Time | What students do

Boss: a platformer Everything in one game: three crystals on the moon, floating rocks, a crater that costs a life and a portal that opens when you have them all. Then make it yours. | 50 min

- The whole course in one loop
- Mind the crater
- Clear the level
- More lives
- Make it yours

### Materials

- ESP32-C3-DevKitM-1
- Full-size breadboard
- OLED display, 128x64
- Piezo speaker
- Pushbutton x 3

### Check for understanding

Each student finishes "Boss: a platformer" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.

Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Make it yours".

Your class

## Teach this unit as a class

Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.

The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
