VERA20k

Red Alert 2 Yuri's Revenge — rebuilt from scratch in Rust

View the Project on GitHub hrusten/vera20k

The entire engine is built from two things: structs and functions. There are zero abstractions layers. Code are logically organized in files and folders. Codebase is therefore very machine and human friendly.

All game state lives in one struct: Simulation.

It contains:

Each of those is a plain struct or a map of structs. No behavior attached to them.

Each GameEntity is one struct with optional fields

Every object in the game — tank, soldier, building, aircraft — is the same struct. Always-present fields: stable_id, position, health, owner, facing, type_ref, category. Optional fields are Option<T>: a tank has locomotor + turret_facing + drive_track, a building has production, a harvester has miner. No component has methods — they’re all data.

Behavior is plain functions

(Example functions below)

These functions all read and write to the same Simulation struct. 45 times a second at 45 FPS(standard multiplayer FPS) There is no message buses, no event systems.

The game loop is one function calling the others in order

Simulation::advance_tick() calls: commands → movement → combat → vision → power → superweapons → production → AI → defeat check → state hash. Every tick, same order.

The render layer just reads the same structs

render/ reads GameEntity.position, .facing, .health, .is_voxel etc. to decide what to draw and where. It never writes to simulation state.

You can work on a module without neccesarly knowing anything on outside. Sim is hermetically sealed from render.