Mana towers in HTML and Typescript.
| src | ||
| .editorconfig | ||
| .gitignore | ||
| .oxlintrc.json | ||
| .prettierignore | ||
| .prettierrc | ||
| AGENTS.md | ||
| bun.lock | ||
| bunfig.toml | ||
| CLAUDE.md | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
Mana Towers
Mana Towers is a browser-based tower-defense prototype built with Bun + Svelte 5. Build generators and batteries, route mana beams, place towers, and survive all waves.
A conversion to Godot is planned at some point in the future (the initial prototype was in Godot, but it was horrendous).
This is inspired by a warcraft 3 map called Power Towers
Tech Stack
- Runtime and tooling: Bun
- UI: Svelte 5 (runes mode)
- Routing:
sv-router - Styling: Tailwind CSS v4
- Tests:
bun test
Getting Started
1) Install dependencies
bun install
2) Run in development
bun run dev
Open the local URL printed by Bun.
Scripts
bun run dev- Start dev server with watch modebun run start- Start serverbun run check- TypeScript + Svelte diagnosticsbun run lint- Prettier check + oxlintbun run format- Format files with Prettierbun test- Run gameplay/unit tests
How To Play (Current Controls)
Command Grid
- Use hotkeys:
QWER,ASDF,ZXCV - Build mode: select a build card, then click a valid tile
- Hold
Shiftwhile placing to keep build mode active
Global Controls
Space- Start wave immediatelyP- Toggle path visibilityN- Generate a new seed (new map, URL updates)M- Restart current seedEscape- Clear selection and active cursor action
Seed URLs
- Open
/123456to play a specific seed. - The active seed is shown in the HUD stats.
- When a seed changes (for example
Nfor a reroll), the path updates so the run can be shared by URL.
Selection
- Click building to select
- Drag-select multiple buildings
Shift+ drag to add to selection- Double-click a building to select all of same type/tier
Project Structure
src/
game/
config.ts # gameplay constants and building definitions
map.ts # map generation
pathfinding.ts # walkability/path search
gameState.ts # simulation and state transitions
controller.ts # input orchestration + command panel composition
renderer.ts # canvas rendering
*.test.ts # gameplay/unit tests
ui/
components/ # Svelte UI components
game-ui-store.ts # bridge from controller snapshots to UI
routes/ # route components
server.ts # Bun server routes
Roadmap
- Add a dedicated seed panel with copy/share and quick reroll actions.
- Add "set seed" input/action so players can replay specific maps without editing the URL.
- Add richer wave/enemy variety and clearer wave previews.
- Add more towers/upgrades and deeper mana-beam strategy options.
- Add save/load for local runs and build experimentation.
Contributing Notes
- Keep game logic in
src/game/*and UI rendering insrc/ui/*. - Prefer Bun-first commands and tooling.
- For UI changes, run
bun run check. - For game logic changes, run
bun run checkandbun test.
See AGENTS.md for full AI-agent contribution rules and validation guidance.