Kingsomni is a high-performance, decentralized Tower Defense ecosystem built on the Somnia Network. It pioneers the use of Somnia's Reactivity Precompile to create a truly "Autonomous World" where the blockchain doesn't just store data—it actively drives the game's difficulty, economy, and social engagement in real-time.
In a world where the blockchain is alive, players must defend their Ancient Crystal from relentless waves of Goblins, Devils, and Golems. Kingsomni blends classic tower defense strategy with modern RPG progression, all secured by on-chain integrity and fueled by a circular STT economy.
- Prepare: Connect your wallet via Privy and visit the Upgrade Shop to enhance your stats (Damage, HP, Skills) on-chain.
- Strategize: Check the Event Panel to see the live status of the Global Boss and the Bounty Pool.
- Battle: Defend your tower in the arena. Use active skills (Freeze, Heal, Damage Boost) to survive.
- React: Adapt to real-time shifts in difficulty if the Global Boss spawns on-chain.
- Claim: Validate your session via the backend’s EIP-712 Anti-Cheat and claim your STT rewards directly from the Treasury.
Kingsomni utilizes both On-Chain and Off-Chain Reactivity to create a seamless feedback loop between player actions and the game world.
The KingsomniEventHandler contract acts as the "Autonomous Brain" of the world, executing logic based on ecosystem events without manual intervention.
The handler monitors the Treasury balance in real-time to trigger a global state change.
- Activation (ON): When the treasury reaches 10 STT, the world enters Hardcore Mode.
- The Trade-off: Enemies gain 2x Health, but all player rewards are tripled (3x).
- Deactivation (OFF): If the balance falls below 7 STT (due to claims), the Boss retreats.
Whenever a player spends STT on upgrades, 10% of the fee is automatically redirected to the Global Bounty Pool.
- The Dethroning Mechanic: If a new player surpasses the
highestScoreof the current King (Leader), they instantly claim the entire Bounty Pool from the Treasury. - Result: Every upgrade in the ecosystem increases the stakes for the top-ranking players.
Our stack leverages the Somnia Reactivity SDK to provide a sub-millisecond responsive experience that feels like a traditional game.
The /api/event-panel provides a "Live Pulse" of the game world by subscribing to on-chain events via WebSocket.
- Instant Updates: Players see the Treasury's progress toward the 10 STT threshold move in real-time as other players upgrade, providing a sense of a shared, living world.
- Efficiency: Eliminates slow and expensive RPC polling by maintaining an ultra-fast local cache updated the moment an event is confirmed on Somnia.
A dedicated notifier service monitors the Reactivity Precompile to drive community engagement.
- Dynamic Alerts: Automatically pushes alerts to Discord and Telegram when:
- A Global Boss appears (Calling all players to hunt for 3x rewards).
- A King is Dethroned (Broadcasting the winner of the massive Bounty Pool).
KingsomniGame: Core hub for scoring, rewards, and the Global Boss state.KingsomniProfile: Manages on-chain player progression and RPG stats.KingsomniLeaderboard: EIP-712 secured leaderboard for high-integrity rankings.KingsomniTreasury: The secure vault for the ecosystem's STT liquidity.KingsomniEventHandler: The "Brain" implementing Somnia's Reactivity logic.
- EIP-712 Signer: Provides anti-cheat validation and secure score signatures.
- Reactivity SDK: Manages WebSocket subscriptions to Somnia's precompile for instant cache updates.
- Social Notifier: Pushes on-chain drama to Discord and Telegram.
- Phaser 3 Engine: High-frequency game loop for smooth tower defense combat.
- React Bridge: Connects the game world to the wallet and on-chain state.
- Reactive HUD: Displays real-time treasury progress and world status without manual refreshes.
- True Autonomy: Game difficulty and economy scale automatically via On-Chain Reactivity.
- Responsive Web3: Replaces slow RPC polling with instant WebSocket-driven UI updates.
- Secure Fairness: Combines backend anti-cheat with EIP-712 signatures for a cheat-proof leaderboard.
- Circular Economy: Player spend directly fuels the "Global Boss" challenge and "Bounty Pool" rewards.




