All Projects → Bombfuse → emerald

Bombfuse / emerald

Licence: MIT License
A 2D rust game engine focused on portability.

Programming Languages

rust
11053 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to emerald

Godot 2d global illumination
2D Global Illumination shader in Godot.
Stars: ✭ 106 (-72.32%)
Mutual labels:  gamedev, 2d
Kaetram Open
An open-source 2D HTML5 adventure based off BrowserQuest (BQ).
Stars: ✭ 138 (-63.97%)
Mutual labels:  gamedev, 2d
Gizmo
2D Pixel Destruction Game written in Go.
Stars: ✭ 114 (-70.23%)
Mutual labels:  gamedev, 2d
Pixelvision8
Pixel Vision 8's core philosophy is to teach retro game development with streamlined workflows. PV8 is also a platform that standardizes 8-bit fantasy console limitations built on top of the open-source C# game engine based on MonoGame.
Stars: ✭ 773 (+101.83%)
Mutual labels:  gamedev, 2d
Rootex
An advanced C++ 3D game engine powering an in-production game yet to be announced
Stars: ✭ 161 (-57.96%)
Mutual labels:  gamedev, physics
Game Dogfight
Air to air combat game, created in Python 3 using HARFANG 3D.
Stars: ✭ 41 (-89.3%)
Mutual labels:  gamedev, physics
Trivial Gamekit
Simple framework for making 2D games
Stars: ✭ 127 (-66.84%)
Mutual labels:  gamedev, 2d
cage
Cage (Ain't a Game Engine) - write 2D games using plain C
Stars: ✭ 40 (-89.56%)
Mutual labels:  gamedev, 2d
P2.js
JavaScript 2D physics library
Stars: ✭ 2,367 (+518.02%)
Mutual labels:  gamedev, physics
Salva
2 and 3-dimensional fluid simulation library in Rust.
Stars: ✭ 182 (-52.48%)
Mutual labels:  gamedev, physics
Ruby2d
🎮 The Ruby 2D gem
Stars: ✭ 427 (+11.49%)
Mutual labels:  gamedev, 2d
bevy verlet
Verlet physics plugin for bevy.
Stars: ✭ 29 (-92.43%)
Mutual labels:  gamedev, physics
Obengine
2D Game Engine with Lua Scripting made on top of SFML !
Stars: ✭ 335 (-12.53%)
Mutual labels:  gamedev, 2d
Bytepath
A replayable arcade shooter with a focus on build theorycrafting made using Lua and LÖVE.
Stars: ✭ 1,119 (+192.17%)
Mutual labels:  gamedev, 2d
Spine Runtimes
2D skeletal animation runtimes for Spine.
Stars: ✭ 3,171 (+727.94%)
Mutual labels:  gamedev, 2d
Gamedev Resources
🎮 🎲 A wonderful list of Game Development resources.
Stars: ✭ 2,054 (+436.29%)
Mutual labels:  gamedev, 2d
voltar
WebGL only 2D game engine using Godot as the visual editor
Stars: ✭ 25 (-93.47%)
Mutual labels:  physics, 2d
Physac
2D physics header-only library for videogames developed in C using raylib library.
Stars: ✭ 151 (-60.57%)
Mutual labels:  physics, 2d
Fxgl
Stars: ✭ 2,378 (+520.89%)
Mutual labels:  gamedev, 2d
Py3ODE
Port of PyODE for Python 3
Stars: ✭ 29 (-92.43%)
Mutual labels:  physics, 2d

Emerald Crates.io License: MIT Discord chat

The Cross Platform Engine

Emerald is designed to be as lightweight as possible, while remaining a fully-featured and cross-platform game engine.

The api is simple and powerful, giving you direct access to physics, audio, graphics, game worlds, and asset loading.

Supported Platforms

OpenGL MacOS Linux Windows RaspberryPi HTML5

--- Work in progress ---

Android
--------------------------

Asset Loading

let my_sprite = emd.loader()
    .sprite("my_sprite.png")
    .unwrap();

let my_audio = emd.loader()
    .sound("my_sound.wav")
    .unwrap();

Physics

Creating Bodies

    let entity = emd.world().spawn((Transform::from_translation((0.0, 0.0))));

    let body_handle = emd.world().physics().build_body(
        entity,
        RigidBodyBuilder::dynamic()
    );


    emd.world().physics().build_collider(
        body_handle,
        ColliderDesc::cuboid(6.0, 6.0)
    );

    // You can alternatively build both the entity and body at once.
    let (entity, body_handle) = emd.world()
        .spawn_with_body(
            (Transform::from_translation((0.0, 0.0))),
            RigidBodyBuilder::dynamic()
        )?;

Physics Stepping

    emd.world()
        .physics()
        .step();

You decide when physics steps! This makes it very easy to "pause" the game without needing to alter any data.

Graphics

The default method to draw the game is to draw all of the entities in the current world. However, you can write your own draw function if you need to do more!

fn draw(&mut self, mut emd: Emerald) {
    emd.graphics().begin();

    emd.graphics().draw_world();

    emd.graphics().render();
}

Audio

let my_sound = emd.loader().sound("sounds/my_song.ogg")?;

emd.audio().mixer("background_music")?.play_and_loop(my_sound);

ECS

Emerald uses the Entity Component System paradigm for creating, managing, and updating game entities.

Emerald uses Hecs under the hood for fast entity iteration, and a remarkably clean query Api.

More detailed features can be found in the Hecs documentation.

for (id, (sprite, mut position)) in emd.world().query::<(&Sprite, &mut Position)>().iter() {
    position.x += 10.0;
}

Aseprite

Emerald has built in aseprite loading and rendering. Simply load in the file, then tell it which animations to play.

let mut aseprite = emd.loader().aseprite("my_sprite.aseprite").unwrap();

aseprite.play("some_aseprite_animation");

emd.world().spawn((aseprite, Position::zero()));

Alternatively, Emerald can load a sprite sheet exported from aseprite.

let mut aseprite = emd.loader()
    .aseprite_with_animations("my_texture.png", "my_animation.json").unwrap();

Export settings Preferred export settings

WASM

Build

cargo build --target wasm32-unknown-unknown

Asset Loading

In order to keep a clean, simple API, and avoid network requests for assets. Emerald takes the approach of packing all necessary assets into the WASM binary.

This same method can be used to pack all assets into the game binary regardless of which platform you target.

Use the pack_bytes function to load data into the engine.

fn initialize(&mut self, mut emd: Emerald) {
    /// Pack all game files into WASM binary with path references
    /// so that the regular file loading Api is supported.
    #[cfg(target_arch = "wasm32")]
    {
        emd.loader()
            .pack_bytes(
                "bunny.png",
                include_bytes!(".bunny.png").to_vec()
            );
    }

    /// We can now load texture/sprites via the normal Api,
    /// regardless of which platform we're targeting.
    let sprite = emd.loader()
        .sprite("bunny.png")
        .unwrap();
    
    // Default transform at 0.0, 0.0
    let mut transform = Transform::default();

    self.count = 1000;
    emd.world().spawn_batch(
        (0..1000).map(|_| {
            transform.translation.x += 6.0;
            transform.translation.y += 1.0;
            let mut s = sprite.clone();
            (transform.clone(), s, Vel { x: 5.0, y: 3.0 })
        })
    );
}

Android

Build

Recommended way to build for Android is using Docker.

docker run --rm -v $(pwd)":/root/src" -w /root/src notfl3/cargo-apk cargo quad-apk build --example physics

See miniquad readme and cargo-quad-apk for more details.

Asset Loading

Add following to Cargo.toml and load assets as usual:

[package.metadata.android]
assets = "YOUR_ASSETS_DIRECTORY/"

Demos

  • Links
  • To
  • Hosted
  • WASM demos
  • with source code
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].