4 releases (stable)
new 1.1.1 | Mar 7, 2025 |
---|---|
1.0.0 | Mar 6, 2025 |
0.0.1 | Mar 6, 2025 |
#71 in Hardware support
143 downloads per month
7MB
639 lines
lidoom
DOOM port for Project Lighthouse.
Building
To build the project, run
cargo build
Optionally, you can build it with a GUI. This requires SDL2, see these instructions. If you are running macOS and have installed SDL2 via Homebrew, you can source the following script to add the Homebrew-provided SDL2 to your library path:
source ./buildenv.sh
Then build the project with the gui
flag:
cargo build --features gui
[!TIP] If you are developing with rust-analyzer in VSCode, add the following to your
.vscode/settings.json
to enable language support in the GUI module:{ "rust-analyzer.cargo.features": ["gui"] }
Running
Make sure to have the following environment variables set or in a .env
file in the working directory:
LIGHTHOUSE_USER=<your user>
LIGHTHOUSE_TOKEN=<your token>
Additionally, make sure that your working directory contains a DOOM WAD (e.g. DOOM1.WAD
), which you need to obtain externally, then run
cargo run
Optionally, use
--features gui
here too.
Input
The game can take input both via the Lighthouse frontend (LUNA) and via the SDL GUI. When using the Lighthouse frontend, make sure to leave "Legacy Mode" unchecked.
Controls
The controls are mapped in a relatively standard fashion, applying the modern conventions for FPS-style games:
- Mouse:
- Movement controls camera (though only if pointer is locked, which can be done by clicking the window to lock and pressing escape to unlock)
- Left button fires
- Keyboard:
- WASD controls movement
- Arrow keys control camera
- Shift enables sprint
- Space fires
- Ctrl uses an item
- Gamepad:
- Left stick/d-pad control movement
- Right stick controls camera
- Menu button opens the escape menu
- Cluster left button (Xbox: "X", PS: Square) enables sprint
- Cluster bottom button (Xbox: "A", PS: Cross) presses enter
- Cluster right button (Xbox: "B", PS: Circle) uses an item
All of these mappings are implemented in mapper.rs
.
Architecture
Internally, lidoom uses a number of threads and virtual threads (Tokio tasks) to communicate. This architecture allows for robust bridging between blocking contexts (e.g. the SDL GUI on the main thread or DOOM, which runs on its own thread) and Tokio's async tasks (for the communication with the lighthouse server). Graphically, the architecture can be visualized as follows:
flowchart LR
Lighthouse[Lighthouse server]
subgraph lidoom
subgraph Tokio threads
Controller
Mapper
Updater
end
subgraph DOOM thread
DOOM
end
subgraph Main thread
GUI
end
Controller -- ControllerMessage --> Mapper
GUI -- ControllerMessage --> Mapper
Mapper -- MapperMessage --> DOOM
DOOM -- UpdaterMessage --> Updater
DOOM -- GUIMessage --> GUI
end
Lighthouse --> Controller
Updater --> Lighthouse
Dependencies
~13–24MB
~332K SLoC