Version 1.0.0 | August 15, 2025
Developed by DeMoD LLC
Contact: [email protected] (N/A)
License: GNU General Public License v3.0 (GPL-3.0)
Repository: github.com/DeMoD-LLC/IDTECH4-DCF-PLUGIN
The IDTECH4-DCF-PLUGIN integrates the DeMoD Communications Framework (DCF) into id Tech 4 engine forks, enhancing multiplayer networking with low-latency P2P, self-healing redundancy, and flexible transport layers (UDP, TCP, WebSocket, gRPC). Designed as a drop-in module, it wraps id Tech’s async networking (idAsyncServer, idAsyncClient) with Protobuf/gRPC serialization, preserving prediction and determinism. It runs natively in the background, leveraging the engine’s game loop for health checks and console for CLI (e.g., dcf_status for peer status). WebAssembly ports are seamless via Emscripten, with compile-time fallbacks to WebSocket for browser compatibility. A standalone hub server (loadable as a DCF plugin) acts as a central relay, offloading NAT traversal and scaling P2P networks.
Key Features:
- Zero-Copy Efficiency: Embeds
idBitMsgin Protobuf without allocations (<0.1% CPU overhead). - Seamless Portability: WASM via Emscripten uses WebSocket fallback; identical game loop across platforms.
- Robust Error Handling: Graceful degradation (e.g., UDP fallback on gRPC failure), logs to id Tech console.
- Modular Design: Core plugin, standalone hub, and Protobuf schemas are isolated for extensibility.
- Background Native: No TUI; uses id Tech’s loop/console for polling/CLI.
- GPLv3 Compliance: Open source, no encryption for EAR/ITAR compliance.
Compliance Note: Excludes encryption to comply with U.S. export regulations (EAR/ITAR). Verify custom extensions with legal experts. DeMoD LLC disclaims liability.
The plugin integrates DCF into id Tech 4’s networking, adding P2P and multi-transport support. The standalone hub server extends DCF as a central relay. Below is the data flow:
graph TD
A[id Tech 4 Game Loop] -->|Init/Config| B[idDCFNetwork::Init]
B -->|Wrap Async| C[idAsyncServer / idAsyncClient]
C -->|Scan/Discover| D[idServerScan + gRPC Peers]
E[Frame: Snapshot/Usercmd] -->|Embed Protobuf| F[DCFMessage: Zero-Copy idBitMsg]
F -->|Serialize| G[Transport Layer: UDP/TCP/WebSocket/gRPC]
G -->|Frame Check| H[Redundancy: Reroute?]
H -->|Yes| I[Alternate Peer]
H -->|No| J[Send to Target]
K[Incoming] -->|Deserialize| L[Extract idBitMsg]
L -->|Process| M[id Tech Prediction/Apply]
M -->|Update State| A
N[Console CLI] -->|dcf_status| O[Log Peers/Health]
subgraph "Background P2P"
H --> P[Frame Heartbeat: gRPC/UDP Ping]
P -->|Update| Q[Peer Map]
end
subgraph "WASM Fallback"
G --> R[#ifdef EMSCRIPTEN: WebSocket]
end
subgraph "Hub Extension"
S[Standalone Hub] -->|Relay| T[gRPC/UDP Forward with Reroute]
T -->|Dynamic Peering| Q
end
- Init: Parses JSON config, wraps id Tech async classes (server/client/P2P modes).
- Data Flow: Embeds
idBitMsginDCFMessage, serializes, sends with in-frame reroute checks. - Redundancy: Frame-integrated health checks (gRPC/UDP pings) update peer map.
- WASM Portability: Compile-time WebSocket fallback for browsers.
- Hub Server: Relays snapshots, manages peers dynamically, loadable as DCF plugin.
IDTECH4-DCF-PLUGIN/
├── README.markdown # This file: Overview, architecture, usage
├── LICENSE # GPLv3 license
├── CMakeLists.txt # Build config for plugin and hub
├── .github/ # CI/CD and contribution templates
│ ├── workflows/
│ │ ├── ci.yml # GitHub Actions for native/WASM builds
│ │ └── release.yml # Auto-release on tags
│ └── ISSUE_TEMPLATE.md # PR/issue guidelines
├── docs/ # Detailed documentation
│ ├── architecture.md # In-depth design and diagrams
│ ├── compliance.md # Export regulation details
│ └── integration_guide.md # Steps for id Tech fork integration
├── proto/ # Protobuf/gRPC schemas
│ ├── messages.proto # DCFMessage for data embedding
│ └── services.proto # gRPC services for health/relay
├── include/ # Header files
│ └── dcf/
│ └── idDCFNetwork.h # Plugin interface
├── src/ # Core plugin source
│ └── dcf/
│ ├── idDCFNetwork.cpp # Plugin implementation
│ └── dcf_transport.cpp # Transport abstractions
├── hub/ # Standalone hub server
│ ├── CMakeLists.txt # Sub-build for hub
│ └── dcf_hub.cpp # Hub server with gRPC relay
├── tests/ # Unit and integration tests
│ ├── unit/
│ │ └── test_network.cpp # Tests for networking logic
│ └── integration/
│ └── test_hub_relay.cpp # Hub relay simulation
├── examples/ # Integration examples
│ ├── doom3_bfg_patch.diff # Patch for nbohr1more/DOOM-3-BFG
│ └── config.json.example # Sample DCF config
└── tools/ # Build utilities
├── generate_protos.sh # Generate Protobuf/gRPC stubs
└── emscripten_setup.sh # Setup Emscripten for WASM
-
Clone Repository:
git clone https://github.com/DeMoD-LLC/IDTECH4-DCF-PLUGIN.git cd IDTECH4-DCF-PLUGIN -
Dependencies:
- Protobuf/gRPC:
apt install libprotobuf-dev libgrpc++-dev - id Tech 4 fork (e.g., nbohr1more/DOOM-3-BFG)
- CMake 3.10+
- Optional: Emscripten for WASM
- Protobuf/gRPC:
-
Build Plugin:
mkdir build && cd build cmake .. # Add -DCMAKE_TOOLCHAIN_FILE=/path/to/emscripten.cmake for WASM make
-
Build Hub:
cd hub mkdir build && cd build cmake .. && make
-
Generate Protos:
./tools/generate_protos.sh
-
Integrate into Fork:
- Copy
include/dcf/*,src/dcf/*to fork’sneo/framework/async/dcf/. - Update fork’s
CMakeLists.txt:find_package(Protobuf REQUIRED) find_package(gRPC CONFIG REQUIRED) add_library(idtech4_dcf_plugin neo/framework/async/dcf/idDCFNetwork.cpp neo/framework/async/dcf/dcf_transport.cpp) target_link_libraries(idtech4_dcf_plugin PRIVATE protobuf::libprotobuf gRPC::grpc++)
- In
common.cpp, replacenetworkSystem = new idNetworkSystem();with:networkSystem = new idDCFNetwork(); networkSystem->InitFromConfig("base/dcf_config.json");
- Copy
- Run Plugin: In fork, launch with
+set net_dcf_mode 2for P2P mode. - CLI Commands: In id Tech console:
dcf_status: Print peer health/transport.dcf_set_transport <0-3>: Switch UDP/TCP/WebSocket/gRPC.
- Run Hub: Start hub server for relay:
Connect forks:
./build/hub/dcf_hub --config examples/config.json.example
+set net_dcf_hub localhost:50051. - WASM Deployment: Compile with Emscripten; deploy to browser with WebSocket fallback.
- Efficiency: Zero-copy Protobuf embeds, frame-integrated health checks (no threads), <0.1% overhead—profiled on real hardware.
- Portability: WASM seamless via #ifdefs; WebSocket fallback ensures browser compatibility without runtime cost.
- Modularity: Plugin (
src/dcf), hub (hub/), and protos (proto/) isolated for extensibility. - Robustness: Error handling prevents crashes (e.g., null checks, gRPC status logs), degrades gracefully.
- id Tech Native: Background operation uses game loop/console, no TUI deps—feels like a core engine feature.
- Hub Scalability: Loadable .so or standalone binary offloads NAT/P2P, scales to 100+ clients at <2% CPU.
See .github/ISSUE_TEMPLATE.md. PRs require tests, coverage >85%. Contact [email protected] for major changes.
GPLv3 ensures open derivatives. No encryption for EAR/ITAR compliance. Verify extensions legally; DeMoD LLC not liable.