Home | Blog
Last Updated: 19/Aug/2022

Porting 2048 game to Odroid Go

Added on 19/Aug/2022

What?

I recently got my hands on an Odroid Go Game Kit.

Odroid Go
Fig.1 - Odroid Go.

It's an amazing piece of tech that have these features in its small formfactor & affordable price:

MCU Custom ESP32-WROVER(16 MB Flash Memory)
CPU & RAM 80MHz - 240MHz(Adjustable), 4MB PSRAM
Wi-Fi 802.11 b/g/n 2.4GHz - 2.5GHz
Bluetooth Bluetooth v4.2 BR/EDR, BLE
Display 2.4inch 320×240 TFT LCD (SPI interface)
Battery Li-Polymer 3.7V/1200mAh, Up to 10 hours of continuous game playing time
Speaker 0.5Watt 8Ω Mono
Micro SD card slot 20Mhz SPI interface
Micro USB port Battery charging(500mA) and USB-UART data communication
Expansion Port 10Pin port(I2C, GPIO, IRQ at 3.3Volt)
Input Buttons Menu, Volume, Select, Start, A, B, Direction Pad
Power consumption Game emulation: 100~115mA, Sleep mode: 5.3~5.8mA, Power off: 0.1mA

As a quick project I ported the (in)famous 2048 game to it:

Odroid Go Dark mode
Fig.2 - 2048 running on Odroid GO.
Check the repository: 0xbsec/odroid-go-2048

Where to Start

  1. Setup Arduino for Odroid
  2. Hello World Example

Setup Arduino software to support Odroid GO

I used nix-shell -p arduino to download and setup the IDE.

Odroid Go uses the ESP32 chip. To add it to the Arduino software: Nagivate to File > Preferences > Addtional Boards Manager Url.
Add add this url: https://dl.espressif.com/dl/package_esp32_index.json (mirrored here).

Navigate to Tools > Boards > Boards Manager > Search for: ESP32 and install it.

Hello World

Load this example:

#include <odroid_go.h>

void setup() {
    GO.begin();

    GO.lcd.println("Hello, ODROID-GO");
}

void loop() {
}

If everything works as expected you should see a hello message.

Porting 2048 game

Vid.1 - Game playthrough.

The game code is similar to the above code with some fancy additions and multiplications. You can check it here.

At first I faced an issue with screen flickering while updating the state. Turns out I was clearning the screen & redrawing multiple times before updating the state.
Other than this issue, everything else went smoothly.

Note: I had to reflash the board to be able to boot back into the original firmware: esptool.py write_flash 0 odroid-go-firmware-20181001.img

Game Control

Excert from the control code: (full code here)

// undo: A
if (GO.BtnA.wasPressed()) {
    d.undo();

    return;
}

// restart: B
if (GO.BtnB.wasPressed()) {
    d.init();

    return;
}

// UP
if (GO.JOY_Y.wasAxisPressed() == 2) {
    d.log("u");

    Move::up();
    d.tick();

    return;
}

Read more

Check the Odroid Go Wiki for more info.




✉️ Subscribe via email
Thanks for Subscribing!
Subscription failed. Please try again later.