How mrde4olt/sdage works
1. High-level shape
- This is a small game project organized around a core game loop, scene-based UI, and a separate domain layer for gameplay rules/state.
- The repository is split more like a classic game architecture than a web/app architecture.
2. Entry point and app bootstrap
- main.py is the likely startup entry point.
- settings.py and data/config.py appear to hold runtime/game configuration such as window, timing, and gameplay constants.
3. Core runtime
- core/game.py is the central orchestrator: it likely owns the main loop, scene transitions, and top-level update/render flow.
- core/gamestate.py probably defines the active mode/state of the game and current scene context.
- core/timer.py provides time-based mechanics used by gameplay or UI transitions.
- core/events.py looks like the internal event channel used to decouple gameplay, UI, and audio.
4. Domain layer: gameplay rules and state
- The domain/ package contains the actual game mechanics and world state:
- anxiety.py
- boss.py
- doors.py
- office_state.py
- report.py
- work.py
- day_session.py
- These modules likely model the player’s day/session flow, task progression, pressure/anxiety systems, and office-specific constraints.
- This layer should be treated as the game’s “truth” layer, separate from presentation.
5. Scene-based presentation layer
- ui/scenes/ contains the major screens/modes:
- menu_scene.py
- office_scene.py
- work_monitor_scene.py
- relax_monitor_scene.py
- report_monitor_scene.py
- game_over_scene.py
- win_scene.py
- This strongly suggests the game flows through a scene/state machine: menu → gameplay scenes → end states.
- Scenes likely handle input, draw the screen, and call into domain objects to advance gameplay.
6. Overlay and reusable widgets
- ui/overlay.py is probably a shared HUD or cross-scene overlay used during gameplay.
- ui/widgets/ contains reusable UI controls:
- button.py
- progress_bar.py
- These are presentation primitives used by scenes rather than containing game rules.
7. Audio subsystem
- audio/audio_manager.py centralizes sound playback.
- audio/sound_events.py likely maps gameplay or core events to sound effects/music cues.
- This indicates audio is event-driven rather than tightly coupled to scenes.
8. Data and tuning
- data/balance.py and data/config.py separate tunable numbers from code.
- data/balance.py likely contains gameplay pacing and difficulty values.
- This makes balancing and iteration independent from the domain logic.
9. Assets
- assets/fonts/ and assets/images/ store visual resources.
- audio/ is both a code package and likely the source for sound assets elsewhere in the repo.
- The project appears to be file-asset driven, with scenes and widgets loading local resources.
10. Probable data flow
- Input enters through the active scene.
- The scene updates domain state objects in domain/.
- Domain changes emit core events or state changes through core/events.py.
- audio/audio_manager.py reacts to sound events.
- UI scenes/widgets render the current state back to the player.
- core/game.py coordinates this loop and decides when to switch scenes.
11. Key boundaries for an architecture diagram
- Bootstrap/runtime boundary: main.py, settings.py, core/game.py
- Game rules boundary: domain/*
- UI/presentation boundary: ui/scenes/*, ui/widgets/*, ui/overlay.py
- Support services: audio/*, core/events.py, core/timer.py
- Static content/configuration: assets/*, data/*
12. Likely architectural style
- The repo uses a layered, event-driven game architecture with a scene/state machine at the top.
- The important relationship is: core loop drives scenes; scenes manipulate domain state; events bridge to audio and UI effects.
Main entry points: game.py Game loop · day_session.py Day session · office_scene.py Office · audio_manager.py Audio manager
Components 30
Bootstrap & runtime
Application entry, global settings, and game loop orchestration.
Core systems
Runtime coordination, state, timing, events, and asset loading.
- Game loop · Owns the main loop and scene switching.
core/game.py - Game state · Tracks active mode and current state context.
core/gamestate.py - Timer · Time-based mechanics and scheduling support.
core/timer.py - Events · Internal events used to decouple systems.
core/events.py - Asset loader · Central asset access and loading helpers.
core/assets.py
Game domain
Gameplay rules and persistent in-world state.
- Anxiety · Pressure or stress-related gameplay state.
domain/anxiety.py - Boss · Boss behavior or supervision constraints.
domain/boss.py - Doors · Door-related gameplay constraints and state.
domain/doors.py - Office state · Current office situation and available interactions.
domain/office_state.py - Report · Reporting or end-of-day progression state.
domain/report.py - Work · Work progression and task-related state.
domain/work.py - Day session · Coordinates the flow of a play session or day.
domain/day_session.py
UI layer
Scenes, overlays, and reusable widgets.
- Menu · Start screen and main navigation.
ui/scenes/menu_scene.py - Office · Primary gameplay scene and interaction hub.
ui/scenes/office_scene.py - Work monitor · UI for work-related status and progress.
ui/scenes/work_monitor_scene.py - Relax monitor · UI for recovery or low-pressure state.
ui/scenes/relax_monitor_scene.py - Report monitor · UI for reporting or progress review.
ui/scenes/report_monitor_scene.py - Game over · Failure/end state screen.
ui/scenes/game_over_scene.py - Win · Success/end state screen.
ui/scenes/win_scene.py - Overlay · Shared HUD or cross-scene overlay.
ui/overlay.py - Button · Reusable clickable control.
ui/widgets/button.py - Progress bar · Reusable progress indicator.
ui/widgets/progress_bar.py
Audio
Sound playback and sound-event mapping.
- Audio manager · Central sound playback and mixing control.
audio/audio_manager.py - Sound events · Maps game events to audio cues.
audio/sound_events.py
Data & tuning
Runtime configuration and gameplay balance values.
Connections 35
- Main → Settings: loads · Bootstraps the app with global settings.
- Main → Game loop: starts · Creates and runs the main game loop.
- Game loop → Game state: tracks · Maintains the active game state.
- Game loop → Events: routes · Dispatches internal events between systems.
- Game loop → Timer: ticks · Advances time-dependent mechanics.
- Game loop → Menu: opens · Starts in the menu scene or transitions into it.
- Game loop → Office: switches · Transitions between active scenes.
- Game loop → Game over: switches · Transitions to failure state scenes.
- Game loop → Win: switches · Transitions to success state scenes.
- Game loop → Audio manager: uses · Coordinates audio playback during runtime.
- Game loop → Asset loader: loads · Loads shared resources used by scenes.
- Office → Office state: reads · Renders and updates office gameplay state.
- Office → Day session: advances · Drives the current session flow.
- Office → Overlay: shows · Uses the shared HUD during gameplay.
- Office → Button: uses · Builds interactive controls.
- Office → Progress bar: uses · Displays progress and status.
- Work monitor → Work: reads · Shows work progression state.
- Relax monitor → Anxiety: reads · Reflects reduced or changing pressure state.
- Report monitor → Report: reads · Shows report or review state.
- Menu → Button: uses · Builds menu actions.
- Day session → Work: coordinates · Sequences work-related progression.
- Day session → Report: coordinates · Moves into reporting or end-of-day flow.
- Day session → Anxiety: updates · Adjusts pressure or stress over time.
- Day session → Boss: checks · Applies boss-related constraints or triggers.
- Day session → Doors: checks · Applies door or access constraints.
- Day session → Events: emits · Publishes gameplay events for decoupled consumers.
- Audio manager → Sound events: maps · Translates events into audio cues.
- Sound events → Events: subscribes · Consumes core events to trigger sounds.
- Asset loader → Fonts: loads · Provides font resources to the UI.
- Asset loader → Images: loads · Provides image resources to the UI.
- Settings → Config: pulls · Uses configuration values for runtime setup.
- Config → Balance: includes · Separates tunable balance values from app config.
- Office → Audio manager: triggers · Requests audio feedback from gameplay actions.
- Report monitor → Audio manager: triggers · Can trigger audio during report flow.
- Game over → Audio manager: triggers · Can trigger end-state audio cues.