Level mechanic / arena design
Timed Map Mutation: The Tide Cycle
Tested with Claude · produced BREAKWATER
The Prompt
Design and implement a timed map-mutation system for a browser arena game, delivered as a self-contained HTML demo (Canvas 2D, inline CSS/JS, no libraries). The player should feel the map change before they read a timer. The cycle: - A 90-second loop with three states: EBB (12s), LOW TIDE (63s), FLOOD (15s). Implement it as an explicit state machine with entered/exited hooks; never branch on raw elapsed time inside gameplay code. - EBB: water recedes, sandbars rise, healing pickups spawn in exposed areas. Give a 10-second warning with audio and a HUD ring. - LOW TIDE: the lane widens by roughly 40%, opening two flank routes. Pathfinding and projectile collision must update to the new walkable geometry. - FLOOD: water returns, the lane narrows to its base width, anyone standing on a sandbar is pushed toward the centre and takes chip damage unless they move. No instant kills. Fairness rules: - Telegraph every state change at least 5 seconds ahead with colour, sound and a countdown. Never surprise the player with a lethal change. - The flood must never trap a player in a dead end with no escape route. Validate reachability on every transition with a flood-fill over the walkable grid. - Pickups on sandbars despawn at flood start rather than becoming unreachable loot. - Bots must respond: retreat from sandbars 3 seconds before flood, contest pearls during low tide, and path around newly flooded tiles. Implementation: - Represent the map as a grid of tiles with state flags. Interpolate water level visually over 1.5 seconds while collision switches at a single tick boundary. - Cache two nav layers (low tide, high tide) and swap pointers rather than rebuilding paths every cycle. - Expose a debug panel (F) that can jump to any cycle phase and draw the current walkable grid. Testing: - Run a 10-minute headless simulation of the cycle and report: transitions executed, players trapped, pickups orphaned, and bot deaths caused by flood. - Log every fairness violation and fix it before adding a second map. Deliver in stages: the state machine and visuals first, then collision, then pickups, then bots. Print the state durations and a table of what changes in each state.
What This Prompt Produces
BREAKWATER uses this exact rhythm: every 90 seconds the tide pulls back to expose sandbars with healing pearls, then floods and squeezes everyone onto the dyke. It is the cheapest way to give a one-lane map a second dimension without building a second lane.
Modification Tips
- Make the state change a state machine with hooks, not a chain of if-statements on a timer. You will add a third and fourth state later.
- Validate reachability on every transition. A tide that traps a player is a bug players will remember as unfair, not atmospheric.
- Switch collision on one tick and interpolate only the visuals. Half-flooded collision is where arena games break.
- Make bots respect the cycle before shipping it. If bots ignore the tide, the mechanic reads as a hazard for the player only.
The Game This Prompt Produced
Want to try it? Open Claude, paste the prompt, and you'll have a playable game in minutes. When you're happy with the result, submit it to Daily AI Games.