How unkzer0/bamboo-ping-pong-game works
Project Type and Purpose
• This is a Unity 3D WebGL game (“Bamboo Ping Pong”), written in C#.
• It’s a lightweight, single‐scene game flow with menu, mode selection, and play scenes, built for browser deployment via WebGL.
File Structure
• Top‐level folders:
• Assets – all game assets (Audio, Image, Physics materials, Prefabs, Scenes, Scripts, TextMesh Pro plugin)
• Packages – Unity manifest and locks for dependencies (TextMesh Pro)
• ProjectSettings – engine/project configuration
• Key subfolders in Assets:
• Scenes: Main Menu.unity, Mode.unity, PlayGround.unity
• Prefabs: Ball, PowerUps
• Script: core game logic (GameManager, GameSettings, PaddleController, AIPaddle, Ball, UI togglers, PowerUpSpawner, etc.)
• Physics: custom physics materials
• Audio: sound effects
README Insights
• Tech stack: Unity 2021+, C#, WebGL
• Upcoming features hint at extendable modules (AI, power‐ups, skins)
a. Main Components
1. Unity Engine (Physics & Rendering subsystems)
2. Scenes (Menu, Mode Select, Play)
3. Game Manager (controls scene transitions, game state, scoring)
4. Input Layer (Unity InputManager → PaddleController)
5. AI Module (AIPaddle script)
6. Physics Module (Ball.cs + PhysicsMaterials)
7. PowerUp System (PowerUpSpawner, PowerUp scripts, Prefabs)
8. Audio System (AudioManager via ProjectSettings, triggered by GameManager/ball collisions)
9. UI Layer (TextMesh Pro components, UI togglers)
10. External Services: WebGL host (browser)
b. Relationships and Interactions
• User/browser → WebGL build → Unity Engine
• Engine initializes Scene → GameManager reads GameSettings → loads UI (Menu)
• Input Layer listens for player key events → PaddleController applies transform/physics forces
• AIPaddle component queries GameSettings → moves AI paddle via physics forces
• Ball collisions detected by Physics Engine → Ball.cs notifies GameManager → updates score/UI → may trigger PowerUpSpawner
• PowerUpSpawner instantiates Prefabs → impacts Ball/Paddle behaviors
• AudioManager plays sound events on collisions, scoring, UI toggles
c. Architectural Patterns and Principles
• Scene‐based modularity: each scene encapsulates its own UI and scripts
• Manager pattern: centralized GameManager/GameSettings for global state
• Component pattern: Unity MonoBehaviours on GameObjects (Ball, Paddle, PowerUp)
• Event‐driven interactions: use Unity Events (OnCollisionEnter, UI button callbacks)
d. Key Technologies, Frameworks, Libraries
• Unity Engine core modules: Physics2D, Audio, UI
• TextMesh Pro for UI text rendering
• C# scripts as MonoBehaviour components
• WebGL build pipeline for browser delivery