Unity Case Study
Bird Sort Mania
Mobile Game Development
Unity WebGL
Game Architecture
AI Workflow

How I Built Bird Sort Mania in Unity in 20 Days

17 min read
Eshan Naithani

Bird Sort Mania — Unity 3D Color-Sorting Puzzle Game Shipped on Android and WebGL

Executive Summary

Bird Sort Mania is a commercial color-sorting puzzle game developed in Unity (Universal Render Pipeline) and shipped across Android (Google Play) and WebGL (GamePix browser portal) within a 20-day development timeline on a $6,000 USD project budget.

As the lead Unity engineer responsible for system architecture, gameplay programming, UI implementation, build optimization, and store deployment, my objective was to deliver a complete, maintainable mobile and web title under a fixed 20-day schedule. Rather than treating AI tools (ChatGPT and Claude) as a replacement for game engineering, I used an AI-assisted workflow to accelerate C# boilerplate generation, data-structure scaffolding, and edge-case debugging—reserving manual engineering time for state-machine correctness, input responsiveness, animation timing, and cross-platform build optimization.

Table of Contents

  1. Project Overview
  2. Production Constraints
  3. Unity Technical Architecture
  4. Core 3D Sorting Gameplay
  5. Level Design and Progression
  6. AI-Assisted Development Workflow
  7. Mobile Performance Engineering
  8. Monetization and Analytics
  9. Testing and Deployment
  10. Technical Challenges and Solutions
  11. Results and Lessons
  12. Play the Game
  13. Discuss a Unity Project

1. Project Overview

