Road Survival - Multiplayer Racing Game
Road Survival is an advanced multiplayer racing game built with React and integrated with GenLayer blockchain. Featuring real-time multiplayer racing, diverse car selection, and immersive gameplay with sound effects and realistic environments.
Key Features
🎮 Game Modes
Multiplayer - Real-time racing with other players
Solo Practice - Training mode to improve skills
Room System - Create/join custom game rooms
🚗 Car Selection System
9 Unique Car Types: Sports, SUV, Sedan, Hatchback, Muscle, Truck, Racing, F1, Luxury
Different Car Shapes: Each car type has unique visual design (F1 with nose cone & wings, SUV taller & boxier, Truck longer with bed, etc.)
Color Variations: Each car type has distinct color scheme
Live Preview: See car preview before selecting
🔊 Sound Effects
Engine Sound: Dynamic engine sound that changes based on speed
Collision Sound: Impact sound when crashing into enemy cars
Web Audio API: High-quality synthesized sounds without external files
🌲 Realistic Environment
Dynamic Scenery: Trees, buildings, and mountains on both sides of the road
Moving Background: Scenery moves with road for realistic speed sensation
Depth Effect: Mountains in background, buildings mid-ground, trees foreground
Variety: Random placement for natural look
🎨 Modern UI/UX
React 18 - Modern component architecture
Tailwind CSS - Responsive, utility-first styling
Framer Motion - Smooth animations and transitions
Lucide Icons - Beautiful, consistent iconography
Mobile Responsive - Works on all devices
Technology Stack
Technologies Used
- Frontend: React 18 + Vite + Tailwind CSS
- Blockchain: GenLayer Studionet
- Real-time: Socket.IO WebSocket
- Game Engine: HTML5 Canvas + JavaScript
- Build Tool: Vite (fast HMR)
Game Controls
Keyboard Controls
- ← → Arrow Keys - Move left/right between lanes
- A/D Keys - Alternative movement
- Space - Start game (when ready)
Game Mechanics
- Avoid enemy cars - Collision = game over
- Enemy variety - Enemy cars have random types and colors, different from player car
- Speed increase - Gets faster as score increases
- Engine sound - Dynamic engine sound changes with speed
- Collision sound - Impact sound when crashing
- Restart - Click "Main Lagi" to instantly restart after game over
Blockchain Integration
The game integrates with GenLayer blockchain for score tracking and multiplayer sessions. Smart contracts store player scores and game sessions on-chain, ensuring transparency and immutability.
Contract Name: RoadSurvivalGame
Network: GenLayer Studionet
Storage: String-based key-value pairs for sessions and scores
GenLayer-Specific Features
This project demonstrates full integration with GenLayer's unique capabilities:
🧠 LLM Integration
AI-Generated Car Descriptions: Use GenLayer's LLM to create unique, dynamic car descriptions
AI Game Commentary: Auto-generate exciting commentary for game events
Dynamic Content: All descriptions and commentary are generated in real-time by the LLM
🌐 Web Fetching
Real-Time Weather Data: Fetch live weather conditions from external APIs
Car Statistics: Pull real car data from Wikipedia
Dynamic Game Mechanics: Weather affects game difficulty (rain = slippery roads, etc.)
⚖️ Equivalence Principle
Deterministic Difficulty Calculation: Mathematical operations that produce consistent results across different LLMs
Score Fairness Validation: Ensures scores are within reasonable bounds using deterministic rules
Game Recommendations: Provides consistent recommendations using structured logic
Mobile Support
The game features responsive design that works on all devices:
- Desktop: Full 12-column grid layout
- Tablet: 8-column grid with adjusted spacing
- Mobile: Single column, touch-friendly controls
📚 Source Code
Want to see the full project? Check out the complete source code on GitHub:
Built by dhozil for the gaming and blockchain community 🚀