{"id":50823273,"url":"https://github.com/sunsided/room","last_synced_at":"2026-06-13T16:10:39.961Z","repository":{"id":358336726,"uuid":"1226158898","full_name":"sunsided/room","owner":"sunsided","description":"Doomgeneric re-implemented in Rust. Rip and tear down undefined behavior.","archived":false,"fork":false,"pushed_at":"2026-06-04T18:17:58.000Z","size":4856,"stargazers_count":2,"open_issues_count":16,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-04T21:10:06.475Z","etag":null,"topics":["doom","doomgeneric","game-port","game-programming","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunsided.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-GPL-2.0","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-01T03:26:14.000Z","updated_at":"2026-06-04T18:18:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sunsided/room","commit_stats":null,"previous_names":["sunsided/room"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sunsided/room","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Froom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Froom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Froom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Froom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/room/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Froom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34290600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doom","doomgeneric","game-port","game-programming","rust"],"created_at":"2026-06-13T16:10:39.071Z","updated_at":"2026-06-13T16:10:39.952Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# room\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\".readme/room.png\" alt=\"room screenshot\" /\u003e\n\u003c/div\u003e\n\nA complete Rust port of [doomgeneric](https://github.com/ozkl/doomgeneric) using\n[winit](https://github.com/rust-windowing/winit) and [wgpu](https://github.com/gfx-rs/wgpu)\nfor the platform layer.\n\n## What is this?\n\n`room` is a **complete Rust port** of the classic DOOM engine based on\n[doomgeneric](https://github.com/ozkl/doomgeneric). Every engine module has\nbeen rewritten in native Rust; no C engine code remains linked. However, it is not\nidiomatic Rust yet, and contributions are welcome.\n\nThe port was done **module-by-module**:\n\n1. Each module was rewritten in Rust inside `room/src/doom/` and exported\n   with `#[no_mangle] extern \"C\"` so the linker picked the Rust symbol\n   instead of the C one.\n2. Once replaced, the corresponding `.c` file was removed from\n   `doomgeneric-sys/build.rs`.\n3. The platform layer (window creation, GPU rendering, keyboard input) is\n   pure Rust, built on [winit](https://github.com/rust-windowing/winit)\n   and [wgpu](https://github.com/gfx-rs/wgpu).\n\nThe `lib_sources` list in `doomgeneric-sys/build.rs` is now empty — all engine\nsubsystems (`r_draw`, `p_setup`, `z_zone`, `g_game`, `d_main`, and every other\nmodule) are native Rust.\n\nA regression-test harness (`room/src/doom/c_tests/`) runs the original C\nfunctions alongside their Rust replacements to verify bit-for-bit behavioural\ncompatibility before a module is declared ported.\n\nSound effects and music are implemented via [rodio](https://github.com/RustAudio/rodio). SFX uses stereo panning; music uses the [Roland SC-55 SoundFont](https://github.com/GuihongWang/SC55Soundfont) via [rustysynth](https://github.com/sinshu/rustysynth). A custom soundfont can be specified with `-sf2 \u003cpath\u003e`.\n\n## Project layout\n\n```\nroom/\n├── Cargo.toml               Workspace manifest\n├── vendor/\n│   └── doomgeneric/         Vendored C source from ozkl/doomgeneric\n├── doomgeneric-sys/         FFI + C compilation crate\n│   ├── build.rs             Compiles remaining C modules via the `cc` crate\n│   └── src/lib.rs           Declarations for C entry points (doomgeneric_Create, etc.)\n└── room/                    Rust binary crate\n    └── src/\n        ├── main.rs          winit ApplicationHandler and entry point\n        ├── gpu.rs           wgpu renderer (texture upload + fullscreen blit)\n        ├── platform/\n        │   ├── mod.rs       DG_* C-callable platform callbacks\n        │   └── keys.rs      winit KeyCode → Doom key byte mapping\n        └── doom/\n            ├── mod.rs       Rust reimplementations of ported engine modules\n            ├── c_ffi.rs     FFI declarations for still-C modules (used by tests)\n            ├── c_tests/     Regression tests comparing C vs Rust behaviour\n            ├── d_main.rs    Ported main entry point and game init\n            ├── r_draw.rs    Ported renderer core\n            ├── p_setup.rs   Ported map loader\n            ├── z_zone.rs    Ported zone memory allocator\n            └── …            One `.rs` module per original `.c` file\n```\n\n## Prerequisites\n\n- A Rust toolchain (stable, ≥ 1.75).\n- A C compiler (`gcc` or `clang`).\n- A Doom WAD file (`doom1.wad`, `doom.wad`, `doom2.wad`, `freedoom1.wad`, …).\n  The shareware episode is freely available from many sources.\n\n## Building\n\n```bash\ncargo build --release\n```\n\n## Running\n\n```bash\ncargo run --release -- -iwad /path/to/doom1.wad\n```\n\nAny arguments after `--` are forwarded to the Doom engine unchanged.\n\n## How it works\n\nThe engine runs inside the winit event loop:\n\n1. `ApplicationHandler::resumed` creates the window and initialises the wgpu\n   renderer, storing both in thread-local statics accessible to the `DG_*`\n   callbacks.\n2. `ApplicationHandler::about_to_wait` calls `doomgeneric_Create` on the first\n   invocation (which initialises all Doom subsystems and runs the first tick),\n   then `doomgeneric_Tick` on every subsequent invocation.\n3. `DG_DrawFrame` (called from inside `doomgeneric_Tick`) uploads the 640 × 400\n   BGRA pixel buffer produced by `I_FinishUpdate` to a wgpu texture and blits\n   it to the swapchain surface via a fullscreen-quad render pass.\n4. Keyboard events collected by `ApplicationHandler::window_event` are placed\n   into a `VecDeque`; `DG_GetKey` pops them one at a time per tick.\n\n## Known limitations\n\n- **No mouse support.**  Mouse aiming / strafing are not yet implemented.\n- **No joystick support.**\n- **Single player only.**  Networking (`FEATURE_MULTIPLAYER`) is not compiled in.\n- The renderer performs a nearest-neighbour upscale from the native 640 × 400\n  resolution to the window size; the window is currently fixed at 640 × 400.\n\n## Ported modules\n\nAll vendored `.c` modules have been removed from `doomgeneric-sys/build.rs` and\nfully replaced by Rust code in the `room` crate. Port complete.\n\n### Engine core / game loop\n\n- [x] `d_event.c`\n- [x] `d_items.c`\n- [x] `d_iwad.c`\n- [x] `d_loop.c`\n- [x] `d_main.c`\n- [x] `d_mode.c`\n- [x] `d_net.c`\n- [x] `doomdef.c`\n- [x] `doomstat.c`\n- [x] `dstrings.c`\n- [x] `dummy.c`\n- [x] `doomgeneric.c`\n\n### Game logic (`g_*`, `p_*`)\n\n- [x] `g_game.c`\n- [x] `p_ceilng.c`\n- [x] `p_doors.c`\n- [x] `p_enemy.c`\n- [x] `p_floor.c`\n- [x] `p_inter.c`\n- [x] `p_lights.c`\n- [x] `p_map.c`\n- [x] `p_maputl.c`\n- [x] `p_mobj.c`\n- [x] `p_plats.c`\n- [x] `p_pspr.c`\n- [x] `p_saveg.c`\n- [x] `p_setup.c`\n- [x] `p_sight.c`\n- [x] `p_spec.c`\n- [x] `p_switch.c`\n- [x] `p_telept.c`\n- [x] `p_tick.c`\n- [x] `p_user.c`\n\n### Renderer (`r_*`)\n\n- [x] `r_bsp.c`\n- [x] `r_data.c`\n- [x] `r_draw.c`\n- [x] `r_main.c`\n- [x] `r_plane.c`\n- [x] `r_segs.c`\n- [x] `r_sky.c`\n- [x] `r_things.c`\n\n### Automap / HUD / status bar / finale / intermission\n\n- [x] `am_map.c`\n- [x] `hu_lib.c`\n- [x] `hu_stuff.c`\n- [x] `st_lib.c`\n- [x] `st_stuff.c`\n- [x] `f_finale.c`\n- [x] `f_wipe.c`\n- [x] `wi_stuff.c`\n- [x] `statdump.c`\n\n### Menu / misc / math\n\n- [x] `m_argv.c`\n- [x] `m_bbox.c`\n- [x] `m_cheat.c`\n- [x] `m_config.c`\n- [x] `m_controls.c`\n- [x] `m_fixed.c`\n- [x] `m_menu.c`\n- [x] `m_misc.c`\n- [x] `m_random.c`\n- [x] `tables.c`\n- [x] `info.c`\n\n### Platform / system (doomgeneric side, not the Rust host)\n\n- [x] `i_cdmus.c`\n- [x] `i_endoom.c`\n- [x] `i_input.c`\n- [x] `i_joystick.c`\n- [x] `i_scale.c`\n- [x] `i_sound.c`\n- [x] `i_system.c`\n- [x] `i_timer.c`\n- [x] `i_video.c`\n\n### Sound effects and music subsystem\n\n- [x] `s_sound.c` - sound and music state machine fully ported\n- [x] `sounds.c` - SFX and music tables fully ported\n- [x] `i_sound.c` - SFX playback via rodio (stereo pan); music via rustysynth + SC-55 soundfont\n\n### Video / WAD / memory / utilities\n\n- [x] `v_video.c`\n- [x] `w_checksum.c`\n- [x] `w_file.c`\n- [x] `w_file_stdc.c`\n- [x] `w_main.c`\n- [x] `w_wad.c`\n- [x] `memio.c`\n- [x] `sha1.c`\n- [x] `z_zone.c`\n\n## License\n\nThis repository includes the unmodified Doom shareware IWAD, `doom1.wad`,\ncopyright id Software. It is included under the Doom shareware distribution\nterms. The full registered/commercial Doom IWADs are not included and are\nnot redistributable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Froom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Froom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Froom/lists"}