System Architecture¶
Overview¶
The Path (AI-Pi) uses a modular architecture designed for edge AI gaming, with clear separation between game logic, AI processing, and data management.
System Components¶
graph TD
A[Game Client] --> B[Game Server]
B --> C[AI Engine]
C --> D[AI HAT+]
B --> E[Data Store]
C --> E
Core Components¶
- Game Server (Go)
- Handles game state management
- WebSocket communication
- JSON state serialization
- Turn sequencing
-
Action validation
-
AI Engine (Python)
- TensorFlow Lite inference
- Dynamic difficulty (0.2-0.95)
- Personality system
-
Training pipeline (Mac Mini M1)
-
Game Client (TypeScript)
- React with Material-UI
- Redux state management
- WebSocket communication
-
Simple battle UI
-
Hardware Layer
- Raspberry Pi 5 (8GB)
- AI HAT+ acceleration
- Active cooling
- Local storage
Data Flow¶
-
Game State Management
-
AI Decision Pipeline
-
Battle System
Integration Points¶
1. Server-Client¶
interface GameConnection {
// WebSocket connection for battle management
connect(token: string): Promise<void>
createBattle(): Promise<string>
joinBattle(battleId: string): Promise<void>
submitAction(action: GameAction): Promise<void>
forfeit(): Promise<void>
onStateUpdate(handler: (state: GameState) => void): void
}
2. Server-AI¶
class AIInterface:
"""AI engine interface"""
async def process_turn(
self,
state: GameState,
difficulty: float
) -> GameAction:
"""Process game state and return next action"""
3. Client UI States¶
interface UIState {
// Simple UI states
isPlayerTurn: boolean
isWaiting: boolean
availableActions: string[]
battleStatus: 'active' | 'victory' | 'defeat'
}
Performance Considerations¶
- AI Processing
- TensorFlow Lite optimization
- Batch inference when needed
-
Simple state management
-
Client Interface
- Material-UI components
- Basic animations for state changes
-
Disabled controls during AI turns
-
Data Management
- Local game state
- Basic user authentication
- Battle history storage