Clash Battle Template is a production-ready, server-authoritative real-time card battle game. It includes both the game template and the complete WebSocket server backend.
Create your own Clash Royale-style game without wasting time creating code and mechanics from scratch.
WebGL Demo
Documentation
Discord Community
Developer's website
What's included:
Game Template:
- A complete battle system in the style of Clash Royale with troops, buildings and spells.
- 21 demo cards, king and princess towers, crowns, overtime with double and triple elixir.
- Battles against other players or bots.
- Full meta-game: deck builder, card collection, upgrade system, lootboxes, shop with daily rotation.
- Server-authoritative battles with smooth client-side interpolation for both WebSocket and offline backends.
- Offline mode
- Login (email/password + guest), profile, settings, nickname rename
- Clan system with real-time chat, emotes, donations, member roles, search and clan war.
- Friends list with online status and friendly battles
- Leaderboards
- Battle Pass
- Trophy Road
- Chest Slots
- Battle emotes, victory animations, particle reward FX
- Replay System
- Match history + replay viewer
- Real-time server data update system, exporting with just one click.
- Localization: English, Portuguese, Chinese, Japanese and Korean (LanguageManager, ready for more languages)
- Local + remote update flow (Google Play / App Store / custom JSON)
Customization:
Every game-design-related setting lives in the Editor as ScriptableObjects:
- Units (stats, AI, animations, costs)
- Maps + arenas
- Lootbox reward tables
- Shop offers + rotations
- Currency definitions
- Battle Pass / Trophy Road / Chest Slot rewards
- Clan rules + chat config
The documentation has step-by-step tutorials for creating a new arena and a new card.
WebSocket Backend Server:
- Authoritative battle simulation at 20 ticks/sec (configurable) with delta-encoded state sync.
- REST + WebSocket APIs for auth, matchmaking, shop, IAP, clans, friends, telemetry.
- JWT auth with email/password + persistent guest accounts (device-id based).
- Real-money IAP with server-side receipt validation: Google Play Billing, Apple App Store StoreKit, Stripe Checkout / Payment Intents.
- Auto-reconnect for battle and lobby sockets.
- GM panel with ban / kick / grant currency / set trophies / search players.
- Real-time data push to client
- Telemetry pipeline with crash aggregation
- Multi-region distributed scaling via Redis (optional)
This asset uses the following third-party resources:
LeanTween
License: MIT
Author: Russell Savage - Dented Pixel
UnityHFSM
License: MIT
Author: Inspiaaa
Colyseus Unity SDK
License: MIT
Author: Endel Dreyer
MsgPack Serialization
License: MIT
Author: Denis Zykov
MeshCombineWizard
License: MIT
Author: Gojko Radonjic
UniTask
License: MIT
Author: Yoshifumi Kawai / Cysharp, Inc.
VContainer
License: MIT
Author: hadashiA
UIEffect
License: MIT
Author: mob-sakai
UIParticle
License: MIT
Author: mob-sakai
Other assets, audio, 3D models, etc., are all under the CC0 license.