Overview
Chapter includes an immersive 2.5D isometric game world built with SpriteKit that serves as an alternative navigation interface. Players can explore zones, interact with buildings, and engage with multiplayer features.GameManager - Central State Controller
TheGameManager (GameManager.swift:36) is a singleton ObservableObject that bridges SpriteKit scenes with SwiftUI overlays:
GameManager.swift
Game Hubs and Enrollment Status
The game world adapts to the user’s university journey stage:GameManager.swift
Hub Mapping Logic
GameManager.swift
Zone-Based Scene Architecture
The game uses a zone-scene model where each zone is an independent SpriteKit scene connected via boundary arrows.Zone Configuration
Zones are defined using data-driven configs (ZoneConfig.swift:225):
ZoneConfig.swift
Zone Adjacency
Zones declare their neighbors:ZoneConfig.swift
Exit Zones
Players transition by walking into rectangular exit regions:ZoneConfig.swift
Scene Loading and Caching
Scenes are lazily loaded and cached for performance (GameManager.swift:201):
GameManager.swift
GameContainerView - SwiftUI Wrapper
TheGameContainerView (GameContainerView.swift:17) hosts the SpriteKit scene and overlays:
GameContainerView.swift
Building Interactions
When a player taps a building, the game triggers existing app navigation:GameManager.swift
Building Configuration
Decoration System
Zones can include static decorations:ZoneConfig.swift
DecorationFactory.swift:
Animation Overlays
Zones support procedural animations:ZoneConfig.swift
NPC System
NPCs are placed in zones and can trigger dialogue:ZoneConfig.swift
GameManager.swift
Collision Detection
Zones can load polygon collision maps:ZoneConfig.swift
ZoneCollisionMap.swift:
Orientation Support
Zones can define separate layouts for portrait and landscape:ZoneConfig.swift
Multiplayer Integration
The game integrates withMultiplayerService for real-time player presence:
Performance Optimizations
Scene Caching
Scene Caching
Previously visited zones remain in memory (up to 3 zones) for instant revisits.
Viewport Culling
Viewport Culling
ViewportCullingManager hides off-screen nodes to reduce rendering overhead.Lazy Asset Loading
Lazy Asset Loading
Zone assets (decorations, NPCs) are only instantiated when the zone is entered.
Batched Rendering
Batched Rendering
Similar decorations use texture atlases and batch rendering.
Game-First Mode
WhenisGameFirstMode is true, the app shows only the game world without tabs:
MasterTabView.swift
NavigationRouter.swift
Architecture Benefits
- Data-Driven: Zones configured via JSON, no code changes needed
- SwiftUI Integration: Game state exposed via
@Publishedproperties - Reusable Components: Decorations, NPCs, and animations are composable
- Multiplayer-Ready: Built-in presence and chat integration
- Adaptive: Adjusts to user’s enrollment status automatically
Related Documentation
Architecture Overview
Learn how the game integrates with the app architecture
Navigation System
Understand how building taps trigger app navigation