← Back to All Projects

Simple Cube Game

May 2019 Learning Project

A simple 3D game where you play as a cube and have to avoid falling off platforms and bumping into obstacles to reach the end.

  • Unity
  • C#
  • 3D Platformer
  • Physics
Simple Cube Game Screenshot

Project Overview

Cube Racer is a minimalist runner game I built in Unity as an exercise. The player controls a cube navigating an obstacle courses, requiring precise timing and reflexes to survive increasingly difficult sections.

I built this as a solo project to practice C# programming and create a game that could run smoothly in browsers. The simple geometric aesthetic and tight controls make it accessible while maintaining a challenging skill ceiling.

What Made This Project Successful

The game's strength lies in its simplicity and polish. The controls are incredibly responsive—a single tap makes the cube jump, and the jump arc feels perfect after extensive tuning. I implemented a coyote time mechanic (players can still jump briefly after leaving a platform) and jump buffering (pressing jump slightly early still registers), which makes the controls feel more forgiving without reducing difficulty.

The procedural generation system creates fair but challenging obstacle patterns. I built a chunk-based spawning system with predefined obstacle templates that combine randomly, ensuring variety without generating impossible sections. Difficulty scales gradually by increasing obstacle density and platform spacing.

The minimalist art style with neon colors against a dark background creates visual clarity—players instantly understand what's dangerous and what's safe. I used post-processing effects sparingly (bloom and color grading) to maintain high performance.

Key Takeaways

This project taught me the importance of game feel through iteration. The jump mechanic went through 20+ iterations before it felt "right." I learned that precise timing isn't just about physics values—it's about visual feedback, audio cues, and predictable behavior.

The WebGL build process taught me about performance constraints in browser games. I had to aggressively optimize draw calls using static batching, reduce texture sizes, and eliminate expensive post-processing effects. I learned to profile WebGL builds specifically, as performance characteristics differ significantly from standalone builds.

Procedural generation taught me to balance randomness with designer intent. Fully random obstacle placement created frustrating difficulty spikes, but handcrafted levels felt repetitive. The template-based approach gave me the best of both worlds.

Technical Highlights

Technical features:

**Responsive Controls**: Input buffering system queues jump inputs for 0.1 seconds, coyote time allows jumps 0.15 seconds after leaving platform, and variable jump height based on button hold duration.

**Procedural Generation**: Chunk-based spawning with weighted random selection from obstacle templates, difficulty curve based on distance traveled (increases spawn rate and gap distances), and fair generation algorithm that ensures every section is completable.

**Performance Optimization**: Static batching for all obstacles and platforms (reduces draw calls from 200+ to 5), object pooling for chunk reuse (zero runtime allocations), and simplified particle effects using Unity's particle system with minimal emission.

**WebGL Optimization**: Texture atlasing for all sprites, compressed audio files using Unity's compression settings, and minimal use of physics (kinematic rigidbodies for most obstacles).

**Scoring System**: Distance-based scoring with multiplier for consecutive perfect jumps, local high score persistence using PlayerPrefs, and score display with animated number scrolling.

**Camera System**: Smooth follow camera with position dampening, dynamic offset based on cube velocity (looks ahead during fast movement), and automated field-of-view adjustments for cinematic feel.

Interested in This Project?

I'd love to discuss this project in more detail or explore how similar solutions could benefit your team. Let's connect!