A WebAssembly implementation of the classic SpaceRock game using Rust, featuring progressive levels, special space rocks with unique effects, and immersive gameplay mechanics.
For the fastest way to get SpaceRock running, use our automated setup scripts:
# Download and run the setup script
curl -sSL https://raw.githubusercontent.com/enu235/spacerock/main/quick-start.sh | bashOr download the script first:
wget https://raw.githubusercontent.com/enu235/spacerock/main/quick-start.sh
chmod +x quick-start.sh
./quick-start.sh- Download
quick-start.bat - Double-click the file or run from Command Prompt:
quick-start.bat- โ Check for Rust installation (install instructions if missing)
- โ Check for wasm-pack (auto-install if possible)
- โ Check for Git (install instructions if missing)
- โ Check for web server capability (Python 3 or PHP recommended, Node.js optional)
- โ Clone the repository automatically
- โ Build the WebAssembly package
- โ Start local web server
- โ Open the game in your browser
That's it! The game will be running and ready to play! ๐ฏ
- Required: Rust + wasm-pack (for building WebAssembly)
- Required: Git (for downloading the code)
- Required: Web server (Python 3, PHP, or Node.js - any one will work)
- Not Required: Node.js specifically (only if you want to use it as a web server option)
- Dynamic Difficulty: Space rock speed increases with each level
- Level Cycles: Every 3 levels, speed resets and increases again
- Bonus Space Rocks: Every 4th level adds an extra space rock to the field
- 5-Second Countdown: Prepare between levels with dramatic transitions
- Score Multipliers: Higher levels provide bonus points
- Rare Spawning: Random chance between 1 in 100 to 1 in 300 for special space rocks
- Visual Effects: Pink electric arcs and pulsing animations
- No Splitting: Special space rocks are completely destroyed when hit
- High Rewards: 100+ points (scales with level)
- Shock Wave Effects: Spectacular expanding ring animations
When special space rocks are destroyed, one of three random disruptions occurs for 2 seconds:
- Systems Disabled: All controls are temporarily disabled
- Controls Scrambled: Movement controls are reversed/altered
- Ship Instability: Uncontrollable drift forces applied to the ship
- Dynamic Sound Effects: Improved thrust, shooting, and explosion sounds
- Special Effects Audio: Unique sound for special space rock destruction
- Level Progression: Musical chimes for level completion
- Modern UI: Gradient backgrounds and glowing effects
- Real-time Status: Disruption indicators and level information
- Responsive Design: Mobile-friendly interface
- Particle Effects: Shock waves and electric arcs
Before you begin, ensure you have the following installed:
- Rust (latest stable version)
- wasm-pack
- A local web server (Python's
http.server, Node'shttp-server, or similar)
# Clone the repository
git clone https://github.com/enu235/spacerock.git
cd astroids
# Build the WebAssembly package
wasm-pack build --target web
# Start a local server (choose one)
python3 -m http.server 8080
# OR
npx http-server -p 8080
# OR
php -S localhost:8080Then open your browser to http://localhost:8080
- Left Arrow (โ): Rotate left
- Right Arrow (โ): Rotate right
- Up Arrow (โ): Thrust forward
- Spacebar: Shoot
- R key or "New Game" button: Start a new game
- Large Space Rock: 20 points ร level multiplier
- Medium Space Rock: 50 points ร level multiplier
- Small Space Rock: 100 points ร level multiplier
- Special Space Rock: 100+ points ร level multiplier
- Clear all space rocks to advance to the next level
- Speed increases every level within 3-level cycles
- Every 4th level adds an additional space rock
- Score multipliers increase every 3 levels
- Watch for Special Space Rocks: Pink space rocks with electric effects
- Prepare for Disruption: Special space rocks cause temporary control issues
- Strategic Planning: Use level countdown time to position yourself
- Risk vs Reward: Special space rocks give high points but create challenges
- Rust - Core game logic and performance
- WebAssembly (WASM) - Browser compatibility and speed
- Web Canvas API - 2D rendering and graphics
- Web Audio API - Dynamic sound generation
- Modern CSS - Responsive UI and visual effects
- Game Loop: 60 FPS rendering with
requestAnimationFrame - Entity System: Modular ship, space rock, bullet, and effect objects
- State Management: Comprehensive game state with level progression
- Effect System: Particle effects and visual feedback
- Audio Engine: Procedural sound generation
- Master the Physics: Use momentum and wrapping to your advantage
- Target Priority: Focus on large space rocks first to prevent splitting
- Special Space Rock Timing: Plan your approach to special space rocks carefully
- Disruption Survival: Stay calm during control disruptions
- Level Preparation: Use countdown time to position optimally
- Score Optimization: Higher levels give better score multipliers
- Power-ups: Temporary abilities and weapons
- Boss Space Rocks: Unique challenging enemies
- Multiplayer Mode: Cooperative and competitive gameplay
- Achievement System: Unlock rewards and challenges
- Custom Ship Designs: Visual customization options
Contributions are welcome! Feel free to:
- Report bugs and issues
- Suggest new features
- Submit pull requests
- Improve documentation
This project is open source. Please check the license file for details.
- Original SpaceRock: Inspired by Atari's classic 1979 arcade game Asteroids
- Enhanced Features: Modern gameplay mechanics and visual effects
- Audio Design: Procedural sound generation using Web Audio API
- Visual Effects: Custom particle systems and animations
Made with ๐ and Rust
Enjoy the enhanced SpaceRock experience! ๐โจ