--- title: Fire Nation Attacked emoji: 🔥 colorFrom: red colorTo: yellow sdk: static pinned: false short_description: Predictive water game defense for Reachy Mini. tags: - reachy_mini - reachy_mini_python_app thumbnail: >- /static-proxy?url=https%3A%2F%2Fcdn-uploads.huggingface.co%2Fproduction%2Fuploads%2F671faa3a541a76b548647676%2FoXvbX10hW1QIDzrbfSBzS.png --- ## Fire Nation Attacked Fire Nation Attacked is a Reachy Mini app that turns the robot into a predictive water-cannon operator. The head pose steers an orbital hose across a 2D battlefield while each antenna controls a different action: - **Left antenna** – pull away from center in any direction to spray water and paint predictive puddles. - **Right antenna** – move away from center to vacuum wasted water, reclaiming score and clearing penalties. - **Head pose** – look around to move the crosshair across the ground battlefield. ### Gameplay loop 1. Waves begin the instant you spray the glowing START glyph—no prep countdown—so you can (and should) paint even while “waiting.” 2. Enemy cues appear on the far-left margin three seconds before a unit enters, and a thin neon path projects the next five seconds of its movement so you can pre-draw their demise. 3. Waves contain three custom archetypes: - **Ember Scouts** – fast, straight runners with low HP. - **Flare Serpents** – sinusoidal movers with medium HP. - **Basalt Guardians** – heavy units that march in angular, continuous square waves. 4. To launch the first wave, spray the glowing START glyph on the ground. The local leaderboard (persisted in `leaderboard.json`) is printed on the start screen and disappears once combat begins. 5. Water splashes persist until an enemy consumes them; perfect play means every drop is used. Any leftover puddles are aggregated into a single penalty circle that must be vacuumed before the next wave can start. 6. Scores are granted per wave. Taking base damage and leaving waste will deduct points, while vacuuming unused water grants a bonus. Grades range from D→S, with S+ reserved for perfect, damage-free, zero-waste clears. ### Controls & shortcuts | Action | Robot control | Dev shortcut | | --- | --- | --- | | Spray predictive water | Pull/push the **left** antenna past ~0.18 rad | Press `Space` (after pressing `M` to enable dev override) | | Vacuum puddles | Move the **right** antenna past ~0.18 rad | Hold `Shift` (dev override only) | | Aim | Move Reachy Mini’s head (roll/pitch) | Press `M` to toggle mouse aim in the browser for debugging | | Start run | Spray/push the glowing “Start” glyph | Spray it | Mouse/keyboard overrides are meant strictly for browser-only development sessions; keep them disabled when the real robot is connected to avoid conflicting inputs. ### Running the app **Option 1: From the Reachy Mini Dashboard** Search for "Fire Nation Attacked" in your Reachy Mini Dashboard and install it directly. The app will launch from there. **Option 2: For developers** ```bash pip install -e . python fire_nation_attacked/main.py ``` Then open the URL printed in the logs (typically `http://0.0.0.0:8042`). ### Developer notes - The backend disables every motor except the antennas to keep the robot safe while still reading head pose and antenna pulls. `/reset_session` clears scoring data if you want a fresh run. - `/sensor_data` streams roll/pitch/yaw plus normalized fire/vacuum strengths. `/wave_report` lets the UI persist scores/grades (also shown on the HUD), while `/play_sound` triggers simple hardware sounds hosted in `fire_nation_attacked/fire_nation_attacked/assets`. - The frontend is a single `canvas` scene (`static/main.js`) with responsive HUD, predictive path rails, Web Audio flourishes (pink-noise spray, triangle vacuum), and keyboard fallbacks (press `M` to toggle mouse aim, `Space`/`Shift` to simulate sprays/vacuums without the hardware). - Motivational messages for each wave, enemy archetypes, and scoring weights live near the top of `static/main.js` so balancing can be done without touching the rest of the logic. The end-of-wave summary is rendered directly beside the center puddle to avoid covering gameplay—cleaning the puddle automatically queues the next wave.