ggez is a free, open source gaming project written in Rust and released under MIT. It has 4,699 GitHub stars, 441 forks and 71 open issues, and was last pushed 1 months ago. On this registry it ranks #32 of 48 tracked projects in Gaming, with 5 head-to-head comparisons available.

What is ggez?

ggez is a MIT-licensed Rust game framework that gives developers a lightweight, cross-platform base for building 2D and 3D games with a LÖVE-inspired API.

What it is

ggez is a Rust library for creating games, described as a lightweight cross-platform game framework for making 2D and 3D games with minimum friction. It lives in the Rust crates.io ecosystem and provides basic, portable functionality for drawing, sound, resource loading, and event handling. Its API is modeled on a Rustified version of the LÖVE game framework, while also adding a 3D drawing path that LÖVE does not provide as an API.

The concrete problem it solves is providing a simple, batteries-included starting point for Rust game projects. Instead of requiring a large engine or a long list of plugins, ggez supplies a Context object for hardware state, an EventHandler trait for callbacks, and sub-modules such as graphics and audio. It deliberately stops short of dictating higher-level systems such as a physics engine or an entity component system, leaving those choices to the developer.

Key capabilities

  • Filesystem abstraction loads resources from folders or zip files.
  • Hardware-accelerated 2D and 3D rendering built on the wgpu graphics API.
  • Audio loading and playback for .ogg, .wav, and .flac files through the rodio crate.
  • TTF font rendering with glyph_brush, plus keyboard and mouse event handling through callbacks.
  • Engine and game settings can be defined in a config file, with timing and FPS measurement helpers.
  • Math library integration with mint supports game calculations.
  • Advanced graphics options include shaders, instanced draws, and render targets.

Who uses it and how

  • Rust developers building 2D or 3D desktop games for Windows, Linux, and macOS use it as the core loop and rendering layer.
  • Teams that want a LÖVE-like workflow in Rust can implement the EventHandler trait and run the main loop with event::run().
  • Projects that need physics, animation, GUI, ECS, AI, assets management, or networking can pair ggez with separate Rust crates rather than adopting a full engine.
  • Developers targeting Android, iOS, or WebAssembly can use good-web-game for ggez versions up to 0.7, as noted in the README.
  • Developers who need to package resources for distribution can rely on the zip-file loading support instead of only loose asset folders.

Getting started

Add ggez = "0.10.0" to a Rust project's Cargo.toml file, using rustc 1.42 or later, then create a Context from a ContextBuilder or Conf object and pass it to event::run() with an implementation of the EventHandler trait.

How it compares

ggez sits closest to LÖVE among the tools named in the facts, because it aims to implement a Rustified version of LÖVE's game framework API while adding 3D rendering beyond LÖVE's existing API. It is less complete than a full game engine because it does not include physics, animation, GUI, ECS, AI, assets management, or networking, and it leaves those subsystems to external libraries.

When to use it — and when not to

Use ggez when you want a minimal, MIT-licensed Rust foundation for a 2D or 3D game and you are comfortable choosing your own crates for higher-level systems. Do not choose it when you need official support for Android, iOS, or the web, or when you require an all-in-one engine with built-in physics, ECS, GUI, networking, or asset management. The README also warns that finer details and performance characteristics may differ from LÖVE, so developers expecting a drop-in LÖVE port should test their assumptions early.

project readme (upstream, from github) — read inline

ggez

ggez logo

What is this?

Build status Docs Status license Crates.io Crates.io Discord chat

ggez is a Rust library to create a Good Game Easily.

