Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kettle11/koi
A game engine.
https://github.com/kettle11/koi
Last synced: about 1 month ago
JSON representation
A game engine.
- Host: GitHub
- URL: https://github.com/kettle11/koi
- Owner: kettle11
- License: apache-2.0
- Created: 2021-08-20T16:52:18.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-01T18:52:14.000Z (over 1 year ago)
- Last Synced: 2023-11-07T23:21:51.755Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 2.98 MB
- Stars: 138
- Watchers: 8
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE.md
Awesome Lists containing this project
README
# 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](https://bloom3d.com)
[SIMD terrain generator](https://ianjk.com/terrain_generator/)
[Last of the Sky Folk](https://ianjk.com/ld50/)
**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:
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.
```rust
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
}
});
}```