v0.8.02026-05-14
Usagi v0.8.0 comes with a ton of new features leading up to the v1.0.0 release.
This will be the last release before v1.0.0. A lot of what's new comes by way
of feedback from the community and what I've been needing for my own
games. The engine's feeling good and stable! It's a great time to jump in.
v0.8.0 includes support for custom color palettes, custom fonts, advanced
shape and sound APIs, gamepad action button remapping, Lua 5.5 support
and more!
Check out the full details below.
Install
If you have Usagi installed, use usagi update and then usagi refresh
if you want to update the docs to the new version.
There's a new way to get Usagi via install scripts if you don't have
it installed already:
Linux, macOS:
``sh
curl -fsSL https://usagiengine.com/install.sh | sh
`
Windows (PowerShell):
`powershell
irm https://usagiengine.com/install.ps1 | iex
`
Or just download for your operating system below.
Breaking:
- Color slot indices are now 1-based instead of 0-based, matching gfx.spr
and Lua's array convention. The gfx.COLOR_* constants shift up by one.
gfx.COLORBLACK is now 1 (was 0), gfx.COLORPEACH is 16 (was 15).
Code that uses the named constants is unaffected; code that passes literal
integers (gfx.clear(0), gfx.rect_fill(..., 7)) needs to bump each literal
by 1 or switch to the named constants. Slot 0 and any index above the active
palette's length now render as the magenta out-of-range sentinel.
- gfx.sprex and gfx.ssprex gained three required trailing params:
rotation (radians), tint (palette color), and alpha (0..1). Use
0, gfx.COLOR_WHITE, 1.0 for the identity values to preserve the old
behavior. The simple gfx.spr / gfx.sspr signatures are unchanged. See the
README's "Scaling sprites" subsection for wrapper recipes if you find the
verbose call sites painful.
Features:
- Custom color palettes via palette.png. Drop a PNG at your project root and
Usagi swaps the default Pico-8 palette for yours. Pixels read in row-major
order (left-to-right, top-to-bottom) so any rectangular shape works. 16x1
strips, 16x2 grids, 4x4 grids, etc. Color count = width ×
height.
lospec.com's "1px cells" exports are the canonical source. Hot-reloads like
sprites.png, ships in usagi export bundles. The gfx.COLOR_* constants
stay as slot indices, so they keep resolving through the same slots, but the
RGB at each slot is whatever you painted. Slots beyond your palette's range
render as magenta. The ColorPalette tool reflects the active palette. New
examples/palette_swap ships a sweetie16 palette; delete its palette.png to
see the same Lua in Pico-8 colors.
- New sfx.play_ex(name, volume, pitch, pan),
music.play_ex(name, volume, pitch, pan, loop), and
music.mutate(volume, pitch, pan) for programmatic audio control. play_ex
is fire-and-forget per-call params (use it for random-pitch footsteps, panned
UI cues, attenuated dialogue beeps). music.mutate modulates the
currently-playing track in place with replace semantics. This is useful for
ducking music under dialog, pitch-warping during hitstun, and fade-outs. Pan
is -1..1 (left to right), volume 0..1, pitch a raw multiplier (1.0 =
identity). The examples/sound demo gets a random-pitch jump on BTN3;
examples/music ducks the track while LEFT is held.
- New gfx.text_ex(text, x, y, scale, rotation, color) for scaled and rotated
text. Scale is a font-size multiplier (use integers for crisp pixel-art text;
fractional values blur). Rotation is in radians (use math.rad(deg) for
literal degrees) and pivots around the text's center. New examples/text
shows a big scaled title, a sin-wave wiggling subtitle, and a static tilted
label.
- New gfx.rect_ex(x, y, w, h, thickness, color),
gfx.circ_ex(x, y, r, thickness, color), and
gfx.line_ex(x1, y1, x2, y2, thickness, color) for thick-stroke shape
outlines. circ_ex strokes are centered on the nominal radius so concentric
rings at adjacent radii sit flush instead of leaving rounding gaps. The
examples/shapes demo now includes a small concentric-rings showcase.
- gfx.sprex / gfx.ssprex now support rotation, tint, and alpha. Rotation
is in radians (use math.rad(deg) for literal-degree values) and pivots
around the sprite's center. Tint is a palette color multiplied over the sprite
(gfx.COLOR_WHITE is the identity; other colors recolor for hit flashes
etc.). Alpha is 0..1 for fade-in/out. The examples/spr demo now exercises
all three (spinning bunny, tint-flashing ship via BTN1, pulsing-alpha bullet).
- New input.mouse_scroll() returns the per-frame vertical scroll delta
(positive up, negative down, 0 when no scroll). Works the same on a mouse
wheel or a trackpad two-finger swipe. The mouse example now uses it to cycle
the spark color.
- Upgraded the embedded Lua runtime from 5.4 to 5.5. No game-code changes are
expected for typical Usagi scripts; the bundled .luarc.json (shipped via
usagi init / usagi refresh) now pins runtime.version to Lua 5.5 so the
LSP matches.
- TilePicker: LMB on a tile copies its spr index (existing behavior). RMB
click-and-drag now selects a tile-aligned rectangle on the sheet and copies
sx,sy,sw,sh ready for sspr. The current selection stays visible: a
highlight box on the sheet plus a readout in the header showing both the spr
index (for single tiles) and the sspr source rect. A live preview rect
tracks the drag.
- sprites.png is now explicitly loaded with POINT (nearest-neighbor) texture
filtering, matching the bundled font, so the pixel-art intent is pinned in the
engine rather than relying on a default.
- TilePicker: hold middle mouse and drag, or hold space and drag with the left
mouse, to pan the sheet. Use the scroll wheel to zoom (anchored on the cursor
so the pixel under the mouse stays put). The header also shows the sheet pixel
coords under the cursor.
- New usagi.dump(v) helper: pretty-prints any Lua value to a string, recursing
into tables with sorted keys and cycle detection. Pair with print for
terminal debugging, or feed into gfx.text to draw on screen.
- New gfx.px(x, y) reads a pixel from the most recently rendered frame and
returns (r, g, b, palette_index) as multiple values. The palette index is
the 1-based slot for an exact RGB match, or nil for off-palette colors. All
four returns are nil for off-screen coordinates or on the very first frame
before any drawing has happened. Reads reflect the previous frame's finished
image, so they don't see in-progress draws inside the current _draw. Useful
for collision-by-color, fog-of-war reveals, palette-swap effects, and water
reflections.
- New gfx.spr_px(index, x, y) reads a pixel from sprites.png. index is a
1-based sprite slot (same shape as gfx.spr); (x, y) is the offset inside
that cell. Returns the same (r, g, b, palette_index) shape as gfx.px. All
four returns are nil for an out-of-range index, out-of-cell coordinates, a
project with no sprites.png, or a fully transparent source pixel (so the
ergonomic if r then ... check covers both "no sheet" and "alpha hole"
cases). Useful for pixel-perfect sprite collision and for data-baked levels
where you paint the layout into the sheet and scan it at startup.
- New examples/px cart demonstrates both reads side-by-side: a small maze
where movement consults gfx.px for collision-by-color, plus a gfx.spr_px
scan that re-renders sprite 1 pixel-by-pixel next to its gfx.spr` original.
- Bundled font upgraded from monogram (95 ASCII glyphs) to monogram-extended
(504 glyphs covering full Basic Latin, Latin-1 Supplement, Latin Extended-A,
partial Gre