6.3 KiB
🗺️ Echoes of the Ashes - Interactive Map Visualizer
A web-based interactive map viewer for the RPG game world.
Features
- Interactive Canvas Map: Drag, zoom, and explore the game world
- Real-time Location Data: Dynamically loaded from game data
- Distance Calculations: Shows travel distances and stamina costs
- Location Details: Click on locations to see full information
- Connection Routes: Visual representation of all travel paths
- Statistics Dashboard: View map statistics and metrics
- Responsive Design: Works on desktop and mobile devices
Quick Start
Option 1: Docker (Recommended)
The map server is included in the docker-compose setup:
docker compose up -d echoes_of_the_ashes_map
Access the map at: http://localhost:8080
Option 2: Standalone Python Server
cd web-map
python server.py
Optional: Specify a custom port
python server.py --port 3000
Map Editor
The server includes a built-in web-based editor for managing game data.
Accessing the Editor
Navigate to: http://localhost:8080/editor
Authentication
The editor requires a password for access. Set it via environment variable:
export EDITOR_PASSWORD="your_secure_password"
export EDITOR_SECRET_KEY="$(python -c 'import secrets; print(secrets.token_hex(32))')"
Default password (if not set): admin123
Warning
Security: Always change the default password in production! Set
EDITOR_PASSWORDin your.envfile.
Editor Features
- Locations Tab: Edit location properties, coordinates, danger levels, spawn tables
- NPCs Tab: Manage enemy stats, loot tables, and spawn weights
- Items Tab: Edit item properties, stats, crafting recipes, repair materials
- Interactables Tab: Manage interactable templates and actions
- Connections Tab: Create/delete connections between locations
- Logs Tab: View API container logs and restart the bot
Environment Variables
| Variable | Description | Default |
|---|---|---|
EDITOR_PASSWORD |
Password for editor access | admin123 |
EDITOR_SECRET_KEY |
Flask session secret key | Auto-generated |
PORT |
Server port | 8080 |
Features Overview
Map Controls
- 🖱️ Pan: Click and drag to move around the map
- 🔍 Zoom: Use mouse wheel or zoom buttons to adjust view
- 🎯 Reset: Return to default view
- 🏷️ Toggle Labels: Show/hide location names
Location Information
Click on any location node to see:
- Location name and description
- Coordinates (X, Y)
- Number of interactables
- Connected locations with distances
- Estimated stamina costs for travel
Map Legend
- Green Circles: Locations
- Blue Lines: Travel routes
- Orange Circle: Selected location
- Pink Badge: Number of interactables at location
Map Statistics
The dashboard shows:
- Total Locations: Number of places in the game world
- Total Routes: Number of connections between locations
- Longest Route: Maximum distance between connected locations
- Average Distance: Mean distance across all routes
Technical Details
Data Source
The map dynamically loads data from /map_data.json, which is generated from the game's world loader. The data includes:
{
"locations": [
{
"id": "start_point",
"name": "🌆 Ruined Downtown Core",
"description": "...",
"x": 0.0,
"y": 0.0,
"interactable_count": 3
}
],
"connections": [
{
"from": "start_point",
"to": "gas_station",
"direction": "north",
"distance": 2.0
}
]
}
Server Architecture
- Backend: Flask server with RESTful API
- Frontend: Vanilla JavaScript with HTML5 Canvas
- Authentication: Session-based with password protection
- Data Storage: Direct JSON file manipulation
- Responsive: CSS Grid and Flexbox layout
- Real-time: Live data from game world loader
Port Configuration
Default port: 8080
To change the port, modify:
docker-compose.yml: Update the ports mapping- Or use
--portflag when running standalone
Customization
Styling
Edit index.html to customize:
- Colors and gradients
- Card layouts
- Typography
- Responsive breakpoints
Map Appearance
Edit map.js to customize:
- Node sizes and colors
- Line widths
- Scale factors
- Animation effects
Production Deployment
With Reverse Proxy (Nginx/Caddy)
location /map {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
Public Access
To make it accessible globally:
- Port Forward: Open port 8080 on your firewall
- Domain: Point a subdomain to your server
- SSL: Use Let's Encrypt for HTTPS
Example with Caddy:
map.yourdomain.com {
reverse_proxy localhost:8080
}
Troubleshooting
Map Not Loading
-
Check if server is running:
docker ps | grep map -
Check logs:
docker logs echoes_of_the_ashes_map -
Verify port is accessible:
curl http://localhost:8080
Data Not Updating
The map data is generated dynamically. If you've changed location coordinates:
- Restart the map server
- Hard refresh browser (Ctrl+F5)
Connection Issues
If running in Docker, ensure the container is on the correct network and ports are properly mapped.
Development
To modify the map visualization:
- Edit
map.jsfor canvas rendering logic - Edit
index.htmlfor layout and UI - Edit
server.pyfor data serving logic
To modify the editor:
- Edit
editor.htmlfor editor UI layout - Edit
editor_enhanced.jsfor editor functionality - Edit
server.pyAPI routes for backend logic
The server auto-loads changes - just refresh your browser!
Security Best Practices
- Change Default Password: Always set
EDITOR_PASSWORDto a strong password - Use HTTPS: In production, use a reverse proxy (Traefik/Nginx) with SSL
- Restrict Access: Use firewall rules to limit editor access to trusted IPs
- Backup Data: Regularly backup
gamedata/folder before making changes - Test Changes: Use the export/import feature to test changes before applying
License
Part of the Echoes of the Ashes RPG project.