Kodeck

The Kodeck library is in alpha: the examples compile, testing on the console is next.

Lessons

Seven short lessons, one example program each: from the first shape on the screen to drawing with a finger.

Every lesson has a copy of its program that runs in the browser, the whole code explained part by part, and tasks to change it yourself. The programs are the examples that come with the Kodeck library.

Stick: drag the pad or use the arrow keys. Buttons: the A and Y keys.

Lesson 5 running in the browser, as a JavaScript copy of the example program. On Kodeck the same program runs in C++ after uploading.

  1. First pixel

    A small ship flies left and right along the bottom of the screen.

    What you learnHow the screen counts pixels: x from the left, y from the top

  2. Moving with the stick

    A ship follows the analog stick over a field of falling stars.

    What you learnReading the stick: numbers from -100 to 100

  3. Buttons and sound

    The ship shoots: A fires, B sets off a bomb, Y switches the sound on and off.

    What you learnpressed() and held(): one press or holding a button

  4. Collisions and score

    Catch the falling stars with a basket. Every star is a point; three misses and the game is over.

    What you learnWhen two rectangles touch

  5. Many objects

    A wave of 24 enemies moves left and right and steps down at every edge. Shoot them all before they land.

    What you learnA grid of objects in simple arrays

  6. High score

    Dodge the falling blocks for as long as you can. The record stays even after the console is switched off.

    What you learnSplitting a program into small functions

  7. Touch screen

    Draw with a finger. Pick a colour at the top, draw below, change the brush with L and R.

    What you learnWhere the finger is: touch coordinates

Before the first lesson

Kodeck is programmed with the free Arduino IDE on Windows, macOS or Linux. Setting it up takes about ten minutes, once.

You can read the lessons and try the browser versions without a console.

  1. Install the Arduino IDE.
  2. In Tools > Board > Boards Manager, install esp32 by Espressif Systems, version 3.3 or newer.
  3. In Tools > Manage Libraries, install LovyanGFX.
  4. Download the Kodeck library from its Releases page (Source code, zip) and add it with Sketch > Include Library > Add .ZIP Library.
  5. Choose the board ESP32S3 Dev Module and set Flash Size: 16MB, PSRAM: OPI PSRAM, USB CDC On Boot: Enabled.
  6. Connect Kodeck with a USB-C cable, choose its port in Tools > Port, open an example from File > Examples > Kodeck and press Upload.

Next lessons

Games for two consoles come next: a radio ping, a duel where shots fly over to the other screen, and Pong with one ball across two screens. Their example programs are already in the library (08, 09 and 10); the lessons will follow after they are tested on two consoles.

A lesson on the memory card (example 11) will follow too.