Skip to content

jasonliang-dev/spry

Repository files navigation

Spry

Spry is a 2D game framework made for rapid prototyping.

Basic example

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)
end

Spry vs. LÖVE

Spry 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.lua for 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.

Run the examples

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

Building from source

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:

mkdir build
cd build
cmake .. # This command probably looks different
cmake --build .

The 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 ..

This command should be used when building for web browsers:

emcmake cmake -DCMAKE_BUILD_TYPE=Release ..

Shoutouts

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.