kota's memex

https://bevyengine.org/

A refreshingly simple data-driven game engine using rust. Bevy's ecs implementation uses normal rust datatypes. Additionally, all of the engine's features can be enabled, disabled, and replaced at will making it extremely flexible for whatever you have in mind.

getting started

cargo new toon-water
cd toon-water
cargo add bevy

echo .nvim.lua >> .gitignore
nvim .nvim.lua

local map = vim.api.nvim_set_keymap

map("n", "<space>r", ":wa<CR>:terminal cargo run --features bevy/dynamic_linking<CR>", {
	desc = "Run game",
	noremap = true,
})
vim.api.nvim_create_autocmd("TermClose", {
	callback = function()
		vim.cmd("bdelete")
	end
})

nvim .rustfmt.toml

max_width = 80
hard_tabs = true

nvim Makefile

.POSIX:

all: toon-water

toon-water:
	cargo build --release

watch:
	fd . src | entr -rcs "cargo run --features bevy/dynamic_linking ."

.PHONY: toon-water watch

bevy plugins

Bevy prioritizes modularity as a core principle. All engine features are implemented as plugins, even the complex ones like rendering.

.add_plugins(DefaultPlugins)

bevy components

Rust structs with the component trait:

#[derive(Component)]
struct Position {
    x: f32,
    y: f32,
}

bevy entities

A simple type containing a unique integer:

struct Entity(u64);

bevy systems

Normal rust functions:

fn print_position_system(query: Query<&Position>) {
    for position in &query {
        println!("position: {} {}", position.x, position.y);
    }
}

bevy resources

The Entity and Component data types are great for complex, query-able groups of data. But most Apps will also require "globally unique" data of some kind. We represent this in bevy with the Resource trait. For example:

wayland

[dependencies]
bevy = { version = "0.15.0", features = ["wayland"] }

crates

https://github.com/simgine/bevy_enhanced_input

A bit of a successor to leafwing.

https://github.com/NiklasEi/bevy_asset_loader

Sits at a slightly higher level from bevy's native asset loading tools.

https://github.com/bluefinger/bevy_rand

A rand implementation which works better with ECS games than the default.

https://github.com/corvusprudens/bevy_seedling

A new powerful ECS based audio engine.

https://github.com/Razaekel/noise-rs

Procedural noise generation library for Rust.

https://github.com/jakobhellermann/bevy-inspector-egui

Inspector plugin that lets you browse and edit your entities while running the game.

https://crates.io/crates/bevy_smooth_pixel_camera

A pixel game camera where the camera itself and smoothly slide around between sub-pixels.

https://crates.io/crates/iyes_progress

Makes implementing "loading screens" or really any situation where you need to see progress updates while a lot of work is being done.

https://github.com/Jondolf/avian

ECS-driven 2D and 3D physics engine for the Bevy game engine.

https://github.com/sarkahn/bevy_ascii_terminal

Method for rendering colorful ascii in bevy.

resources

https://taintedcoders.com/

Lots of helpful snippets and gotchas for bevy.

https://github.com/TheBevyFlock/bevy_cli

A Bevy CLI tool and linter.