← Back to Projects

Engineering Case Study

Grid-Based Builder System

A Unity technical prototype exploring grid-based placement, rotation-aware footprints, and modular gameplay architecture.

UnityC#ScriptableObjectsObject Pooling

Role

Gameplay Systems Programmer

Project Status

Technical Prototype

Technical Focus

Grid Systems, Gameplay Architecture, Placement Validation, Data-Driven Design

Section 01

Project Demonstration

Grid-based building placement prototype in Unity

Section 02

Media Gallery

Grid-based builder prototype media
Prototype media from the existing Grid Builder project assets.
Grid Builder gameplay environment
Additional existing project media; replace with a more specific placement or validation frame when available.

Section 03

Project Overview

This project is a grid-based building system developed in Unity to explore object-oriented programming, modular gameplay systems, and practical software architecture.

Inspired by builder-style games such as Clash of Clans and SimCity, the primary goal was to create a reusable foundation for building placement rather than develop an entire city simulation.

Section 04

Engineering Challenge

A flexible placement system must translate world coordinates into discrete grid cells, validate occupancy and bounds, and support buildings with different footprints and rotations.

01

Separate grid calculations from Unity presentation logic.

02

Support single-tile and multi-tile buildings.

03

Prevent placement outside valid grid boundaries.

04

Account for footprint changes when buildings rotate.

05

Provide readable visual feedback during placement.

06

Keep building definitions configurable through data.

Section 05

System Architecture

The prototype separates grid representation, placement validation, building definitions, and visual feedback into distinct responsibilities.

Grid Builder system architecture diagram
Architecture diagram for the Grid Builder system, showing input, placement validation, grid occupancy, previews, and pooling responsibilities.
MODULE 01

Grid Core

Pure C# logic for world-to-grid coordinate conversion, tile bounds, and cell occupancy.

MODULE 02

Placement Validation

Evaluates whether a building footprint occupies valid, available grid cells.

MODULE 03

Building Definitions

ScriptableObject-based configuration for selecting and representing building types.

MODULE 04

Placement Preview

Ghost placement feedback and pooled footprint visualization during user interaction.

Section 06

Technical Implementation

The implementation focuses on the underlying placement mechanics and a maintainable division of responsibilities.

01

World-to-Grid Conversion

Converts placement positions in world space into discrete grid coordinates.

02

Tile Occupancy

Tracks occupied cells and checks whether placement remains within grid boundaries.

03

Multi-Tile Buildings

Supports structures occupying more than one grid cell.

04

Rotation-Aware Footprints

Adjusts the occupied footprint according to building rotation.

05

Placement Feedback

Uses ghost previews and pooled footprint visuals to communicate placement state.

06

Data-Driven Selection

Uses ScriptableObjects to support a UI-driven building selection workflow.

Section 07

Technical Deep Dive

Rotation-aware footprint validation

Problem

A building footprint cannot be validated as a fixed set of cells once the building can rotate. Its dimensions and candidate cells must be evaluated against the current orientation.

Solution

The placement flow derives candidate grid cells from the building footprint and rotation, then checks bounds and occupancy before allowing placement.

Trade-off: Keeping validation separate from visual feedback makes the rules easier to reason about, but requires the preview and commit paths to share the same validation result.

candidateCells = footprint.cellsFor(rotation)
if (!grid.isWithinBounds(candidateCells)) return Invalid
if (grid.isOccupied(candidateCells)) return Invalid
return Valid

Data-driven building definitions

Problem

Hardcoding every building type into placement logic would make the system difficult to extend and tune.

Solution

Building definitions are represented as ScriptableObjects so selection and footprint data can be configured independently from the placement system.

Trade-off: The data-driven workflow adds asset setup overhead, but reduces branching in gameplay code and supports more consistent iteration.

Section 08

Validation & Known Checks

Bounds validation

Method: Attempt placement near and beyond the grid boundary with different footprint sizes.

Result: The placement rules account for the complete footprint rather than checking only the cursor cell.

Occupancy validation

Method: Attempt placement over occupied and available cells.

Result: Placement feedback distinguishes available cells from cells that cannot accept another building.

Rotation validation

Method: Rotate multi-tile footprints before checking candidate cells.

Result: The candidate footprint is recalculated for the active orientation before placement is committed.

Section 09

Results & Key Learnings

Outcomes

  • Implemented the MVP grid and placement mechanics described in the project.
  • Established a reusable foundation for expanding the builder prototype with additional gameplay systems.

Key Learnings

  • Separating system responsibilities using object-oriented design.
  • Applying single-responsibility principles to gameplay architecture.
  • Using ScriptableObjects for data-driven configurations.
  • Applying object pooling to repeated visual elements.
  • Designing gameplay systems for future iteration and extension.

Explore more engineering work.

View other projects or get in touch.