# unibo-dtm-se-2425-flappypy/artifact architecture

> Architecture diagram of the GitHub repository unibo-dtm-se-2425-flappypy/artifact, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unibo-dtm-se-2425-flappypy/artifact
- Repository: https://github.com/unibo-dtm-se-2425-flappypy/artifact

## Overview

##### Project type and purpose
- This is a standalone desktop game application (“FlappyPy”), implemented in Python (3.9+) using the pygame library.
- Purpose: replicate the classic Flappy Bird mechanics with physics‐based movement, obstacle generation, scoring, audio/visual assets, and a game loop.

##### File structure
- Top-level files and directories:
- FlappyPy/ – main game package with entry points and source code
– assets/ (images, sounds)
– __main__.py (allows `python -m FlappyPy`)
– main.py (central game loop, object instantiation)
- test/ – 50+ unit tests covering physics, collision, scoring, rendering
- CI/CD config: .github/workflows (check.yml, deploy.yml)
- Packaging: setup.py, pyproject.toml, requirements.txt, MANIFEST.in
- Dev tools: requirements-dev.txt, release.config.js, renovate.json

##### README for additional insights
- Confirms core features: game loop, scoring, physics, collision detection, audio, smooth rendering.
- Specifies constants and customization points in main.py (window size, FPS, gravity, jump strength, pipe gap, etc.).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Game Systems"
        GameLoop["Game Loop / Controller"]:::core
        InputHandler["Input Handler"]:::core
        PhysicsEngine["Physics Engine"]:::core
        PipeGenerator["Pipe Generator"]:::core
        CollisionDetector["Collision Detector"]:::core
        ScoreManager["Score Manager"]:::core
        GameStateManager["Game State Manager"]:::core
        Renderer["Renderer"]:::core
    end

    subgraph "Asset & Audio Services"
        AssetManager["Asset Manager"]:::service
        AudioManager["Audio Manager"]:::service
    end

    PygameLib["Pygame Library"]:::external

    GameLoop -->|polls input| InputHandler
    InputHandler -->|updates state| GameStateManager
    GameLoop -->|update phase| PhysicsEngine
    GameLoop -->|spawn obstacles| PipeGenerator
    PhysicsEngine -->|object positions| CollisionDetector
    PipeGenerator -->|generated pipes| CollisionDetector
    CollisionDetector -->|detects collisions| ScoreManager
    ScoreManager -->|updates score| GameStateManager
    GameLoop -->|render phase| Renderer
    Renderer -->|loads assets| AssetManager
    GameLoop -->|audio triggers| AudioManager
    AssetManager -->|provides sounds| AudioManager
    GameLoop -->|uses library| PygameLib

    click GameLoop "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click GameLoop "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/__main__.py"
    click InputHandler "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click AssetManager "https://github.com/unibo-dtm-se-2425-flappypy/artifact/tree/master/FlappyPy/assets/"
    click Renderer "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click PhysicsEngine "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click PipeGenerator "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click CollisionDetector "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click ScoreManager "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click GameStateManager "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"
    click AudioManager "https://github.com/unibo-dtm-se-2425-flappypy/artifact/tree/master/FlappyPy/assets/sounds/"
    click AudioManager "https://github.com/unibo-dtm-se-2425-flappypy/artifact/blob/master/FlappyPy/main.py"

    classDef core fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px
    classDef service fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px
    classDef external fill:#FFE0B2,stroke:#E65100,stroke-width:2px,stroke-dasharray: 5 5
```
