TinyEngine - A game engine to turn your ESP32/Arduino into a mini retro game console! TinyEngine supports TinyScript, a high-level interpreted custom scripting language to allow you to make games on the fly without recompiling TinyEngine for your microcontroller. Inspired by the Game Boy and PSP.
Demo
Features
- TinyEngine 2D Game Engine
- TinyScript scripting language
- Console Emulation on PC
TinyEngine
Cube.mp4
TinyScript
TinyScript is a high-level interpreted scripting language with its distinct BASIC-like syntax.
# Display Player in updated position
DEFINE FUNC0 BEGIN
M0 = M0 + (M1*JOYSTICK_X)/100
# Bound player position
IF M0-M3 < 0 THEN
M0 = M3
ELSE IF M0+M3 > 319 THEN
M0 = 319-M3
END
M63 = 0
WHILE M63 < M2 DO
CALL LINE M0-M3, (239-M63), M0+M3, (239-M63), 255, 255, 255
M63 = M63 + 1
END
END
More Game Demos
Make sure to leave a GitHub star on this repo to show your support <3 :)
Note
The project is WIP! You can currently emulate and run the Game Engine on your laptop/computer. Future goals are to implement this on microcontrollers.
Getting Started
The documentation for TinyScript lives under Docs/README.md.
TinyEngine Controls
| Keys | Description |
|---|---|
| W / A / S / D or Arrow Keys | Movement controls. emulates joystick, maps a keypress to -100%, 0% or 100% of equivalent joystick position. |
| E | Mapping to joystick click |
| O | Mapping to auxillary 'A' button |
Installation
Binary Releases
Install the binary releases here for your target Operating System.
Windows
Unzip the downloaded zipped file and run the project within the folder by double-clicking on it.
Alternatively, you can open a terminal window within the root of the folder and execute the following to run via the CLI.
Linux (Unix)
Unzip the downloaded zip file by running the following in the same directory as the downloaded zip file.
unzip <Folder Name> . cd <Folder Name>
To execute the binary via CLI, execute:
MacOS
Unzip the downloaded zip file. You can do this by running the following in the same directory as the downloaded zip file.
unzip <Folder Name> . cd <Folder Name>
Execute main within the unzipped folder or to execute the binary via CLI, execute:
Build From Source
Make sure you have the various prerequisites.
Requirements
- C++ Compiler linked to your
PATH - CMake Version 3.23 or higher
- Make
- Git
Building & Executing
Note
Building commands may differ depending on your environment
Clone the repository onto your local system using the following.
git clone --recursive https://github.com/111nation/TinyEngine
Enter the cloned repository and enter the GameEngine directory to build and execute the Emulator.
cd Arduino-Handheld-Console cd GameEngine cmake -S . -B build cmake --build build
How TinyEngine Works
Loading Games
When emulating the game engine on your personal computer, TinyEngine loads games from the programs folder, $ROOT/programs/main, where $ROOT is the current working directory of where TinyEngine was executed at. This currently functions as a basic bootloader for the game console to fetch the first instructions (which is just a single game at this point).
Depending if you downloaded a precompiled binary or built from source, $ROOT is the unzipped folder installed the precompiled binary or $ROOT is the GameEngine folder where cmake was executed.
Keep all custom-written games in $ROOT/programs/, 'load' a game by renaming it to main in the programs folder.
Tip
Two sample games, a drawing and a pong game has been included as a demo
TinyScript
This is the most fun part! This section is viewable at Docs/README.md
Project Structure
| Directory / Component | Description |
|---|---|
| Depreciated/PyGameEngine | Stores the legacy, deprecated Python-based game engine codebase. |
| Arduino | Stores the Arduino implementation used to control physical hardware inputs. |
| GameEngine | Stores the main source code and data for the TinyEngine game engine. |
| Docs | Contains the system and API documentation for TinyEngine. |