Project AttributeVerified Record
Game TitleBird Sort Mania
Genre3D / Stylized Color-Sorting Puzzle
Engine & PipelineUnity (Universal Render Pipeline / URP, C#)
Development Timeline20 Calendar Days
Recorded Project Budget$6,000 USD
Target PlatformsAndroid (Google Play Store) & WebGL (GamePix Portal)
Role & ResponsibilitiesEnd-to-end Unity architecture, C# sorting & level systems, UI layout, animation polish, GA4 telemetry integration, and Android/WebGL release packaging
Core Features DeliveredStack-based branch sorting, multi-bird contiguous transfers, undo history stack, scalable level progression, unlockable backgrounds/themes, and dual mobile/web input

2. Production Constraints

Shipping a commercial puzzle game across both native mobile and browser WebGL in 20 days introduced three strict engineering constraints:

  1. Fixed 20-Day Schedule: Every system had to be modular and deterministic from Day 1. There was no schedule buffer for rewriting tightly coupled spaghetti scripts in Week 3.
  2. Fixed $6,000 Budget: Development had to focus on high-leverage gameplay systems, clean UI states, and reusable level data rather than custom tooling that was not essential to the player experience.
  3. Dual-Target Delivery (Android + WebGL): The codebase had to compile cleanly to an Android App Bundle (.aab) for Google Play and a lightweight WebAssembly (.wasm) bundle for mobile and desktop browsers on GamePix—meaning heavy blocking operations or platform-locked dependencies had to be avoided.

3. Unity Technical Architecture

To keep features decoupled during rapid iteration, the project was organized into five independent C# layers:

Code
┌─────────────────────────────────────────────────────────────────┐
│                     Presentation & Input Layer                  │
│  Touch/Mouse Raycaster  │  Branch View & Bird Animator  │  uGUI │
└───────────────┬─────────────────────────┬───────────────────────┘
                │                         │
                ▼                         ▼
┌───────────────────────────────┐ ┌───────────────────────────────┐
│   Core Sorting State Machine  │ │    Progression & Save Layer   │
│  - Branch Stack Model (LIFO)  │ │  - Data-Driven Level Configs  │
│  - Contiguous Group Transfer  │ │  - Undo Move Command Stack    │
│  - Move & Win Validator       │ │  - Persistent Player State    │
└───────────────┬───────────────┘ └───────────────┬───────────────┘
                │                                 │
                ▼                                 ▼
┌─────────────────────────────────────────────────────────────────┐
│                Platform & Telemetry Services                    │
│  Audio Controller  │  GA4 Analytics Events  │  Android / WebGL  │
└─────────────────────────────────────────────────────────────────┘
  • Data-Model Separation: Branch occupancy and bird color states are evaluated in pure C# data structures before triggering flight trajectories or branch-bobbing animations.
  • Command-Based Undo System: Every valid transfer records a lightweight MoveRecord (sourceBranchIndex, targetBranchIndex, birdColorId, transferredCount) onto a history stack, allowing players to undo moves reliably without desynchronizing visual transforms.
  • Dynamic Background & Asset Packaging: Environment themes and UI layouts are decoupled from the core sorting logic so levels can scale without duplicating scenes.

4. Core 3D Sorting Gameplay

In a sorting puzzle game, gameplay feel and state integrity depend on how branches, slots, and in-flight birds are managed:

  1. Branch and Slot Management: Each branch acts as a bounded Last-In, First-Out (LIFO) stack with a fixed slot capacity (typically 4 slots per branch). Each slot holds a transform anchor where a bird perches.
  2. Move Validation Rules: When a player taps a source branch (Branch A) and then taps a destination branch (Branch B), the move validator checks:
    • Branch A is not empty and is not already a completed, locked monochromatic branch.
    • Branch B has at least one free slot.
    • Either Branch B is completely empty, or the top bird on Branch B shares the exact same BirdColorId as the top bird on Branch A.
  3. Contiguous Group Transfer: If the top two or three birds on Branch A share the same color and Branch B has enough open slots, the transfer moves as many matching birds as fit in a single action.
  4. Win Condition Detection: After each transfer settles, the controller scans all branches: the level is won when every branch is either completely empty or filled to capacity with birds of a single matching color.

Reference C# Architecture: Branch Stack & Move Validation

Below is a concise representation of the C# branch-stack and move-validation logic used to keep sorting rules deterministic:

CSHARP
using System.Collections.Generic;

public struct MoveResult
{
    public bool IsValid;
    public int SourceBranchIndex;
    public int TargetBranchIndex;
    public int BirdColorId;
    public int MovedCount;
}

public class BranchStackModel
{
    public int Capacity { get; }
    private readonly Stack<int> birdColorStack;

    public int Count => birdColorStack.Count;
    public bool IsEmpty => birdColorStack.Count == 0;
    public bool IsFull => birdColorStack.Count >= Capacity;

    public BranchStackModel(int capacity = 4)
    {
        Capacity = capacity;
        birdColorStack = new Stack<int>(capacity);
    }

    public int PeekTopColor() => birdColorStack.Peek();

    public void PushBird(int colorId) => birdColorStack.Push(colorId);

    public int PopBird() => birdColorStack.Pop();

    /// <summary>
    /// Counts how many contiguous birds of the same color sit at the top of the branch.
    /// </summary>
    public int GetTopContiguousColorCount()
    {
        if (birdColorStack.Count == 0)
        {
            return 0;
        }

        int topColor = birdColorStack.Peek();
        int contiguousCount = 0;

        foreach (int color in birdColorStack)
        {
            if (color == topColor)
            {
                contiguousCount++;
            }
            else
            {
                break;
            }
        }

        return contiguousCount;
    }

    /// <summary>
    /// A branch is solved when it is either empty or full of a single matching bird color.
    /// </summary>
    public bool IsBranchSolved()
    {
        if (IsEmpty)
        {
            return true;
        }

        if (!IsFull)
        {
            return false;
        }

        return GetTopContiguousColorCount() == Capacity;
    }
}

5. Level Design and Progression

To keep players engaged beyond the tutorial levels without manually hand-crafting hundreds of Unity scenes, progression was built around a single gameplay scene driven by serialized level data:

  • Difficulty Curve Parameters:
    • Early Levels (Onboarding): Few bird colors (2–3 species) and generous empty buffer branches so players learn the contiguous-transfer and undo mechanics naturally.
    • Mid-to-Late Levels: Increased branch counts (6 to 9+ branches), more distinct bird species, deeper color interleaving at the bottom of stacks, and tighter empty-slot margins requiring multi-step lookahead.
  • Solvability & Reverse-Shuffle Generation: Rather than generating purely random bird distributions—which can easily produce mathematically unsolvable deadlocks—levels can be initialized from solved monochromatic branches and reverse-shuffled through valid backward transfers, ensuring a valid solution path exists from the starting state.
  • Unlock Systems & Visual Variety: Completing level milestones progresses the player toward unlocking new background themes and visual customizations, persisted locally between sessions.

6. AI-Assisted Development Workflow

A core goal of this project was testing how modern AI coding assistants (ChatGPT and Claude) fit into a disciplined Unity production schedule. AI did not build the game autonomously, nor does AI guarantee faster delivery without strong engineering oversight. Instead, it functioned as an accelerator inside a structured Specify → Generate → Audit → Test → Refine loop.

20-Day Production Breakdown

Timeline PhasePrimary Engineering FocusWhere AI AssistedWhat Required Manual Unity Engineering
Days 1–3: Core Gameplay PrototypeBranch data model, LIFO slot transfers, touch selection, and basic win detection.Scaffolding initial C# stack classes, undo command structs, and unit-testable move validation methods.Designing transform hierarchies for branch slots, tuning raycast colliders, and handling mid-flight state locks.
Days 4–10: Core Systems & UI ArchitectureLevel loading pipeline, save/load persistence, HUD Canvas setup, and bird flight transitions.Drafting JSON/ScriptableObject level serialization helpers and UI state manager boilerplate.Building responsive CanvasScaler layouts, wiring button events, and synchronizing flight coroutines/tweens with branch animations.
Days 11–15: Content & Progression ExpansionMulti-tier level difficulty scaling, theme unlocks, and audio/visual feedback hooks.Generating level-shuffle parameter tables and helper Editor scripts for batch-validating level definitions.Playtesting difficulty spikes, balancing branch counts on mobile screens, and verifying asset references.
Days 16–18: Polish & Platform OptimizationVisual/sound feedback, WebGL Wasm code stripping, texture compression, and mobile UI polish.Reviewing C# scripts for per-frame Update() allocations and suggesting collection-reuse patterns.Tuning flight arc curves, landing anticipation/squash-and-stretch feel, URP quality settings, and Addressables packaging.
Days 19–20: QA, Edge Cases & Release PackagingRapid-tap stress testing, Android .aab signing, and GamePix WebGL portal integration.Brainstorming edge-case test checklists (e.g., double-tapping during flight, undoing immediately before win modal).Reproducing race conditions in the Editor, configuring Google Play signing/listings, and verifying WebGL browser compatibility.

Limitations of AI-Generated Code in Unity

  1. Gameplay Feel Cannot Be Prompted: AI can write a Vector3.Lerp movement script in seconds, but a linear interpolation feels robotic. Making a bird hop, bank along a paraboloid arc, flare its wings before landing, and trigger a subtle branch bounce required manual curve tuning in the Unity Editor.
  2. Lifecycle and Race-Condition Blind Spots: AI-generated scripts frequently overlook multi-touch race conditions—such as a player tapping a third branch while a bird is still flying between the first two branches, or tapping Undo on the exact frame the win screen triggers. Every generated method had to be audited and guarded with explicit state flags.
  3. Engine Settings & Serialization: Unity scene wiring, RectTransform anchor behavior across portrait/landscape ratios, and URP/WebGL build settings must be configured and verified directly in the Unity Editor.

7. Mobile Performance Engineering

Because Bird Sort Mania shipped on both Android and browser WebGL (where players launch the game inside mobile Safari and Android Chrome on GamePix), build size and runtime overhead were engineered carefully. For a full deep dive into these techniques, see our Unity Mobile Game Optimization Guide.

Implemented Optimization Techniques

  • Managed C# & WebAssembly Stripping: Configured IL2CPP code stripping and removed unused Unity Package Manager modules so the WebGL loader shell remained compact (sub-15 MB initial WebGL shell configuration on GamePix).
  • Texture & Asset Packaging: Used compressed texture formats (including Basis Universal / compressed web textures for WebGL and hardware-compressed mobile textures for Android) alongside two-tier Addressable asset loading for dynamic background themes.
  • Event-Driven Gameplay Updates: Because a sorting puzzle only changes state when the player taps a branch or when a bird is actively flying, core game logic is event-driven rather than polling all branches inside a heavy per-frame Update() loop.

Production Evidence & Performance Record

In accordance with strict engineering transparency, the table below lists only verified repository specifications and explicitly marks unrecorded hardware profiler metrics as Not measured rather than inventing retrospective benchmark numbers:

Technical / Performance MetricRecorded Status / ValueVerification Source
Engine & Render PipelineUnity (Universal Render Pipeline / URP)Verified in project configuration
Published Android Packagecom.Metalityx.ballPuzzle (Live on Google Play)Google Play Store Listing
Published WebGL ReleaseSub-15 MB initial loader shell with Wasm stripping & AddressablesGamePix Live WebGL Release
Analytics & TelemetryGoogle Analytics 4 (GA4) custom event trackingVerified in repository portfolio record
Average FPS & 95th-Percentile Frame TimeNot measured (raw .data profiler captures not archived in web repo)—
Peak Device RAM Usage (MB)Not measured—
Per-Frame Draw Call CountNot measured—
Reference Physical Test Device ModelNot measured—

8. Monetization and Analytics

In casual sorting puzzle games, monetization and analytics must support the core loop without interrupting player concentration mid-puzzle:

  1. Ad Placement Architecture (Rewarded vs. Interstitial):
    • Rewarded Video Hooks: High-intent, player-initiated placements—such as unlocking an extra temporary helper branch when stuck, earning additional Undo charges, or claiming bonus coins after clearing a stage—give players clear utility in exchange for watching an ad.
    • Natural Transition Boundaries: Forced interstitial ads should never trigger while a player is mid-level; they belong strictly at natural level-complete transitions after onboarding levels and with frequency/cooldown caps. (For full C# implementation details, see our Unity LevelPlay SDK Setup Guide: Interstitial & Banner Ads).
  2. In-App Purchases (Remove Ads):
    • Casual puzzle players frequently convert on a permanent Remove Ads non-consumable upgrade that disables forced interstitials and banners while keeping optional rewarded helper buttons available. (See our Unity IAP 5 Setup Guide: Purchases & Validation for the complete C# StoreController and receipt verification implementation).
  3. GA4 Telemetry & Funnel Tracking:
    • Bird Sort Mania was instrumented with Google Analytics 4 (GA4) telemetry to log level start, level complete, undo/helper usage, and session progression events—allowing level difficulty bottlenecks to be identified from real player progression data. (Specific commercial revenue, retention, and conversion percentages are not publicly disclosed).

9. Testing and Deployment

Delivering both a native Android build and a browser WebGL build required two parallel release pipelines during Days 19–20:

  • Android Release Pipeline (Google Play):
    • Compiled via IL2CPP targeting 64-bit ARM (arm64-v8a), packaged as a signed Android App Bundle (.aab), and published to Google Play under package ID com.Metalityx.ballPuzzle.
  • WebGL Release Pipeline (GamePix):
    • Exported using Unity's WebGL build target with Brotli/Gzip compression, Managed Stripping, and GamePix portal SDK hooks, allowing instant browser play across desktop and mobile web browsers without an app store install.

10. Technical Challenges and Solutions

Below are four concrete engineering challenges encountered during the 20-day build and how each was resolved:

Challenge 1: Multi-Touch Input Desynchronization During Bird Flight

  • Problem: When a player rapidly tapped a third branch while a group of birds was still mid-flight between Branch A and Branch B, the stack count on Branch B could be queried before the landing animation finished—causing visual slot overlap.
  • Engineering Decision: Separate logical stack state updates from visual flight animations, and track per-branch reservation locks.
  • Implementation: Updated the logical BranchStackModel immediately upon move validation (so subsequent taps see the accurate post-move state) while queuing the visual flight tween on the target slot, locking only the actively animating bird slots until landing completed.
  • Result: Players could chain moves rapidly and fluidly without waiting for slow animations to finish or corrupting branch slot positions.

Challenge 2: Preventing Unsolvable Level Deadlocks at Scale

  • Problem: Naively randomizing bird colors across branches at level start can produce configurations that require more empty buffer slots than exist in the level, frustrating players with impossible boards.
  • Engineering Decision: Construct level layouts from guaranteed-solvable states and verify buffer capacity.
  • Implementation: Initialized level configurations from completed monochromatic stacks and applied controlled reverse-shuffle steps (or validated color-group permutations against available empty branches), paired with an always-accessible Undo stack and restart button.
  • Result: Scalable level progression across dozens of stages without impossible starting boards.

Challenge 3: Translating Raw AI-Generated Scripts into Responsive Gameplay Feel

  • Problem: Early AI-generated movement scripts moved birds along straight lines at constant speed and snapped UI panels instantly, making the game feel flat and mechanical.
  • Engineering Decision: Replace linear interpolations with custom curved trajectories, staggered multi-bird takeoff delays, and reactive branch animations.
  • Implementation: Added parabolic flight arcs (Mathf.Sin height offset modulated by an AnimationCurve), a short 0.06s stagger between consecutive birds flying in a group transfer, directional sprite/model facing flips, and a damped spring bounce on the target branch upon landing.
  • Result: Tactile, responsive puzzle interactions that feel rewarding on every tap.

Challenge 4: Keeping the WebGL Build Fast to Load on Mobile Browsers

  • Problem: Standard Unity WebGL builds can easily balloon past 30–40 MB if all background textures, audio clips, and unused engine modules are bundled into the initial .data file—causing mobile browser tab crashes or high bounce rates before the title screen appears.
  • Engineering Decision: Strip unused engine code and split dynamic environment assets out of the initial loader shell.
  • Implementation: Enabled high managed code stripping for WebAssembly, compressed textures with Basis Universal / web-optimized settings, and used two-tier Addressables asset loading so the initial GamePix shell stayed under 15 MB (see our Unity WebGL Performance Guide for full Wasm & Brotli details).
  • Result: Fast initial browser startup across desktop and mobile web browsers on GamePix.

11. Results and Lessons

Confirmed Project Outcomes

  • Delivered on Schedule & Budget: Shipped a complete, commercial Unity puzzle game in 20 days within the $6,000 USD budget.
  • Multi-Platform Launch: Published live on both Google Play (Android) and GamePix (WebGL browser portal) from a shared Unity C# codebase.
  • Reusable Core Systems: Established a clean, modular architecture for stack-based sorting mechanics, command-pattern undo history, data-driven level progression, and GA4 telemetry.
  • (Note: Post-launch commercial KPIs such as D1/D7 retention, CPI, and ARPDAU are not published in this technical case study).

Key Engineering Lessons from the 20-Day Build

  1. AI Accelerates Scaffolding, Not Architecture: AI assistants saved hours on boilerplate serialization, C# data structures, and debugging syntax—but system boundaries, state-machine invariants, and gameplay feel still depended entirely on experienced Unity engineering judgment.
  2. Separate Logic State From Animation State Early: Decoupling the pure C# BranchStackModel from Unity Transform animations on Day 2 prevented an entire class of input timing bugs and made implementing the Undo system straightforward.
  3. Design for Dual Mobile + WebGL Constraints From Day 1: Keeping asset sizes, shader complexity, and code stripping clean from the first week made exporting both the Android .aab and the sub-15 MB GamePix WebGL build smooth in the final two days.

Open-Source Game Scaffolding Tool

To streamline future Unity mobile game setups using the conventions proven during this build (atomic save files, safe-area adaptation, object pooling, consent-gated analytics, and request-file build automation), explore my open-source project bootstrapper:


12. Play the Game

You can play the live commercial builds of Bird Sort Mania directly on Android or in your browser:

Explore More Shipped Unity Titles in My Portfolio


13. Discuss a Unity Project

If your studio or team is planning a new mobile or WebGL title, explore these related technical guides on architecture, optimization, and monetization:

Need a Unity game built, optimized, or prepared for launch? Explore my production engineering work and discuss your project.

Share this article

Get Practical Unity Development Insights

Technical guides on Unity performance, AI gameplay systems, mobile monetization, and game development.

Unsubscribe at any time. Your data is never shared.

Recommended Reading

More articles in Unity Case Study