Expand description
Deterministic pure-Rust Doom simulator with semantic + depth perception buffers alongside the classic 320x200 indexed framebuffer.
The engine is #![no_std] (uses alloc), headless by default, and
generic over a GameRules implementation — the built-in
ClassicDoomRules reproduces classic single-player; user code can
substitute its own rules for bespoke multiplayer or AI training setups.
§Layout
DoomEngine/ClassicEngine— top-level orchestrator. Owns theWorld,map::MapData,texture::TextureData, and arender::Renderer. SeeDoomEngine::tick(single-player) orDoomEngine::simulate+DoomEngine::render_for(multi-peer).World— entities, controllers, per-player state, sector state. Deterministic, serializable.rules::GameRules— the transition function; onetickper simulation step.render— BSP / wall / plane / sprite rasterizer, HUD overlay, and theSemanticClass/ depth buffers exposed to AI code.perception::PerceptionFrame— a snapshot of(semantic, depth)ready for downsampling or feature extraction.combat/physics/specials— reusable gameplay helpers used byClassicDoomRules; available to custom rule impls.
§Quick start
use neurodoom::{ClassicEngine, PeerId, PlayerAction};
let wad = std::fs::read("doom1.wad")?;
let mut engine = ClassicEngine::new(&wad, "E1M1")?;
engine.tick_single(PeerId(0), PlayerAction::default());
let rgba = engine.framebuffer(); // 320 * 200 * 4 bytes
let _semantic = engine.semantic_buffer(); // one SemanticClass per pixel
let _depth = engine.depth_buffer(); // fixed-point distance per pixelRe-exports§
pub use classic::ClassicDoomRules;pub use engine::ClassicEngine;pub use engine::DoomEngine;pub use engine::DoomError;pub use math::Angle;pub use math::Fixed;pub use math::SCREENHEIGHT;pub use math::SCREENWIDTH;pub use perception::PerceptionFrame;pub use render::SemanticClass;pub use render::ViewParams;pub use types::AmmoType;pub use types::ArmorType;pub use types::Button;pub use types::Buttons;pub use types::Card;pub use types::MoveDir;pub use types::WeaponType;pub use rules::GameRules;pub use rules::PlayerAction;pub use rules::TouchResult;pub use rules::WorldAction;pub use world::Entity;pub use world::EntityId;pub use world::EntityType;pub use world::HasPose;pub use world::LevelExit;pub use world::PeerId;pub use world::PlayerState;pub use world::Pose;pub use world::World;
Modules§
- classic
- Classic Doom game rules — the built-in
GameRulesimplementation. - combat
- Core reusable gameplay logic — state machines, combat, AI, weapons.
- demo
- Parser for classic Doom demo (
LMP) lumps. - engine
- Top-level engine — owns the world, map, textures, and renderer, and exposes the tick / render API.
- map
- Map geometry loaded from a WAD: vertexes, sectors, linedefs, sidedefs, segs, subsectors, BSP nodes, blockmap, REJECT, and the raw THINGS list.
- math
- Fixed-point arithmetic, Binary Angle Measurement (BAM), and the screen-size constants used across the engine.
- perception
- AI-facing snapshot of the engine’s semantic + depth buffers.
- physics
- Entity motion, collision, sight-line checks, and BSP / blockmap
queries. Stateless free functions on
&mut Entity+&MapData, usable from anycrate::rules::GameRulesimplementation. - render
- Software BSP + column-based rasterizer that matches classic Doom’s
visual output, with two extra buffers for AI perception:
Renderer::semantic(oneSemanticClassper pixel) andRenderer::depth(fixed-point distance per pixel). - rules
- Game rules trait — the deterministic transition function.
- specials
- Sector specials: doors, lifts, switches, exit triggers, animated
lights. Spawned from the map’s static sector/linedef flags at load
time by
spawn_specials, advanced once per tick byupdate_specials. Consumed bycrate::combat::use_linesandcrate::combat::check_crossed_lines. - texture
- WAD visual assets: palettes, colormaps, wall textures, flats, and
sprite patches. Loaded from a parsed [
crate::wad::Wad] viaTextureData::loadand resolved againstcrate::map::MapDataso each sidedef/sector holds a resolved index into the tables rather than a raw WAD name. - types
- Game-specific enums and bitflags for type-safe gameplay code.
- world
- World state — the complete, serializable, deterministic game state.