- Rust 95%
- Nix 5%
Scaffolded from the thotlab bevy template (crane-cached dependency closure,
packages/apps/checks/devShells per system), customized for ggez 0.5:
- nix/ggez-deps.nix declares the native libs once for build and dev shell:
alsa-lib, udev (gilrs -> libudev-sys) and wayland at build time; the X11
client libraries dlopen'd by x11-dl on LD_LIBRARY_PATH at runtime
- nix/package.nix keeps resources/ past cleanCargoSource and wraps the
binary so it cd's into $out/share/cell-graph-risk (ggez loads ./resources
relative to CWD)
Ported the 2021 code to nixpkgs' stable rustc:
- src/main.rs: drop the nightly feature gates
- src/game_mechanics/fighting.rs: drain_where() replaces Vec::drain_filter
- src/physics.rs: in-band lifetime rewritten with elision (+ '_ return)
- src/game_mechanics.rs: explicit references at the raw-pointer autoref
sites now denied by dangerous_implicit_autorefs
Verified: nix build and checks.x86_64-linux.{build,clippy,test} pass.
X-model: crane-qwen38-heretic-q5
X-harness: pi-coding-agent 0.87.1
X-session-id: 01a153da-f5d5-7561-bf40-c87a195ed1fe
|
||
|---|---|---|
| .claude | ||
| .idea | ||
| nix | ||
| resources | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Cell-Graph-Risk.iml | ||
| flake.lock | ||
| flake.nix | ||
| README.md | ||
Cell-Graph-Risk
A small somewhat risk-like game I've been thinking about for a while now. It is based upon a special physics simulation with elastic graphs at its core. I've implemented it to learn some Rust, using the wonderful ggez.
Gameplay
It's a local mutliplayer strategy game where players create and cut connections between cells and then jump between them and send units across. They battle for domination over the white cells, which are able to create new units.
Cells
- Basic
- able to create new connections and cells
- also able to split
- Wall
- easier to defend
- can form impenetrable walls when connected to other wall cells
- Propulsion
- can burn units to accelerate
- Cancer
- hostile
- slowly produces units
- actively connects to other cells
Controls
| Input | Effect |
|---|---|
| left stick | jump between cells / control cursor for new connections/cells / control propulsion |
| right stick | choose connection |
| A | create a new connection/cell OR burn units for propulsion |
| B | release immediately to cut connection; hold longer to remove cell; hold even longer to abort |
| X | shorten connection |
| Y | lengthen connection |
| LB | start sending units over connection |
| RB | stop sending units over connection |
| LT | increase number of units that have to be stored before additional units are sent to other cells |
| RT | decrease number of units that have to be stored before additional units are sent to other cells |
| digipad-UP | mutate into basic cell OR split |
| digipad-RIGHT | mutate into wall cell |
| digipad-LEFT | mutate into propulsion cell |
| digipad-DOWN | mutate into cancer cell |
| Select | change displayed information |
Press any button to join.
Development with Nix
The repo is a self-contained flake (crane for the Rust build):
nix develop # cargo + rustc + clippy + rust-analyzer + mold, X11 libs on LD_LIBRARY_PATH
cargo run # play it (fullscreen)
nix build # package: binary + resources/, wrapper cd's into the resources dir
nix run .#default # run the packaged binary
nix flake check # build + clippy + tests (shared cached dependency closure)
The 2021 code was ported to nixpkgs' stable rustc: the nightly feature gates in
src/main.rs are gone (drain_filter replaced by drain_where in
src/game_mechanics/fighting.rs, the in-band lifetime in src/physics.rs
made explicit), and the raw-pointer autoref sites in src/game_mechanics.rs
now take their references explicitly. Native library needs (X11 dlopen'd by
x11-dl, ALSA, udev, wayland) live in nix/ggez-deps.nix.

