How johnimril/diablo_web works
Diablo Web is a React/TypeScript browser client for playing Diablo through an existing WebAssembly engine. The main workflow is choosing demo or retail game data, preparing browser save storage, starting the engine through a worker, and then handling input, rendering, and saves. The graph also preserves save management, MPQ compression, updates, error reporting, and experimental multiplayer. Some runtime and storage implementation files were not sampled, so their documented connections are cited to the README rather than inferred from module names.
Main entry points: App.tsx Application shell · game.worker.ts Game worker · gameRuntime.ts Runtime lifecycle · saveManager.ts Save operations
Components 28
Browser experience
- Application shell
src/App.tsx - Start screen
src/components/StartScreen/StartScreen.tsx - Save manager UI
src/components/SaveList/SaveList.tsx - MPQ compression UI
src/app/ui/CompressMpq.tsx - Loading display
src/components/LoadingComponent/LoadingComponent.tsx
Game runtime
- Runtime lifecycle
src/app/runtime/gameRuntime.ts - Runtime input
src/app/runtime/runtimeInput.ts - Runtime state
src/app/runtime/runtimeState.ts - Engine loader
src/modules/engine/adapters/engineLoader.ts - Game worker
src/modules/engine/adapters/game.worker.ts - Worker protocol
src/modules/engine/core/protocol.ts - Input mapping
src/modules/engine/core/inputMapping.ts
Game data and saves
- IndexedDB filesystem
src/modules/storage/adapters/indexedDbFs.ts - Storage ownership
src/modules/storage/adapters/storageOwnership.ts - Save operations
src/modules/storage/adapters/saveManager.ts - Save parsing
src/shared/parsers/saveFile.ts - Save rules
src/modules/storage/core/saveRules.ts - Save extraction
src/modules/storage/core/explode.ts - MPQ compression
src/modules/mpqcmp/adapters/compress.ts - Compression worker
src/modules/mpqcmp/adapters/mpqCmp.worker.ts
Browser services
- Update coordination
src/app/updates/updateCoordinator.ts - PWA updates
src/app/updates/pwaUpdates.ts - Error handling
src/app/uiHooks/useErrorHandling.tsx - Error reports
src/app/runtime/errorReport.ts
Experimental multiplayer
- WebSocket client
src/modules/network/adapters/webSocketClient.ts - WebRTC client
src/modules/network/adapters/webrtcClient.ts - Packet codec
src/modules/network/core/packetCodec.ts
Other components
- Player
Connections 30
- Player → Start screen: chooses game
README.md - Start screen → Application shell: starts session
src/components/StartScreen/StartScreen.tsx - Player → Application shell: drops game file
README.md - Application shell → Runtime lifecycle: starts runtime
src/App.tsx - Application shell → Storage ownership: prepares storage
- Runtime lifecycle → IndexedDB filesystem: prepares saves
- Runtime lifecycle → Engine loader: loads engine
- Engine loader → Game worker: starts worker
src/modules/engine/adapters/engineLoader.ts - Engine loader → Worker protocol: uses messages
src/modules/engine/adapters/engineLoader.ts - Game worker → Worker protocol: validates messages
src/modules/engine/adapters/game.worker.ts - Game worker → IndexedDB filesystem: writes game files
- Runtime lifecycle → Runtime input: routes input
- Runtime input → Input mapping: maps commands
- Application shell → Loading display: shows progress
src/App.tsx - Application shell → Save manager UI: manages saves
src/App.tsx - Save manager UI → Save operations: uses save operations
- Save operations → IndexedDB filesystem: reads and writes
src/modules/storage/adapters/saveManager.ts - Save operations → Save parsing: parses player data
src/modules/storage/adapters/saveManager.ts - Save parsing → Save extraction: extracts save data
src/shared/parsers/saveFile.ts - Save operations → Save rules: applies save rules
src/modules/storage/adapters/saveManager.ts - Player → MPQ compression UI: requests compression
README.md - MPQ compression UI → MPQ compression: compresses archive
- MPQ compression → Compression worker: uses worker
- Application shell → PWA updates: tracks updates
src/App.tsx - PWA updates → Update coordination: coordinates updates
src/app/updates/pwaUpdates.ts - Application shell → Error handling: handles errors
src/App.tsx - Error handling → Error reports: creates report
src/app/uiHooks/useErrorHandling.tsx - Game worker → WebSocket client: opens socket
src/modules/engine/adapters/game.worker.ts - Game worker → WebRTC client: bridges multiplayer
- WebRTC client → Packet codec: encodes packets
src/modules/network/adapters/webrtcClient.ts