Spry is a 2D game framework made for rapid prototyping.
The following code creates a window and draws Hello, World! to the screen.
function spry.start()
font = spry.default_font()
end
function spry.frame(dt)
font:draw('Hello, World!', 100, 100)
endSpry takes heavy inspiration from LÖVE. Below is a non-exhaustive list of differences between the two:
- Spry's API uses short function names more suitable for prototyping.
- Spry implicitly loads all Lua scripts in a project.
- Spry projects can be deployed to the web.
- Spry has hot reload support for images, sprites, and tilemaps.
- Spry can load Aseprite and LDtk files without needing to convert/export
assets to
.json. LÖVE cannot load these files directly. - Spry is a single executable, weighting in at about 1.6mb (0.8mb zipped). LÖVE is 10mb.
- LÖVE uses LuaJIT 2.1. Spry uses PUC Lua 5.4.
- LÖVE has lots of documentation and community support.
- LÖVE is mature, stable, and battle-tested.
- LÖVE uses
conf.luafor configuration options. Spry does not need a separate config file. - LÖVE has more overall features, such as system threads, touchscreen support, filesystem access, gamepad input, and networking sockets.
This repository includes some project examples. You can run them with the following commands:
spry examples/basic
spry examples/planes
spry examples/dungeon
spry examples/jump
spry examples/boxes
spry examples/nuklear_demoSpry can also run single Lua files:
spry myscript.lua
spry path/to/script.luaWhen running a single file, only that script is loaded (not all .lua files
in the directory). The script can still require() other modules from the
same directory.
Requires CMake and one of the following C/C++ compilers depending on the platform:
- Visual Studio for Windows
- Clang for Linux
- Emscripten for web browsers
Other compilers might work, but they haven't been tested.
In the command line:
Build for Linux
cmake -B build (default, use X11 backend)
OR
cmake -B build -DUSE_DRM=ON (use DRM backend)
OR
cmake -B build -DUSE_WAYLAND=ON (use Wayland backend)
cmake --build build -- -j8Build for Windows (using VS 2022)
cmake -B build
cmake --build build
OR
cmake --build build --config ReleaseThe first cmake command might need extra flags depending on the environment.
For example, the command below generates a release build for a Linux machine
that has both gcc and clang installed, since CMake would likely choose
gcc over clang:
cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Release ..Spry supports the following CMake options:
USE_NETWORK (default: ON)
- Builds with HTTP/HTTPS client module and luasocket networking support
- Set to OFF to exclude network modules and reduce binary size
cmake -B build -DUSE_NETWORK=OFFUSE_NUKLEAR (default: ON)
- Builds with the Nuklear immediate-mode GUI module (
spry.nuklear) - Set to OFF to exclude the Nuklear UI module
cmake -B build -DUSE_NUKLEAR=OFFUSE_WAYLAND (Linux only, default: OFF)
- Use Wayland display server instead of X11
USE_DRM (Linux only, default: OFF)
- Use DRM/KMS for direct rendering without a display server
This command should be used when building for web browsers:
emcmake cmake -DCMAKE_BUILD_TYPE=Release ..Special thanks to:
- floooh, for making Sokol.
- RandyGaul, for making cute_headers.
- Erin Catto for making Box2D.
- Casey Muratori, for showing me that I don't need to a huge engine to make games through Handmade Hero.
- rxi, for making lite. It was my introduction to creating programs with Lua.
- LÖVE, for being an awesome framework, and for being the main inspiration for this project.