#game-engine #game #retro #engine #2d-game #2d #graphics

no-std musi_lili

musi_lili is a retro game engine for GB styled games written in Rust. Inspired by pico8.

1 unstable release

0.1.0 Dec 22, 2024

#574 in Game dev

Download history 89/week @ 2024-12-17 21/week @ 2024-12-24

110 downloads per month

LGPL-3.0-only and GPL-3.0-only…

290KB
4.5K SLoC

musi lili

musi lili is a retro game engine for GB styled games written in Rust. Inspired by pico8.

Get it on Codeberg #MadeWithSlint

CI LGPL-3.0-only licensed Snapshot docs

Specifications

  • Display: 160x144px 4 colors
  • Sprites: 256 8x8 sprites
  • Map: 128x64 tiles
  • Framerate: ~60fps

Features

  • Develop games with Rust
  • built-in sprite editor
  • built-in map editor
  • 3 different colors palettes (gray, green, red)
  • Roadmap

Differences to pico8

  • musi lili is a retro game engine not a complete Fantasy Console
  • Games are build with Rust instead of Lua

Supported Platforms

  • Desktop: works good on Linux, macOS and Windows.
  • Web: musi lili games ca be compiled to WebAssembly and can be run in a web browser.
  • Mobile: currently only Android is supported, iOS will be supported in the future.
  • Embedded: no_std support is work in progress.

Controls

  • Buttons
    • A: (A on keyboard)
    • B: (S on keyboard)
    • Select: (Space on keyboard)
    • Start: (Enter on keyboard)
    • Mouse: (Mouse left or right)
    • Left: (Left arrow key on keyboard)
    • Right: (Right arrow key on keyboard)
    • Up: (Up arrow key on keyboard)
    • Down: (Down arrow key on keyboard)
  • Keys
    • Escape: switch between game and editor on debug build
    • CTRL-P: switch color palette
    • CTRL-S: saves sprite-map and tile-map on debug build
    • CTRL-R: restart game

Screenshots

Example Game Sprite Editor Map Editor
lili example game lili sprite editor lili map editor

Web examples

Confetti Drawing Map
confetti example drawing example map example

More examples in the examples folder.

Code Example

use musi_lili::{Game, Lili};

struct MyGame;

impl Game for MyGame {
    fn init(_lili: &Lili) -> Self {
        Self
    }

    fn update(&mut self, _lili: &Lili) {
        // the code to update your game
    }

    fn draw(&mut self, lili: &Lili) {
        // draw your game
        lili.clear(0);
        lili.txt("toki", 5, 5, 3);
    }
}

fn main() {
    musi_lili::run::<MyGame>(musi_lili::load!("my-game"));
}

Crates

  • musi_lili: api library part, use this crate to implement you game.
  • lon_lili: GB emulator frontend build with rgy.
  • tan_lili: base components for input, drawing and api (internal).
  • tawa_lili: runtime environment of lili (internal).

Implementation details

  • games are drawn to a virtual display
  • the editor uses the same features and api as a musi_lili::Game

Used third party libraries

Library License Used for
Slint GNU GPlv3, Royalty-free or Paid Window, framebuffer and event handling
embedded-graphics Apache 2.0 or MIT Pixel art drawing
dirs-next Apache 2.0 or MIT Get user settings path
serde Apache 2.0 or MIT Serialize / Deserialize game data
serde-json Apache 2.0 or MIT Serialize / Deserialize game data
gilrs Apache 2.0 or MIT Support for game controllers
web-time Apache 2.0 or MIT Use Instant::now() on the web

License

The source code of lili available under the terms of LGPL-3.0-only license. (See LICENSE-LGPL-3.0-only for details.). The source code of the examples if available under the terms of MIT license (See LICENSE-MIT for details.)

Contributions

If you are interested to contribute to the project, feel free to check the Contributing guide please.

Dependencies

~16–27MB
~382K SLoC