Territory Run — Hackathon Submission
Problem Statement
Most fitness apps struggle with long-term engagement. They reduce exercise to passive metrics such as distance, pace, and calories, offering little motivation beyond personal discipline. At the same time, mobile gaming continues to grow but remains largely sedentary, contributing to declining physical activity.
There is a clear gap for an experience that:
- Encourages outdoor physical activity
- Sustains motivation through competition and progression
- Feels engaging rather than repetitive
Solution
Territory Run is a location-based fitness game that transforms outdoor running into territory capture on a live map. Users physically run loops in the real world; when a loop is closed, the enclosed area is captured as territory and added to the user’s permanent score.
Core idea: movement creates ownership.
What It Does
Territory Run uses GPS tracking and interactive maps to turn real-world neighborhoods into competitive playfields.
Core Flow
- User starts a run from any location
- GPS tracks the running path in real time
- User returns close to the starting point to close the loop
- The enclosed area is captured as territory
- Territory contributes to score, coins, and leaderboard rank
Key Features
- Real-time GPS tracking
- Interactive map with live path rendering
- Automatic loop detection
- Territory capture as filled polygons
- Area-based scoring system
- Coin rewards per successful capture
- Persistent user stats and progression
- Global real-time leaderboard
- Mobile-first, outdoor-optimized UI
Game Rules
- Loop closure threshold: 15 meters
- Minimum capture area: 100 m²
Scoring:
- Total captured area (primary metric)
- Coins: 1 per 100 m² + fixed run bonus
Players do not compete over the same territory in this version, keeping the MVP clean and scalable.
Technology Stack
Frontend
- HTML5, CSS3
- Tailwind CSS
- Vanilla JavaScript (ES6)
- Mobile-first responsive design
Mapping & Geolocation
- Mappls (MapmyIndia) SDK
- Browser Geolocation API
- Haversine formula for distance calculation
- Shoelace algorithm for polygon area computation
Backend
- Firebase Authentication (Email + Google OAuth)
- Firebase Firestore (user data, leaderboard)
- Real-time listeners for live leaderboard updates
Tooling
- Git & GitHub
- Chrome DevTools
- DiceBear API for avatars
Architecture Overview
Authentication Layer Users authenticate via Firebase. User profiles are created on first login and stored in Firestore.
Map Initialization Map loads after SDK readiness confirmation, with retry logic and fallback handling.
GPS Tracking System Continuous high-accuracy tracking with filtered position updates to reduce noise.
Run & Path Tracking
- Path points recorded only after minimum movement thresholds
- Distance, duration, and potential capture area calculated in real time
Territory Capture Logic
- Loop closure validated using distance threshold
- Polygon closed and area calculated
- Valid captures rendered permanently
Leaderboard System
- Real-time Firestore snapshot listeners
- Sorted by total captured area
- Top 10 players displayed live
Key Challenges & Solutions
GPS Noise & Accuracy
- Problem: Jitter and inconsistent readings
- Solution: Distance-based filtering, smoothing, and accuracy indicators
Map SDK Integration
- Problem: Incomplete documentation and unstable initialization
- Solution: Explicit SDK callbacks, retry logic, and fallback rendering
Loop Closure Detection
- Problem: Balancing usability and accuracy
- Solution: Empirically tested 15m threshold with visual proximity feedback
Performance & Battery Usage
- Problem: Continuous GPS drains battery
- Solution: Debounced updates, reduced redraws, and foreground-only tracking
Achievements
- Built a complete GPS-based fitness game MVP
- Implemented real-time geospatial calculations on mobile devices
- Designed a simple, effective gamification loop
- Successfully tested territory capture in real-world conditions
- Delivered a scalable and extensible architecture
What We Learned
- GPS systems require filtering, not blind trust
- Real-time apps demand strict performance control
- Mapping SDKs often require independent debugging
- Visual feedback matters more than raw metrics
- A focused core loop outperforms feature-heavy designs in hackathons
Future Scope
Short-Term
- User onboarding tutorial
- Expanded stats dashboard
- Friend-based leaderboards
- Improved GPS signal handling
Medium-Term
- Territory conflicts and decay mechanics
- Team-based play and challenges
- Achievements and progression system
Long-Term
- AI-assisted route suggestions
- Wearable device integration
- Native mobile apps
- Privacy and safety features
Conclusion
Territory Run demonstrates how physical activity can be transformed from passive tracking into an engaging, competitive experience. By directly linking real-world movement to progress, the app motivates users to stay active with purpose.
The project prioritizes clarity, scalability, and real-world usability over unnecessary complexity.
Requirements
- GPS-enabled device
- Modern web browser
- Active internet connection
Log in or sign up for Devpost to join the conversation.