AR PVP shooter where you battle zombies in real life to earn $RIVAL tokens.
Prize Pool
Rivals is a revolutionary Augmented Reality (AR) multiplayer shooter that transforms the real world into a competitive gaming arena. This isn't just a mobile game—it's a sophisticated fusion of Unity AR Foundation, blockchain economics, and AI-driven gameplay that creates a persistent, location-based gaming ecosystem where players compete for cryptocurrency rewards.
The project represents the next evolution of mobile gaming, combining the immersive AR experience of apps like Pokémon GO with the competitive intensity of first-person shooters, all powered by Web3 tokenomics that give real monetary value to in-game achievements.
Key Features:
Unity AR Game Architecture:
Core AR Foundation Implementation
The Unity application leverages AR Foundation to create a sophisticated augmented reality experience:
States: Patrol → Alert → Chase → Attack → Hit → Death
ZombieAI Components:
Blockchain Integration and Smart Contract Architecture
The game uses a custom ERC-20 token contract (RivalsToken.sol
) deployed on multiple chains:
Supported Blockchains:
Token Economics ($RIVAL):
// Rewards
killMonster() → +1 RIVAL token per zombie kill
// Penalties
dieByMonster() → -20% of current balance
dieByTrap() → -20% transferred to trap owner
// Costs
placeTrap() → -1 RIVAL token
Smart Contract Functions:
killMonster(address)
: Mints 1 RIVAL token when player kills a zombiedieByMonster(address)
: Burns 20% of player's tokens when killed by AIdieByTrap(address, address)
: Transfers 20% from victim to trap ownerWeb3 Infrastructure
Authentication & Wallet Management:
Real-time Blockchain Integration:
Database & Server Architecture**
API Endpoints:
/api/movement
(Location Tracking)/api/kill-monster
(Zombie Elimination)killMonster()
smart contract call/api/place-trap
(Strategic Placement)spend()
to burn 1 token/api/die
(Death Handling)Game Flow & User Experience
Player Onboarding:
Core Gameplay Loop:
Social & Competitive Features:
Tokenomics & Monetization
Token Utility ($RIVAL):
Economic Incentives:
Unique Value Propositions
True AR Integration Unlike superficial AR filters, Rivals uses real environment mapping for gameplay. Zombies navigate around your actual furniture, and the game adapts to your physical space.
Genuine Web3 Economics Not just NFT collectibles—real monetary incentives where skill directly translates to cryptocurrency earnings through competitive gameplay.
Location-Based Strategy GPS-integrated trap system creates persistent, location-based gameplay where your strategic decisions affect other players across time and space.
Cross-Chain Accessibility Multi-blockchain deployment ensures players aren't locked into one ecosystem, with seamless chain switching.
Sophisticated AI State-machine driven zombie AI with realistic pathfinding, vision systems, and behavioral complexity that rivals AAA games.
Market Position
Rivals occupies a unique intersection:
It's positioned as the first truly competitive AR shooter with real cryptocurrency rewards, targeting the growing market of Web3 gaming enthusiasts who want skill-based earning opportunities.
This is a groundbreaking project that could define the future of mobile AR gaming by proving that immersive augmented reality experiences can be both technically sophisticated and economically rewarding for players.
Technical Architecture Overview
Rivals represents a complex fusion of Unity AR Foundation, blockchain economics, and real-time geospatial system. Here's how we solved some gnarly technical challenges to create a persistent, location-based AR shooter.
Unity AR Game Engine - The Core Challenge
Dynamic AR NavMesh Generation The Problem: Traditional games pre-bake navigation meshes, but AR environments are completely unknown until runtime. How do you make AI zombies navigate around a user's real furniture?
Our Solution: We built a real-time NavMesh builder that converts AR Foundation plane data into navigable surfaces. When AR Foundation detects a horizontal plane (like a floor), we automatically create a NavMesh surface. When it detects vertical planes (like walls), we create NavMesh obstacles that AI can't walk through.
Technical Innovations:
Cross-Platform Input System The Challenge: Handle both mouse (editor) and touch (mobile) seamlessly while preventing conflicts between shooting and mine placement modes.
We created a mode-aware input system that detects both mouse and touch input simultaneously, but only processes it when in the correct mode. This prevents accidentally shooting when trying to place mines, and ensures smooth gameplay across development and mobile platforms.
GPS + AR Coordinate Fusion - The "Indoor GPS" Problem
The Challenge: GPS coordinates are in latitude/longitude, but Unity works in local 3D space. GPS accuracy indoors is terrible (±10-50 meters).
Our Hacky-But-Brilliant Solution: Instead of trying to solve GPS accuracy (impossible), we abandoned absolute positioning and used proximity-based discovery. When the server detects you're within ~10 meters of a trap's GPS coordinates, it tells Unity to spawn the trap "somewhere in front of you" using AR raycasting to find the actual ground.
Why This Works:
Blockchain Integration - Zero-Friction Web3
Server-Controlled Wallet Architecture The Challenge: Web3 games typically require users to manage wallets, sign transactions, pay gas fees. Terrible UX.
Our Solution: The server owns the "game wallet" and pays all transaction costs. When a player kills a zombie, Unity sends an API call to our server, which then executes the blockchain transaction to mint tokens. Players never interact with crypto directly - they just see their token balance increase.
Technical Benefits:
Multi-Chain Smart Contract Strategy We deployed the same contract across multiple testnets on with Flow and Chiliz using Foundry. Our smart contract is simple but effective - it mints 1 token per zombie kill, burns 20% of tokens when you die to monsters, and transfers 20% between players when traps are triggered.
Partner Technology: Privy provides Web3 authentication, but cleverly, the server holds the "game wallet" that actually executes transactions.
Database & Geospatial Architecture
PostgreSQL earthdistance for Location Logic The Choice: We used PostgreSQL's earthdistance extension instead of PostGIS for geospatial queries.
Why earthdistance over PostGIS:**
The server calculates distances between player GPS coordinates and all existing traps using earthdistance functions, returning nearby traps to the Unity client for spawning.
Unity-to-Server Communication
The Challenge: Mobile games need robust networking, but Unity's networking is overkill for simple API calls.
Our Streamlined Solution: Direct HTTP API calls using Unity's UnityWebRequest. We have four main endpoints:
AI System Architecture
We implemented a sophisticated 6-state AI system for zombie enemies: Patrol → Alert → Chase → Attack → Hit → Death.
ZombieVision Component: Handles field-of-view detection with a 120° cone and 8-12 meter range, plus line-of-sight checking that respects AR plane obstacles.
ZombieMovement Integration: Uses the dynamically-built NavMesh to pathfind around real-world furniture and obstacles detected by AR Foundation.
Smart State Management: Zombies patrol randomly within detected space, scream when they first spot you, chase aggressively using pathfinding, and attack when within 1.5 meters.
Performance Optimizations & Notable Hacks
The GPS Indoor Hack Instead of trying to solve GPS accuracy indoors (impossible), we gave up on absolute positioning and used proximity-based discovery. This turned a technical limitation into a feature.
The Blockchain Gas Hack Instead of making players pay gas fees (terrible UX), the server owns a wallet and pays all transaction costs. Players never touch crypto directly but still get real Web3 ownership.
The Cross-Platform Input Hack Instead of using Unity's complex Input Actions system, we detect both mouse and touch simultaneously in every Update() and let the first one win. Simple but bulletproof.
The NavMesh Dynamic Building Hack Instead of trying to build perfect NavMesh from AR data, we use "good enough" box colliders that represent detected planes and let Unity's NavMesh system handle the pathfinding details.
Trap Spawning Optimization We prevent duplicate trap spawning with smart caching - each trap ID is tracked in a dictionary to ensure it only spawns once, even if the GPS proximity detection triggers multiple times.
AR Plane Performance Optimization We batch process planes (max 5 per frame) and only rebuild NavMesh every 2 seconds instead of every frame, preventing performance drops during intensive AR scanning.
Technology Stack Choices & Rationale**
Unity AR Foundation Next.js + TypeScript PostgreSQL + earthdistance Foundry Viem + Wagmi
Most Notable Technical Achievements**
The most impressive hack is probably how we turned GPS inaccuracy from a limitation into a feature - instead of fighting physics, we embraced "approximate location" and made it part of the game design. Players get location-based gameplay without the frustration of precise positioning requirements.
This project demonstrates that with clever architecture choices and willingness to work around technical limitations rather than against them, you can create sophisticated AR experiences that feel magical to users while being surprisingly practical to build.