Perentie is a Lua-based graphical adventure game engine. The design is heavily inspired by LucasArts' SCUMM and GrimE adventure game engines.
Perentie is designed for the hardware constraints of Pentium-era MS-DOS. You can run it in any of the following environments:
- MS-DOS, including as a child process from inside Windows 3.1/95/98
- Natively on most platforms (via SDL3)
- Embedded in a webpage (via SDL3 + Emscripten)
Featuring:
- Lua-based scripting API
- Co-operative threading
- 320x200 resolution 256 colour VGA graphics
- Programmable dithering engine (convert your graphics to EGA and CGA!)
- Bitmap text rendering with support for UTF-8
- PC speaker tone/sample playback
- OPL2/OPL3 music playback
- Debug shell over null modem/Telnet connection
Perentie was originally created for DOS Games Jam July 2024.
Download
You can obtain the latest version from the releases page.
Documentation
For general information about engine concepts, check out the Perentie guide.
For information about the Perentie Lua scripting API, check out the Perentie API docs.
Please check out the example game, Maura and Ash, along with the full source code
Compiling
In order to build Perentie, you will need the following tools in your PATH:
- Meson
- Ninja
- lua and luac, version 5.4
MS-DOS executable
You will also need:
- A copy of the DJGPP cross-compiler toolchain. You can build one using the scripts from https://github.com/andrewwutw/build-djgpp
source /path/to/djgpp/setenv
meson setup --cross-file=i586-pc-msdosdjgpp.ini build_dos
cd build_dos
ninja
SDL executable
You will also need:
- A POSIX-compatible C compiler toolchain, such as GCC or Clang.
- SDL3
meson setup build_sdl
cd build_sdl
ninja
For better debugging, you will probably want to turn off optimisation and turn on AddressSanitiser.
meson setup -Doptimization=0 -Db_sanitize=address build_sdl
It is possible to build Perentie for Windows using MSYS2. I haven't tried building it -in- Windows, but I was able to cross-compile from Linux using quasi-msys2 after installing the sdl3 package.
source /path/to/quasi-msys2/env/all.src
meson setup build_msys2
cd build_msys2
ninja
WebAssembly
You will also need:
- Emscripten 4.0.4 or later
meson setup --cross-file=wasm32-emscripten.ini build_wasm
cd build_wasm
ninja
You will need to package your entire game contents into a single data.pt file, and store it in the same directory as the WebAssembly build.
../scripts/pack.py data.pt ../my_game/*.lua ../my_game/assets
To test the WebAssembly version locally, the following command will start a Python webserver:
ninja webserver
Third-party
Perentie wouldn't be possible without the following third-party components:
- DJGPP - port of GNU development tools to DOS
- CWSDPMI - DPMI extender for DOS protected mode
- Lua - embedded scripting engine
- miniz - zlib/DEFLATE library
- libspng - PNG image library
- libwave - WAV file library
- BMFont - bitmap font packer and atlas format
- The Ultimate Oldschool PC Font Pack - pixel fonts
- inspect.lua - human-readable object representation for Lua debugging
- Lua-CBOR - Lua data serialisation library
- WoodyOPL - OPL2/OPL3 emulator by the DOSBox team, originally based on Ken Silverman's ADLIBEMU.
- SipHash - fast cryptographic hash function
- SimplexNoise - Simplex noise generator
- PhysicsFS - File system interface
- argparse - Command line argument parser.
In addition, Perentie incorporates code and algorithms from the following projects:
- PCTIMER - high-frequency timer interrupt replacement
- LoveDOS - framework for making 2D DOS games with Lua
- ScummVM - engine for playing narrative-based games
- DOSBox - MS-DOS PC emulator
- Reality Adlib Tracker - OPL3 music tracker/player