Coffee

An opinionated 2D game engine for Rust
Alternatives To Coffee
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Godot74,875429 hours ago51July 28, 202310,456mitC++
Godot Engine – Multi-platform 2D and 3D game engine
Libgdx21,996494220a day ago44July 02, 2023297apache-2.0Java
Desktop/Android/HTML5/iOS Java game development framework
Hazel10,288
9 days ago118apache-2.0C++
Hazel Engine
Opendiablo29,84812 years ago45October 21, 202176gpl-3.0Go
An open source re-implementation of Diablo 2
Ebiten8,8011782 days ago548July 24, 2023245apache-2.0Go
Ebitengine - A dead simple 2D game engine for Go
Awesome Unity6,031
9 days ago18cc0-1.0
A curated list of awesome Unity assets, resources, and more.
Awesome Godot4,829
7 days ago11cc-by-4.0
A curated list of free/libre plugins, scripts and add-ons for Godot
Liquidfun4,497
5 months ago64C++
2D physics engine for games
Urho3d4,413
8 months ago72mitC++
Game engine
Turbulenz_engine4,221
4 months ago36mitTypeScript
Turbulenz is a modular 3D and 2D game framework for making HTML5 powered games for browsers, desktops and mobile devices.
Alternatives To Coffee
Select To Compare


Alternative Project Comparisons
Readme

Coffee

Integration status Documentation Crates.io License Gitter chat

An opinionated 2D game engine for Rust focused on simplicity, explicitness, and type-safety.

Coffee is in a very early stage of development. Many basic features are still missing, some dependencies are experimental, and there are probably many bugs. Feel free to contribute!

Features

And more! Check out the examples to see them in action.

Usage

Add coffee as a dependency in your Cargo.toml and enable a graphics backend feature (opengl, vulkan, metal, dx11, or dx12):

coffee = { version = "0.4", features = ["opengl"] }

Rust is quite slow in debug mode. If you experience performance issues when drawing hundreds of sprites, enable compiler optimizations in your Cargo.toml. I recommend level 2 optimizations in order to stay closer to --release performance:

[profile.dev]
opt-level = 2

Coffee moves fast and the master branch can contain breaking changes! If you want to learn about a specific release, check out the release list.

Overview

Here is a minimal example that will open a window:

use coffee::graphics::{Color, Frame, Window, WindowSettings};
use coffee::load::Task;
use coffee::{Game, Result, Timer};

fn main() -> Result<()> {
    MyGame::run(WindowSettings {
        title: String::from("A caffeinated game"),
        size: (1280, 1024),
        resizable: true,
        fullscreen: false,
        maximized: false,
    })
}

struct MyGame {
    // Your game state and assets go here...
}

impl Game for MyGame {
    type Input = (); // No input data
    type LoadingScreen = (); // No loading screen

    fn load(_window: &Window) -> Task<MyGame> {
        // Load your game assets here. Check out the `load` module!
        Task::succeed(|| MyGame { /* ... */ })
    }

    fn draw(&mut self, frame: &mut Frame, _timer: &Timer) {
        // Clear the current frame
        frame.clear(Color::BLACK);

        // Draw your game here. Check out the `graphics` module!
    }
}

Browse the documentation and the examples to learn more!

Implementation details

Coffee builds upon

  • winit for windowing and mouse/keyboard events.
  • gfx pre-ll for OpenGL support, based heavily on the ggez codebase.
  • wgpu for experimental Vulkan, Metal, D3D11 and D3D12 support.
  • stretch for responsive GUI layouting based on Flexbox.
  • glyph_brush for TrueType font rendering.
  • gilrs for gamepad support.
  • nalgebra for the Point, Vector, and Transformation types.
  • image for image loading and texture array building.

Contributing / Feedback

I am quite new to Rust, systems programming, and computer graphics. I am learning along the way as I build the engine for a game I am currently developing. I am always glad to to learn from anyone.

If you want to contribute, you are more than welcome to be a part of the project! Check out the current issues if you want to find something to work on. Try to share you thoughts first! Feel free to open a new issue if you want to discuss new ideas.

Any kind of feedback is welcome! You can open an issue or, if you want to talk, you can find me (and a bunch of awesome folks) over the #games-and-graphics channel in the Rust Community Discord. I go by @lone_scientist there.

Credits / Thank you

  • ggez, an awesome, easy-to-use, good game engine that introduced me to Rust. Its graphics implementation served me as a guide to implement OpenGL support for Coffee.
  • Kenney, creators of amazing free game assets with no strings attached. The built-in GUI renderer in Coffee uses a modified version of their UI sprites.
Popular Video Game Projects
Popular 2d Graphics Projects
Popular Games Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Video Game
Rust
2d Graphics
Game Development
Game Engine
Vulkan
Gamepad
2d Game Engine