A game engine.

Related tags

Game development koi
Overview

koi

A game engine.

Developed in the open but not yet fit for public use. koi is currently designed for my active projects but I'd like to eventually make it useful to others as well.

Most parts are incomplete, code quality varies dramatically, and there are lots of bugs to fix.

Runs on Mac, Windows, and Web.

Everything is subject to change.

Crates

Stand-alone:

kapp: Windowing, input, and OpenGL context creation for Windows, Mac, and Web.

kgltf: GlTf loader autogenerated from the GlTf specification schema.

kecs: Archetype-based ECS that serves as the backbone of koi.

kmath: A tiny math library that uses const generics for generic math types.

kserde: Json serialization / deserialization. May support other formats in the future.

kaudio: Audio backend for Mac, Windows, and Web. (Presently does nothing on Windows)

Tailored to koi

kgraphics: A wrapper around OpenGL / WebGL to make it a bit more ergonomic. Very tailored to koi's specific needs.

klog: A log! macro that does the same thing as println but it also logs to the console on web.

kreflect: Incomplete Rust parser to be used by other proc-macros in koi crates.

wasm_set_stack_pointer: A hack needed to set the stack pointer of a new thread on web without preprocessing the Wasm binary.

ktasks: A multithreaded task system that works on native and web. Needs improvement.

kwasm: Rather hacky ways to interact with web APIs.

Example

This example creates a cube that can be controlled with the arrow keys and a camera that can view the cube.

use koi::*;

#[derive(Component, Clone)]
struct Controlled;

fn main() {
    App::new().setup_and_run(|world: &mut World| {
        // Setup things here.

        // Spawn a camera and make it look towards the origin.
        world.spawn((
            Transform::new()
                .with_position(Vec3::new(0.0, 4.0, 3.0))
                .looking_at(Vec3::ZERO, Vec3::Y),
            Camera::new(),
            CameraControls::new(),
        ));

        // Spawn a cube that we can control
        world.spawn((Transform::new(), Mesh::CUBE, Material::UNLIT, Controlled));

        move |event: Event, world: &mut World| {
            match event {
                Event::FixedUpdate => {
                    // Perform physics and game related updates here.

                    // Control the cube.
                    (|input: &Input, mut things_to_move: Query<(&mut Transform, &Controlled)>| {
                        for (transform, _) in &mut things_to_move {
                            if input.key(Key::Left) {
                                transform.position -= Vec3::X * 0.1;
                            }
                            if input.key(Key::Right) {
                                transform.position += Vec3::X * 0.1;
                            }
                            if input.key(Key::Up) {
                                transform.position -= Vec3::Z * 0.1;
                            }
                            if input.key(Key::Down) {
                                transform.position += Vec3::Z * 0.1;
                            }
                        }
                    })
                    .run(world)
                }
                Event::Draw => {
                    // Things that occur before rendering can go here.
                }
                _ => {}
            }

            // Do not consume the event and allow other systems to respond to it.
            false
        }
    });
}
You might also like...
A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music.
A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music.

rustris A no-frills Tetris implementation written in Rust with the Piston game engine, and Rodio for music. (C) 2020 Ben Cantrick. This code is distri

Inspector plugin for the bevy game engine
Inspector plugin for the bevy game engine

bevy-inspector-egui This crate provides the ability to annotate structs with a #[derive(Inspectable)], which opens a debug interface using egui where

Crossterm plugin for the bevy game engine
Crossterm plugin for the bevy game engine

What is bevy_crossterm? bevy_crossterm is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users

Concise Reference Book for the Bevy Game Engine

Unofficial Bevy Cheat Book Click here to read the book! Concise reference to programming in the Bevy game engine. Covers useful syntax, features, prog

Easy to use game engine
Easy to use game engine

arcana Arcana is a game engine built with focus on ease of use without compromising on level of control. Getting started Starting writing a game is as

Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions
Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions

Introduction Proof-of-concept of getting OpenXR rendering support for Bevy game engine using gfx-rs abstractions. (hand interaction with boxes missing

A physics lib for the bevy game engine based on physme

physimple Physimple aims to be the simplest(and capable) physics engine(currently for bevy) WARNING Beware for breaking changes with each update for n

An immediate mode 2D drawing API for Bevy game engine

Bevy Canvas API prototype An unofficial immediate mode 2D drawing API for Bevy game engine. Check the documentation or the examples to know how to use

Pure C Game Engine

Corange game engine Version 0.8.0 Written in Pure C, SDL and OpenGL. Running Corange is a library, but to take a quick look at some of the things it d

Comments
  • Compilation issue about the physics plugin

    Compilation issue about the physics plugin

    Whoops, it seems like adding a little CI would help this project a lot 😄

    You probably forget to add, commit and push the physics module from your local machine and, also have made a little typo on the physics_plguin function.

    error[E0583]: file not found for module `physics`
      --> src/lib.rs:60:1
       |
    60 | mod physics;
       | ^^^^^^^^^^^^
       |
       = help: to create the module `physics`, create file "src/physics.rs" or "src/physics/mod.rs"
    
    error[E0425]: cannot find function `physics_plguin` in this scope
       --> src/lib.rs:188:34
        |
    188 |         let app = app.add_plugin(physics_plguin());
        |                                  ^^^^^^^^^^^^^^ not found in this scope
    
    opened by Kerollmops 1
Owner
Ian Kettlewell
Ian Kettlewell
2d Endless Runner Game made with Bevy Game Engine

Cute-runner A 2d Endless Runner Game made with Bevy Game Engine. Table of contents Project Infos Usage Screenshots Disclaimer Project Infos Date: Sept

JoaoMarinho 2 Jul 15, 2022
A game of snake written in Rust using the Bevy game engine, targeting WebGL2

Snake using the Bevy Game Engine Prerequisites cargo install cargo-make Build and serve WASM version Set your local ip address in Makefile.toml (loca

Michael Dorst 0 Dec 26, 2021
A game made in one week for the Bevy engine's first game jam

¿Quien es el MechaBurro? An entry for the first Bevy game jam following the theme of "Unfair Advantage." It was made in one week using the wonderful B

mike 20 Dec 23, 2022
A Client/Server game networking plugin using QUIC, for the Bevy game engine.

Bevy Quinnet A Client/Server game networking plugin using QUIC, for the Bevy game engine. Bevy Quinnet QUIC as a game networking protocol Features Roa

Gilles Henaux 65 Feb 20, 2023
Solana Game Server is a decentralized game server running on Solana, designed for game developers

Solana Game Server* is the first decentralized Game Server (aka web3 game server) designed for game devs. (Think web3 SDK for game developers as a ser

Tardigrade Life Sciences, Inc 16 Dec 1, 2022
A refreshingly simple data-driven game engine built in Rust

What is Bevy? Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever! WARNING Bevy is still in the ve

Bevy Engine 21.1k Jan 4, 2023
A modern 3D/2D game engine that uses wgpu.

Harmony A modern 3D/2D game engine that uses wgpu and is designed to work out of the box with minimal effort. It uses legion for handling game/renderi

John 152 Dec 24, 2022
RTS game/engine in Rust and WebGPU

What is this? A real time strategy game/engine written with Rust and WebGPU. Eventually it will be able to run in a web browser thanks to WebGPU. This

Thomas SIMON 258 Dec 25, 2022
unrust - A pure rust based (webgl 2.0 / native) game engine

unrust A pure rust based (webgl 2.0 / native) game engine Current Version : 0.1.1 This project is under heavily development, all api are very unstable

null 368 Jan 3, 2023
Basic first-person fly camera for the Bevy game engine

bevy_flycam A basic first-person fly camera for Bevy 0.4 Controls WASD to move horizontally SPACE to ascend LSHIFT to descend ESC to grab/release curs

Spencer Burris 85 Dec 23, 2022