More specifically, ggez is a lightweight cross-platform game framework for making 2D and 3D games with minimum friction. It aims to implement an API based on (a Rustified version of) the LÖVE game framework. This means it contains basic and portable 2D drawing(in addition 3D which love doesn't have an API for), sound, resource loading and event handling, but finer details and performance characteristics may be different than LÖVE.

ggez is not meant to be everything to everyone, but rather a good base upon which to build. Thus it takes a fairly batteries-included approach without needing a million additions and plugins for everything imaginable, but also does not dictate higher-level functionality such as physics engine or entity component system. Instead the goal is to allow you to use whichever libraries you want to provide these functions, or build your own libraries atop ggez.

Features

  • Filesystem abstraction that lets you load resources from folders or zip files
  • Hardware-accelerated 2D and 3D rendering built on the wgpu graphics API
  • Loading and playing .ogg, .wav and .flac files via the rodio crate
  • TTF font rendering with glyph_brush.
  • Interface for handling keyboard and mouse events easily through callbacks
  • Config file for defining engine and game settings
  • Easy timing and FPS measurement functions.
  • Math library integration with mint.
  • Some more advanced graphics options: shaders, instanced draws and render targets

Non-Features (i.e. things to add from elsewhere if needed)

Supported platforms

  • Fully supported: Windows, Linux, MacOS
  • Not officially supported but might work anyway: Android, iOS, Web

For details, see docs/BuildingForEveryPlatform.md

If you want to run ggez (up to 0.7 as of now) on Android, iOS or the web using WebAssembly right now, take a look at good-web-game.

Who's using ggez?

Check out the projects list!

Usage

ggez requires rustc >= 1.42 and is distributed on crates.io. To include it in your project, just add the dependency line to your Cargo.toml file:

ggez = "0.10.0"

ggez consists of three main parts: A Context object which contains all the state required to interface with the computer's hardware, an EventHandler trait that the user implements to register callbacks for events, and various sub-modules such as graphics and audio that provide the functionality to actually get stuff done. The general pattern is to create a struct holding your game's data which implements the EventHandler trait. Create a new Context object with default objects from a ContextBuilder or Conf object, and then call event::run() with the Context and an instance of your EventHandler to run your game's main loop.

See the API docs for full documentation, or the examples directory for a number of commented examples of varying complexity. Most examples show off a single feature of ggez, while astroblasto and snake are small but complete games.

Getting started

For a quick tutorial on ggez, see the Hello ggez guide in the docs/ directory.

Examples

See the examples/ directory in the source. Most examples show off a single feature of ggez, while astroblasto is a small but complete Asteroids-like game.

To run the examples, just check out the source and execute cargo run --example in the root directory:

git clone https://github.com/ggez/ggez.git
cd ggez
cargo run --example 05_astroblasto

If this doesn't work, see the FAQ for solutions to common problems.

Basic Project Template
use ggez::{Context, ContextBuilder, GameResult};
use ggez::graphics::{self, Color};
use ggez::event::{self, EventHandler};

fn main() {
    // Make a Context.
    let (mut ctx, event_loop) = ContextBuilder::new("my_game", "Cool Game Author")
        .build()
        .expect("aieee, could not create ggez context!");

    // Create an instance of your event handler.
    // Usually, you should provide it with the Context object to
    // use when setting your game up.
    let my_game = MyGame::new(&mut ctx);

    // Run!
    event::run(ctx, event_loop, my_game);
}

struct MyGame {
    // Your state here...
}

impl MyGame {
    pub fn new(_ctx: &mut Context) -> MyGame {
        // Load/create resources such as images here.
        MyGame {
            // ...
        }
    }
}

impl EventHandler for MyGame {
    fn update(&mut self, _ctx: &mut Context) -> GameResult {
        // Update code here...
        Ok(())
    }

    fn draw(&mut self, ctx: &mut Context) -> GameResult {
        let mut canvas = graphics::Canvas::from_frame(ctx, Color::WHITE);
        // Draw code here...
        canvas.finish(ctx)
    }
}

Implementation details

ggez is built upon winit for windowing and events, rodio for sound, and a 2D drawing engine implemented with wgpu. It is entirely thread-safe (though platform constraints mean the event-handling loop and drawing must be done in the main thread), and portable to Windows and Linux.

ggez is pure Rust™.

Help!

Sources of information:

  • The FAQ has answers to common questions and problems.
  • The API docs, a lot of design stuff is explained there.
  • Check out the examples.

If you still have problems or questions, feel free to ask! Easiest ways are:

License: MIT

Frequently asked questions

Is ggez free to use?

ggez is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does ggez do?

Rust library to create a Good Game Easily

What is ggez written in?

ggez is primarily written in Rust. Its source is publicly available at https://github.com/ggez/ggez, and it has 4,699 GitHub stars.