• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A game engine.

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.

WARNING: Koi is mostly in maintenance mode right now and is unfinished. I'm still using it for some things, but not actively working on it.

Projects I've built with koi

bloom3d

SIMD terrain generator

Last of the Sky Folk

Expect frequent build breaks!

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.

How to run examples

Install Rust: https://www.rust-lang.org/tools/install

On Mac and Windows run cargo run --example hello

For Web:

  • install devserver with cargo install devserver
  • run ./run.sh hello
  • Navigate your browser to localhost:8080

What works / doesn't work?

Everything is subject to massive change, but some parts are more functional than others.

Presently the core loop, user input, windowing, ECS, audio, and rendering are quite usable. Rendering will continue to change substantially but it already works for many purposes.

The user-interface (UI) code is nearly in an interesting and useful state but not it's quite there yet.

The "physics" code doesn't work at all. It's very work in progress.

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.

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
        }
    });
}

More Repositories

1

tangle

Radically simple multiplayer / networked WebAssembly
TypeScript
1,173
star
2

devserver

A simple HTTPS server for local development. Implemented in Rust.
Rust
95
star
3

LD46

An entry to Ludum Dare 46, written with Rust for Web
Rust
72
star
4

kapp

A pure Rust window and input library for Windows, Mac, and Web. (Work in progress)
Rust
56
star
5

open_world_game

Just a quick terrain generation experiment.
Rust
44
star
6

Bloom3D

A public issue tracker for Bloom3D.com
34
star
7

kudo

An Entity Component System for Rust. Fast, easy, and predictable. (Work in progress)
Rust
19
star
8

hello_triangle_wasm_rust

A zero-dependency 'hello triangle' sample that uses Rust, Wasm, and WebGL.
Rust
13
star
9

sprinkles

A tiny game engine for a blog post
HTML
5
star
10

Experiments

My own personal repository to store game development experiments not yet worthy of their own repository. Code is incomplete, broken, or bad, use at your own risk!
C#
5
star
11

wasm_set_stack_pointer

Expose a function from Rust WebAssembly that allows the host to set the stack pointer
Rust
3
star
12

tangle_website

Rust
3
star
13

minimal_uefi

A minimal Rust project to get started with UEFI
Shell
2
star
14

wasm_guardian

Rust
2
star
15

NoahsDilemma

A game for Ludum Dare 42. The theme is "Running out of space"
C#
2
star
16

LD48

An entry to Ludum Dare 48
Rust
2
star
17

kcolor

A Rust library for handling color in interactive applications (Work in progress)
Rust
2
star
18

LD50

Work-in-progress Ludum Dare entry
Rust
1
star
19

kgltf

glTF loader / saver for Rust
Rust
1
star
20

kui

UI toolkit experiments.
Rust
1
star
21

pacifickernel

A minimalist x86-64 C kernel.
C
1
star
22

kaudio

Unusable work in progress. An audio callback library for Rust. (Windows only)
Rust
1
star
23

rust_ecs

A test of writing an ECS using generic associated types. Unfinished
Rust
1
star