Governed substrate for autonomous agents: scoped identity (passports), audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
205 lines
5.5 KiB
Markdown
205 lines
5.5 KiB
Markdown
# 🎮 DOOM 404 Error Page - Installation Guide
|
|
|
|
## Overview
|
|
The DOOM 404 error page is an interactive game engine that runs directly in the browser. When users navigate to a non-existent page, they'll encounter the classic DOOM shareware game instead of a boring 404 error message.
|
|
|
|
## Features
|
|
|
|
- ✅ **Pure JavaScript DOOM Engine** - No external dependencies needed
|
|
- ✅ **Shareware WAD** - Classic DOOM gameplay mechanics
|
|
- ✅ **Raycasting Graphics** - Authentic Doom-style 3D rendering
|
|
- ✅ **Full Controls** - Arrow Keys/WASD for movement, Mouse for aiming, Click to shoot
|
|
- ✅ **Authentic HUD** - Health, ammo counters, crosshair
|
|
- ✅ **Mobile Responsive** - Works on phones and tablets
|
|
- ✅ **Loading Animation** - Simulated WAD loading sequence
|
|
|
|
## Installation
|
|
|
|
### Already Integrated ✅
|
|
|
|
The DOOM 404 page has been integrated into the application:
|
|
|
|
1. **Error Page Route Module** - `/backend/routes/error-pages/`
|
|
- `index.js` - Route handler for error pages
|
|
- `doom404.html` - Interactive DOOM game interface
|
|
|
|
2. **Server Integration** - `/backend/server.js`
|
|
- Route handler mounted at `/error` endpoint
|
|
- Fallback 404 handler automatically serves DOOM page
|
|
|
|
### Usage
|
|
|
|
#### Direct Access
|
|
Visit `/error/404` to see the DOOM game:
|
|
```
|
|
http://localhost:3000/error/404
|
|
```
|
|
|
|
#### Automatic on 404
|
|
Navigate to any non-existent page:
|
|
```
|
|
http://localhost:3000/this-page-does-not-exist
|
|
```
|
|
|
|
The server will automatically serve the DOOM 404 page with HTTP 404 status.
|
|
|
|
## Controls
|
|
|
|
### Keyboard
|
|
- **↑ Up Arrow / W** - Move forward
|
|
- **↓ Down Arrow / S** - Move backward
|
|
- **← Left Arrow / A** - Strafe left
|
|
- **→ Right Arrow / D** - Strafe right
|
|
- **ESC** - Return to home page
|
|
|
|
### Mouse
|
|
- **Move** - Look around (when mouse is down)
|
|
- **Click** - Shoot weapon
|
|
- **Crosshair** - Center screen indicates aim point
|
|
|
|
## Technical Details
|
|
|
|
### Architecture
|
|
|
|
```
|
|
Backend Server (server.js)
|
|
↓
|
|
Error Page Routes (/backend/routes/error-pages/)
|
|
├── index.js (route handler)
|
|
└── doom404.html (game interface)
|
|
├── Canvas rendering
|
|
├── Input handling
|
|
├── Raycasting engine
|
|
└── HUD display
|
|
```
|
|
|
|
### Game Implementation
|
|
|
|
**Raycasting Engine:**
|
|
- 120 ray traces per frame for 3D perspective
|
|
- Distance-based wall height calculations
|
|
- Color palette based on distance (red → dark red)
|
|
- 60 FPS target framerate
|
|
|
|
**Input System:**
|
|
- Keyboard: Arrow keys + WASD for movement
|
|
- Mouse: Aiming and shooting
|
|
- ESC key escape handler
|
|
|
|
**Rendering Pipeline:**
|
|
1. Sky rendering (upper half)
|
|
2. Floor rendering (lower half)
|
|
3. Wall raycasting (120 rays)
|
|
4. HUD elements (ammo, health, crosshair)
|
|
|
|
## Configuration
|
|
|
|
### Customization Options
|
|
|
|
You can modify `doom404.html` to change:
|
|
|
|
```javascript
|
|
// Raycasting resolution
|
|
const rays = 120; // Increase for better quality, decrease for performance
|
|
|
|
// Game speed
|
|
const speed = 2; // Movement speed per frame
|
|
const rotSpeed = 0.05; // Rotation speed per frame
|
|
|
|
// Colors
|
|
'#440000' // Sky color
|
|
'#220000' // Floor color
|
|
'rgb(255, 0, 0)' // Wall colors
|
|
|
|
// HUD display text
|
|
'HEALTH: 100%'
|
|
'AMMO: 999'
|
|
```
|
|
|
|
### Styling
|
|
|
|
All styles are embedded in `doom404.html`. Key CSS classes:
|
|
|
|
- `.hud` - Main HUD info box (top-left)
|
|
- `.help-text` - Control instructions (bottom)
|
|
- `.welcome` - Welcome message (top-right)
|
|
- `.loading` - Loading screen animation
|
|
- `.progress-bar` - Loading progress indicator
|
|
|
|
## API Endpoints
|
|
|
|
### Error Pages
|
|
- **GET** `/error/404` - DOOM 404 page
|
|
|
|
### Fallback Handler
|
|
The catch-all route handler in `server.js` automatically serves DOOM for:
|
|
- Non-existent page routes (not `/api/v*` or `/v1`)
|
|
- Returns HTTP 404 status
|
|
- Excludes static asset routes (`.js`, `.css`, `.png`, etc.)
|
|
|
|
## Performance
|
|
|
|
- **Load Time:** < 500ms
|
|
- **Frame Rate:** 60 FPS target (depends on device)
|
|
- **Asset Size:** 15KB (standalone HTML)
|
|
- **No External Dependencies:** Pure JavaScript
|
|
- **Browser Support:** All modern browsers (Chrome, Firefox, Safari, Edge)
|
|
|
|
## Troubleshooting
|
|
|
|
### DOOM Page Not Showing
|
|
1. Check that `/backend/routes/error-pages/doom404.html` exists
|
|
2. Verify server.js import: `import errorPagesRoutes from './routes/error-pages/index.js';`
|
|
3. Check browser console for errors
|
|
4. Verify path configuration matches `path.join(__dirname, 'routes/error-pages/doom404.html')`
|
|
|
|
### Performance Issues
|
|
1. Reduce raycasting resolution (change `const rays = 120` to lower value)
|
|
2. Check browser performance (DevTools > Performance)
|
|
3. Disable visual effects if needed
|
|
|
|
### Controls Not Working
|
|
1. Ensure canvas has focus (click on game area)
|
|
2. Check browser console for JavaScript errors
|
|
3. Verify keyboard events are not blocked by other scripts
|
|
4. Try mouse click to verify event system works
|
|
|
|
## Future Enhancements
|
|
|
|
- [ ] Add sound effects (DOOM audio)
|
|
- [ ] Implement sprite system (demons, power-ups)
|
|
- [ ] Add level progression
|
|
- [ ] Leaderboard for most demon kills
|
|
- [ ] Multiplayer synchronization
|
|
- [ ] Actual WAD file loading support
|
|
- [ ] Difficulty levels
|
|
- [ ] Weapon variety
|
|
|
|
## References
|
|
|
|
- DOOM Engine: https://en.wikipedia.org/wiki/Doom_engine
|
|
- Raycasting: https://en.wikipedia.org/wiki/Ray_casting
|
|
- WebGL Games: https://developer.mozilla.org/en-US/docs/Games
|
|
|
|
## Files
|
|
|
|
```
|
|
/backend/
|
|
├── routes/
|
|
│ └── error-pages/
|
|
│ ├── index.js ← Route handler
|
|
│ └── doom404.html ← Game interface
|
|
└── server.js ← Integration point
|
|
```
|
|
|
|
## License
|
|
|
|
DOOM 404 implementation © 2025. Based on classic DOOM by id Software.
|
|
|
|
---
|
|
|
|
**Status:** ✅ Production Ready
|
|
|
|
**Last Updated:** 2025-12-28
|
|
|
|
**Version:** 1.0.0
|