Crown Defender TD 3D is a static browser game: a 3D MOBA-inspired action tower defense where the player controls a hero, protects a castle, clears 30 waves, earns experience, chooses upgrades, and unlocks a cosmetic crown after victory.
The project is designed to run without a backend. Open it locally, serve it as static files, or publish it through GitHub Pages.
- One mode:
TD Defense. - The hero moves freely on a 3D arena with an isometric MOBA-style camera.
- Creeps spawn in waves and move toward the castle.
- Creeps enter through a magic portal on the right side of the arena.
- The player wins after clearing wave 30.
- The player loses when the castle health reaches zero.
- Enemies grant experience. Stronger enemies grant more experience.
- Level-ups present 3 random upgrade choices.
- A reroll button refreshes upgrade choices and recharges every 3 waves.
- Victory unlocks a crown that can be equipped in future runs.
- 3D arena with grass, blended stone road, trees, rocks, torches, and dynamic lights.
- Castle with towers, roofs, windows, and rune details.
- Hero model with walking animation and weapon switching.
- Weapon styles:
- sword and shield for melee;
- bow for ranged attacks;
- staff for magic;
- chains for medium-range attacks.
- Elemental ability branch:
- meteor;
- fire;
- ice.
- Enemy types:
- minion;
- runner;
- brute;
- shield;
- boss.
- Mobile HUD with joystick and ability buttons.
- Toggleable
x2game speed. - Two-player multiplayer MVP through a lightweight WebSocket relay.
- Desktop controls for laptop play.
- Local browser save through
localStorage. - Best score, best wave, crown unlock, crown equipped state, and current run progress are persisted.
| Action | Key |
|---|---|
| Move | WASD or arrow keys |
| Attack | ; |
| Dash | [ |
| Elemental / area skill | ] |
| Guard | ' |
| Toggle x2 speed | speed button or X |
| Pause | pause button in HUD |
| Action | Control |
|---|---|
| Move | left virtual joystick |
| Attack | large right attack button |
| Dash | right ability button |
| Elemental / area skill | right ability button |
| Guard | right ability button |
The MVP save system uses browser localStorage.
Storage keys:
crownDefender.crownUnlockedcrownDefender.crownEquippedcrownDefender.highScorecrownDefender.bestLevelcrownDefender.run
Saved progress includes the current wave, score, castle health, hero health, hero level, experience, selected upgrades, equipped crown state, and active combat style.
To reset progress, use the in-game reset button on the start screen.
The game is static HTML/CSS/JavaScript. Use any simple local server.
python3 -m http.server 8010For multiplayer testing, also run:
node server/multiplayer-server.mjsThen open:
http://localhost:8010/index.html
Open the game in two browser windows and click Мультиплеер in both. The first player waits; when the second player connects, a 5-second countdown starts and the two-player match begins.
The game can also be opened directly as a file in many browsers, but a local server is recommended because browser security rules around local assets vary.
.
├── index.html # DOM shell, HUD, overlays, controls
├── styles.css # responsive HUD and menu styling
├── game.js # Three.js game logic and rendering
├── server/
│ └── multiplayer-server.mjs # dependency-free WebSocket room server
├── PRD.md # product requirements document
├── ASSET_CREDITS.md # third-party asset and library credits
├── COMPARISON.md # same brief built by Claude Code — what differs
├── LICENSE # MIT license for project code
├── tools/
│ └── check-assets.mjs # verifies every referenced texture exists
├── docs/
│ ├── ARCHITECTURE.md # implementation overview
│ ├── DEPLOYMENT.md # static hosting and GitHub Pages notes
│ └── QA_CHECKLIST.md # manual QA checklist
├── vendor/
│ └── three.min.js # bundled Three.js runtime
└── assets/
└── textures/
└── v2/ # runtime texture pack used by the game
The repository intentionally excludes source texture archives, extracted raw sources, and debug screenshots. Runtime-ready assets are stored in assets/textures/v2.
The game loads 27 textures by name. A renamed or missing file does not throw: Three.js quietly renders a black material, and the problem surfaces during play. This check catches it first, and also reports files nothing references — worth knowing when textures are 7.7 MB of an 8 MB repository.
node tools/check-assets.mjs
node tools/check-assets.mjs --strict # unreferenced files also fail the runNo dependencies. Exit code 1 means something is missing.
- Rendering: Three.js WebGL renderer.
- Game loop: requestAnimationFrame-driven update/render cycle.
- Camera: smoothed isometric follow camera.
- World: procedural Three.js meshes with texture maps from
assets/textures/v2. - UI: HTML/CSS HUD layered over the WebGL canvas.
- Input: pointer/touch joystick, mobile buttons, and keyboard controls.
- Multiplayer: first player hosts simulation, second player sends input through WebSocket, host relays state snapshots.
- Persistence:
localStorage. - Build step: none.
- Performance budget: capped render pixel ratio, reduced shadow cost, throttled HUD updates, and runtime-only asset pack.
More detail is available in docs/ARCHITECTURE.md.
This project can be deployed as static files. GitHub Pages is the simplest target.
- Push the repository to GitHub.
- Open repository settings.
- Enable Pages from the
mainbranch root. - Open the generated GitHub Pages URL.
Detailed deployment notes are in docs/DEPLOYMENT.md.
Before publishing changes, run:
node --check game.js
python3 -m http.server 8010Then verify the game in a browser:
- the scene renders;
- the hero moves with keyboard and joystick;
- attacks and abilities trigger;
- x2 speed button toggles the match speed;
- multiplayer pairs two clients, starts after a 5-second countdown, and enters the match;
- enemies spawn from the right portal;
- waves spawn and progress;
- upgrade choices appear after level-up;
- save/continue works after refresh;
- victory unlocks the crown;
- HUD remains readable on desktop and mobile sizes.
Full checklist: docs/QA_CHECKLIST.md.
The runtime texture pack contains derived or processed assets from CC0 sources and generated game-specific texture compositions.
Primary credits:
- Kenney Retro Textures Fantasy, CC0.
- Poly Haven textures, CC0.
- ambientCG textures, CC0.
- Three.js, MIT license.
See ASSET_CREDITS.md for full attribution and license notes.
Project code is licensed under MIT. See LICENSE.
Third-party assets and libraries retain their own licenses. See ASSET_CREDITS.md.
0 comments
log in to comment.