STAGE 2-3
PROTOTYPE

Flappy Bird

RoleGameplay Programmer
Timeline2025
PlatformUnity 2D (URP) · PC
Team Size1 (Solo)
UnityC#Rigidbody2DObject PoolingNew Input System
STAGE 2-3 // GAMEPLAYFLAPPY BIRDUnityC#Rigidbody2DObject PoolingNew Input SystemSYSTEM_INIT: OK | MEMORY: ALLOCATED | RENDERING: ONLINE

Mission Brief

Build a tight, zero-garbage-collection 2D Flappy Bird mechanics loop in Unity using Rigidbody2D physics and fixed-array obstacle recycling, serving both as a standalone arcade game and as the foundation for the ML-Agents PPO project.

Key Systems Engineered

Zero-Allocation Circular Pipe Pool (PipesManager.cs)

Allocates exactly 10 pipe-pair instances once in Awake(). As pipes scroll at a constant horizontal speed (-6.0f) past -initialXPos, the manager shifts the leading pipe index (firstInLine wrapped via modulo) to the back of the line with a fresh randomized gap height — zero Instantiate() or Destroy() calls during gameplay.

Physics-Driven Flight Controller (PlayerMovement.cs)

Applies vertical impulse directly via rb.linearVelocityY = jumpForce on New Input System callbacks while relying on Unity's Rigidbody2D gravity simulation for natural parabolic arcs.

Modulo Index-Pointer Scoring & Event Decoupling

Tracks the next upcoming pipe via a wrapping nextScoringPipe pointer (% numberOfPipes) and fires OnScoreIncrease as it crosses X = 0, decoupling UI and audio listeners from obstacle movement.

Implementation Details

Architecture & Deep Dive

Flappy Bird implements a zero-allocation gameplay loop where all 10 pipe pairs are pre-instantiated and recycled via a circular index pointer. The pipe speed is a fixed constant (-6.0f) — there is no runtime difficulty scaling.

The scoring system uses a modulo-wrapped pointer to track which pipe is next to be scored, firing an event when the player crosses X = 0. This cleanly decouples scoring from both movement and rendering.

Player

Your class determines which skills and projects are highlighted.