|
|
||
|---|---|---|
| .. | ||
| core | ||
| data | ||
| features | ||
| styles | ||
| utils | ||
| README.md | ||
README.md
Source Code Structure
This directory contains the organized source code for the Gooner Training Academy application, structured by feature and responsibility.
📁 Directory Organization
/core - Core Game Engine
game.js- Main game logic, state management, and flow controlgameModeManager.js- Game mode selection and scenario managementmain.js- Electron main process (desktop application entry point)preload.js- Electron preload script for secure IPC communication
/features - Feature Modules
Organized by functional area, each feature is self-contained:
/features/webcam - Photography System
webcamManager.js- Camera access, photo capture, progress tracking, and photo galleries
/features/tasks - Task Management
interactiveTaskManager.js- Task execution, photography integration, and scenario handlingaiTaskManager.js- AI-powered task generation using local Ollama models
/features/audio - Audio System
audioManager.js- Background music, sound effects, and audio controls
/features/images - Image Management
popupImageManager.js- Consequence image popups and display managementimage-discovery-fix.js- Image loading and scanning utilities
/features/ui - User Interface
flashMessageManager.js- Motivational flash messages and UI feedback
/data - Game Data & Configuration
gameData.js- Task definitions, game content, and configuration data
/styles - CSS Stylesheets
styles.css- Main application stylesstyles-dark-edgy.css- Dark theme variantstyles-gaming.css- Gaming theme variantstyles-original-backup.css- Original styles backup
/utils - Utility Functions
desktop-file-manager.js- File system operations and desktop integration
🎯 Design Principles
Feature-Based Organization
- Each feature directory is self-contained
- Clear separation of concerns
- Easy to locate and modify specific functionality
Core vs Features
- Core: Essential game engine and platform code
- Features: Modular functionality that can be developed independently
Data Separation
- Game content separated from logic
- Styles organized by theme
- Configuration centralized
🔄 Dependencies
Inter-Feature Communication
Features communicate through:
- Global event system
- Shared game state (managed by core)
- Well-defined APIs
Loading Order
Scripts are loaded in dependency order in index.html:
- Data layer (
gameData.js) - UI components (
flashMessageManager.js, etc.) - Feature modules (tasks, audio, images, webcam)
- Core game engine (
game.js)
🚀 Benefits
- Maintainability: Easy to find and modify specific features
- Scalability: New features can be added without affecting existing code
- Testing: Features can be tested in isolation
- Collaboration: Team members can work on different features simultaneously
- Debugging: Issues are easier to locate and fix
📝 Adding New Features
- Create a new directory under
/features/[feature-name] - Add your feature files to the directory
- Update
index.htmlto include your scripts in the correct order - Document your feature in this README
- Ensure proper error handling and cleanup
🔧 Build Process
The build process includes all src/ files thanks to the updated package.json configuration. No additional build steps are required for the new structure.