Skip to content

jscervantes/nyc-rat-race

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NYC Rat Race - Interactive Treasure Hunt App

Android Kotlin Jetpack Compose Material 3

An immersive location-based treasure hunt experience built with modern Android architecture

App Demo

Project Overview

NYC Rat Race is a sophisticated Android application that transforms New York City into an interactive playground. Users embark on a digital scavenger hunt, solving riddles and discovering iconic landmarks through GPS-based location detection. The app demonstrates advanced Android development skills including Jetpack Compose, MVVM architecture, and real-time location services.

Key Features

  • GPS-Based Location Detection: Precise proximity detection (25m radius) using Haversine distance calculation
  • Interactive Clue System: Engaging riddles that lead users to real NYC landmarks
  • Real-Time Timer: Live tracking of hunt duration with pause/resume functionality
  • Smart Hint System: Progressive hints to help users when stuck
  • Modern UI/UX: Material 3 design with dynamic theming and dark mode support
  • Responsive Design: Optimized for various screen sizes and orientations
Main Screen Hint Screen Clue Solved Screen Game Over Screen

Technical Architecture

Architecture Pattern: MVVM + Repository

UI Layer (Jetpack Compose)
    ↓
ViewModel Layer (StateFlow + Coroutines)
    ↓
Repository Layer (Data Abstraction)
    ↓
Data Sources (JSON + Location Services)

Tech Stack

Category Technology Purpose
UI Framework Jetpack Compose Modern declarative UI
Architecture MVVM + Repository Pattern Clean separation of concerns
State Management StateFlow + Coroutines Reactive state handling
Navigation Navigation Compose Type-safe screen navigation
Location Google Play Services GPS and location tracking
Data Gson + JSON Local data persistence
Theming Material 3 Dynamic theming support

Project Structure

app/src/main/java/com/example/mobile_treasure_hunt/
├── data/
│   ├── model/Clue.kt                 # Data models
│   └── repository/ClueRepository.kt  # Data access layer
├── location/
│   ├── Haversine.kt                  # Distance calculations
│   └── LocationHelper.kt             # GPS integration
├── ui/
│   ├── navigation/AppNavigation.kt   # Navigation logic
│   ├── screens/                      # UI screens
│   └── theme/                        # Material 3 theming
└── viewmodel/GameViewModel.kt        # Business logic

Technical Highlights

1. Advanced Location Services

  • Real-time GPS tracking with configurable update intervals
  • Haversine formula for accurate distance calculations
  • Proximity-based clue validation (25-meter radius)
  • Background location handling with proper lifecycle management

2. Reactive State Management

data class GameUiState(
    val allClues: List<Clue> = emptyList(),
    val currentClueIndex: Int = 0,
    val elapsedTime: Long = 0L,
    val isTimerRunning: Boolean = false,
    val huntStatus: HuntStatus = HuntStatus.NOT_STARTED,
    val userLocation: Location? = null
)

3. Modern Android Architecture

  • ViewModel: Manages UI-related data with lifecycle awareness
  • Repository Pattern: Abstracts data sources for testability
  • StateFlow: Reactive state management with coroutines
  • Dependency Injection: Clean separation via ViewModelFactory

4. Material 3 Design System

  • Dynamic theming support (Android 12+)
  • Custom color schemes for immersive experience
  • Responsive typography and spacing
  • Dark mode compatibility

User Experience Features

Game Flow

  1. Start Screen: Welcome interface with game rules
  2. Clue Screen: Active hunt with timer and location detection
  3. Solved Screen: Celebration and location information
  4. Completion Screen: Final results and replay option

Smart Interactions

  • Proximity Detection: Automatic clue validation when near targets
  • Hint System: Progressive assistance without spoilers
  • Timer Management: Pause/resume functionality
  • Error Handling: Graceful location permission and GPS issues

Development Setup

Prerequisites

  • Android Studio (Latest stable version)
  • Android SDK API Level 24+ (Android 7.0)
  • Physical device or emulator with GPS support

Installation

  1. Clone the repository:

git clone https://github.com/jscervantes/nyc-rat-race

  1. Open the project in Android Studio (latest stable version recommended).
  2. Let Gradle sync and download dependencies.
  3. Connect an Android device or start an Android Emulator (API level 21+ recommended, API level 31+ for Dynamic Color).
  4. Select the app configuration and click the "Run" button (green play icon).

Build Configuration

  • Min SDK: 24 (Android 7.0)
  • Target SDK: 36 (Android 14)
  • Compile SDK: 36
  • Kotlin: 2.0.21
  • Gradle: 8.11.1

Built with modern Android development practices

About

It's an NYC Rat Race.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages