game#
The game core: a world of entities and components, a fixed tick, input actions, cameras -- crate root lib/game/src/lib.rs
game -- the core of the game engine (docs/GAME.md, G7b): a world of entities and components, a fixed
tick, input actions, camera controllers; without a GPU, so a game's server runs it headless
World entities with a generation (stale ids are refused), components in dense columns per
type (SparseSet: sparse sets, versions of every change), spawn_with / despawn /
insert / remove / get / get_mut / column / pair_mut; begin_tick settles the poses
Pose where an entity is (Transform: f64 position, rotation, scale), now and at the start of
the tick: a frame shows interpolate(alpha)
FixedTick the fixed rate (60 Hz unless set), an exact accumulator over time from outside, a cap
on catch-up steps, alpha; Systems (functions in a fixed order), Game (all of it)
Input ActionMap (Button, Axis, Motion actions bound to keys by their place, mouse buttons,
the wheel, the raw motion), MouseSettings (sensitivity, inversion, a factor per
platform), the pointer lock's click and end; store / load in a settings file (base::Ini)
camera FirstPerson, Follow (an orbit, pulled in front of walls through lib/physics), FreeFly;
View (eye, forward, up)
assets (G7b part 2) Assets<T>: files through the VFS decoded in the background (plat's blocking
pool, or a budget per frame), Handle<T> with a state (Loading, Ready, Failed), counted
references, unloading; the kinds are types (Asset::decode; glTF and images in game_render3d)
audio (G7b part 2) SpatialAudio over plat::audio's mixer: a listener (the camera's View), Emitter
components and sounds at points, the gain by distance (Attenuation), the pan by direction
render3d is not a dependency: the bridge that puts entities with a mesh into a render3d scene is the
crate game_render3d. Everything here is deterministic: no unordered containers, no threads, no clock
of its own (time comes from outside), floats only through + - * / and lib/physics' math (its correctly
rounded square root, rt's portable sin and cos). The one exception is assets: with Loading::Background
an asset becomes Ready when its thread is done (what a frame shows, never what the simulation computes).
docs/GAMECORE.md describes the design and the tests (apps/gametest).
Sections
- game crate root
- game/src/assets.rs
- game/src/audio.rs
- game/src/camera.rs
- game/src/input.rs
- game/src/net/arena.rs
- game/src/net/bits.rs
- game/src/net/bot.rs
- game/src/net/client.rs
- game/src/net/clock.rs
- game/src/net/event.rs
- game/src/net/input.rs
- game/src/net/lagcomp.rs
- game/src/net/link.rs
- game/src/net/predict.rs
- game/src/net/proto.rs
- game/src/net/quant.rs
- game/src/net/room.rs
- game/src/net/server.rs
- game/src/net/sim.rs
- game/src/net/snapshot.rs
- game/src/net/walker.rs
- game/src/pose.rs
- game/src/sparse.rs
- game/src/tick.rs
- game/src/world.rs