smol
A downloadable tool for Windows and Linux
A tiny game engine based on Lua that is limited to a 25-colour palette. Much inspired by the work of rxi.
Limitations
- 25-colour palette, zero is reserved for transparency
- Input based on the NES controller: D-pad, A, B, Select and Start buttons.
- No external asset loading
- ASCII text rendering
- 3 audio channels
Game Lua scripts can be passed as command line arguments to the executable to run a game. Scripts can also be appended to the end of the executable to create a single-file game that you can distribute.
=== config ===
A table named "config" can be created as a global
before initialisation (ie. In the init function)
to set the following parameters:
width (number)
height (number)
pixel_size (number)
name (string)
The pixel size is representative of how many screen
pixels represent an in-game pixel. The width and height
are relative to the pixel size, for example if the pixel
size is set to 4, with width and height set to 100 each,
the size of the window in actual screen pixels will be
400x400
=== callbacks ===
init() called upon initialisation. engine functions cannot be called here.
tick(timestep) called every frame
deinit() called upon deinitialisation
=== rendering ===
fill(color) fill the screen
put(x, y, color) place a pixel
putc(x, y, color, char) place an ASCII character
puts(x, y, color, str) place an ASCII string
putb(x, y, data, w, h) place a bitmap
putbm(x, y, color, data, w, h) place a mono-colour bitmap
=== input ===
btn_pressed(btn)
btn_just_pressed(btn)
btn_just_released(btn)
= buttons =
BTN_SELECT
BTN_START
BTN_B
BTN_A
BTN_DPAD_UP
BTN_DPAD_DOWN
BTN_DPAD_LEFT
BTN_DPAD_RIGHT
=== input map ===
D-pad Arrow keys/WASD
A Z
B X
Select Return/Escape
Start Space
=== other ===
rand(min, max)
=== audio ===
tone(channel, type, duration, amplitude, frequency)
= tone types =
AUD_SINE
AUD_SQUARE
AUD_TRI
AUD_SAW
You can use this for whatever you want. Attribution is appreciated but not required.