Let me read the current engine to understand what needs to change:
Now I understand the full picture. Let me rewrite the engine completely with the new mechanics:
- Battlefield — a large black square in center. Each cannon fires a shell that splatters paint onto it. Most painted area wins.
- 3 funnels per lane — GO!, +1 Ball, and the classic path. The +1 hole permanently increases spawn count.
- Silver balls — when a team would have >20 balls per round, excess become silver balls worth 20 each.
- Starting positions — each team starts with some painted area in their corner.
Now let me update the App and TeamPanel to match the new API:
Now rewrite App.tsx completely for the new system:
Build passes. Let me review the game flow carefully — I want to make sure the visual area painting matches what the grid is doing. The battlefield is a 256×256 grid where each cell = pixel. When a cannon fires (GO!), it paints a circle of radius 14 (or 22 for silver) in grid units. Let me make the visual representation clearer by increasing the cell size and adding proper falloff blending, and also fix the "silver balls" visual display.
Hmm, the offscreen canvas approach is heavy. Let me simplify to direct pixel drawing for better performance:
Now, I realize the cellSize at typical screen sizes will be very small (256×256 grid in maybe 300×300 CSS pixels = ~1.2px per cell). The fillRect approach works fine. But let me also check that the paintArea function is correct — the radius calculation:
The painting logic looks correct. The paintArea method converts the target canvas point to grid coordinates and paints a circle of radius (radius / bf.size) * BFS in grid cells. For GO! with radius 14 (CSS pixels), and BFS=256, if bf.size=300 then grid radius = 14/300*256 ≈ 12 cells. That's good.
But wait — the shell no longer travels to the score zone. The new system has the cannon fire and directly paint the battlefield. That's correct per the new design. The cannon text shows the team's current %.
Let me make sure silver balls are visually silver:
Good. Silver balls appear silver since the ball drawing code uses b.silver to pick "#c0c8d0" color. Let's do a final build:
Everything builds cleanly. Here's a recap of Z Arcade — Battlefield Conquest:
How it works
The core concept
There's a black battlefield in the center, initially black. Each team starts with a small patch of their color in their corner. The team that covers the most area wins.
The plinko board (3 funnels per lane)
Every N seconds (default 10), each alive team gets a drop:
- 50% →
GO! hole — the cannon fires and paints a big circle (radius ~14 grid cells) on the battlefield where the shell lands. Cannon flashes and recoils.
- 25% →
+1 hole — permanently +1 ball per round for that team. Stacks up! Number shown as "BALLS/ROUND: X".
- 25% →
◌ Normal hole — paints a small circle (radius ~5) on the battlefield.
Silver balls
If a team would drop more than 20 balls in a round (because of +1 accumulation), the excess automatically become silver Ⓢ balls. These:
- Look silver (metallic gradient)
- Have higher paint value (radius 22 on GO!, 10 on normal)
- Worth 20× the normal paint value
Elimination
If a team's painted area drops to 0% (because opposing teams painted over their cells), that team is eliminated 💀 and no longer drops balls.
If only one team remains → VICTORY screen!
Controls
- Space — pause/resume
- D — force drop now
- R — reset game
- Tap any lane on the canvas — 1 extra ball in that lane
- Speed toggle (1×/2×/4×), interval selector (5/10/15/20s), sound on/off
Files built: src/game/engine.ts, src/components/TeamPanel.tsx, src/App.tsx