Game Programming - Course Introduction

Game Programming

Design Patterns in Unity 🎮

CSCI 3213 - Game Programming

Spring '26 - Week 1, Class 1

Welcome to the world of professional game development!

Course Overview

This semester, you'll learn professional game development using Unity and C#

What We'll Build

  • Blade Racer - A futuristic arcade racing game
  • Implement professional design patterns
  • Build reusable, maintainable game systems
  • Create a portfolio-worthy project
Philosophy: We're not just making a game - we're learning to write professional, scalable game code.

What You Should Already Know

C# Core Features

Access Modifiers

  • public and private keywords
  • protected and internal
  • Encapsulation principles

Data Types

  • Primitive types (int, float, bool, string)
  • Arrays and collections
  • Reference vs value types

OOP Concepts

  • Classes and objects
  • Inheritance (base/derived)
  • Polymorphism basics

What You Will Need to Pick Up Quickly (get gud)

Unity Core Features

MonoBehaviour Scripts

  • Creating and attaching scripts
  • Component-based architecture
  • GameObject references

Unity Editor

  • Creating new scenes
  • Manipulating GameObjects
  • Inspector window usage

Event Functions

  • Awake() and Start()
  • Update() and FixedUpdate()
  • Execution order understanding

Advanced C# Features

We'll be using these advanced concepts throughout the course:

// Static members - globally accessible public static class GameManager { public static GameManager Instance; } // Events - publisher/subscriber pattern public event Action OnGameStart; // Delegates - function pointers public delegate void TimerCallback(); // Generics - type-safe reusable code public class Singleton<T> : MonoBehaviour where T : Component
Don't worry! We'll cover these in depth during our next class crash course. If you need extra help, see me during office hours.

Need a Refresher?

Official Unity Learning Resources

learn.unity.com

Recommended pathways:

  • Unity Essentials - Complete Unity interface overview
  • Junior Programmer - C# fundamentals in Unity
  • Create with Code - Hands-on programming projects
Office Hours: If you need help finding the right resources for your skill level, set up an appointment with me. I'm here to help you succeed!

Course Textbook & Attribution

📚 Primary Reference

Game Development Patterns with Unity 2021
Second Edition

By David Baron

How to Access

  • 📖 Purchase: Available from major book retailers
  • 🏛️ Library: Available at Dulaney Browne Library
  • 💻 Digital: eBook versions available
Note: All course content is adapted and heavily modified from Baron's work. His book provides the foundation for our pattern implementations, customized for the Blade Racer project.

Next Class: C# & Unity Crash Course

What We'll Cover

  • Quick review of static, events, delegates, and generics
  • Unity-specific patterns and best practices
  • Prefabs, ScriptableObjects, and Coroutines
  • Setting up your first project structure

⚠️ Important Note

We won't spend extensive time on basic programming concepts after this. Make sure you're comfortable with fundamental C# and Unity before Week 2!

Environment Setup

Unity Version

Required Version

Unity 2021.3.45f2 (LTS)

✓ Long Term Support (LTS)

✓ Open version (non-Enterprise)

⚠️ Available in Archive Builds

How to Download

  1. Go to unity.com/releases/editor/archive
  2. Navigate to Unity 2021.X section
  3. Find version 2021.3.45f2
  4. Download the Unity Hub installer
  5. Install with platform support for your OS

Environment Setup

Code Editor: JetBrains Rider

Why Rider?

  • Best-in-class Unity integration - Purpose-built for Unity development
  • FREE for students - Full professional license with your OCU email
  • Advanced debugging - Built-in Unity debugger and profiler
  • Intelligent code completion - Unity API autocomplete and suggestions
  • Powerful refactoring - Rename, extract, and restructure with confidence
VS Code Alternative: While I'll be demonstrating with Rider, VS Code is also acceptable. Both will work fine for this course - choose what works best for you!

Get Your Free Rider License

Student Educational Access

Step-by-Step Instructions

  1. Visit JetBrains Student Portal:
    jetbrains.com/community/education/#students
  2. Click "Apply Now" button
  3. Choose verification method: "University email address"
  4. Enter your OCU email: yourname@my.okcu.edu
  5. Fill out application form with your student information
  6. Check your email for verification link
  7. Activate your license - Valid for 1 year, renewable annually
Important: Use your @my.okcu.edu email address. Approval is usually instant, but can take up to 24 hours.

Installing Rider

1. Download Rider

jetbrains.com/rider/download

Available for Windows, macOS, and Linux

2. Install & Launch

  • Run the installer
  • Follow default settings
  • Launch Rider when complete

3. Activate License

  • Sign in with JetBrains account
  • Your educational license activates automatically

4. Unity Integration

  • Unity plugin installs automatically
  • No additional setup needed!

Connecting Unity to Rider

Setting Rider as Default Editor

  1. Open Unity Editor
  2. Go to Edit → Preferences (Windows) or Unity → Settings (Mac)
  3. Select External Tools in left sidebar
  4. Click dropdown for External Script Editor
  5. Select Rider from the list
    • If not listed: Click "Browse" and navigate to Rider installation
    • Windows: Usually C:\Program Files\JetBrains\Rider\bin\rider64.exe
    • Mac: Usually /Applications/Rider.app
  6. Enable "Regenerate project files" (recommended)
  7. Click "Regenerate project files" button
Test It: Double-click any C# script in Unity - Rider should launch automatically!

Our Project: Blade Racer

Game Overview

A futuristic arcade racing game where the player controls a turbo-charged motorcycle across an obstacle course. The race track is built on a railway system where players can steer between rails to avoid obstacles and collect power-ups.

Core Gameplay Elements

  • 🏍️ High-speed motorcycle racing on a rail system
  • 🎯 Dodge obstacles and collect power-ups
  • ⚡ Turbo boost system with risk/reward mechanics
  • 🔧 Vehicle upgrade system
  • 🎮 Third-person camera following the action

Blade Racer: The World

Year 2097

Humanity has mastered Earth and set sights beyond the solar system. With peace and technology solving all challenges, collective boredom sets in. Enter Neo Lusk, a tech entrepreneur who invents a dangerous new sport: turbo-charged motorcycle racing through deadly obstacle courses.

Only those with nerves of steel and reflexes as sharp as a blade can master this sport.

Even arcade games benefit from narrative context - it gives meaning to gameplay and triggers player imagination!

Blade Racer: Core Systems

🛤️ Rail System

Four-track navigation system with dynamic obstacle spawning

🎲 Risk System

Rewards close-call dodges with bonus points

⚡ Turbo Boost

Speed system with reduced handling trade-off

🔧 Upgrade System

Weapon attachments and vehicle modifications

Each system will be implemented using professional design patterns!

What Are Design Patterns?

Design patterns are reusable solutions to common software development problems.

Origin Story

Architect Christopher Alexander originated the concept for building architecture. In the late 1980s, software engineers adapted these concepts to programming. The classic "Gang of Four" book Design Patterns: Elements of Reusable Object-Oriented Software became the foundation of modern software patterns.

Our Focus: Practical application in Unity game development, not academic theory!

Why Design Patterns Matter

✅ With Patterns

  • Code is reusable and modular
  • Easy to maintain and debug
  • Team communication is clearer
  • Scales to larger projects
  • Professional-quality architecture

❌ Without Patterns

  • Spaghetti code everywhere
  • Bugs multiply with changes
  • Hard to explain to others
  • Breaks at large scale
  • Difficult to extend features

Bottom line: Patterns help you write code that doesn't make you cry when you revisit it 6 months later!

Design Patterns This Semester

Foundational Patterns

📋 Core Patterns (Chapters 4-8)

  • Singleton - Game Manager implementation
  • State - Character state management
  • Event Bus - Managing game-wide events
  • Command - Replay system implementation
  • Object Pool - Performance optimization

Design Patterns This Semester

Behavioral & Structural Patterns

📋 Intermediate Patterns (Chapters 9-13)

  • Observer - Decoupling components
  • Visitor - Power-up system implementation
  • Strategy - Enemy AI behaviors
  • Decorator - Weapon system upgrades
  • Spatial Partition - Level editor optimization

Design Patterns This Semester

Alternative Patterns

📋 Alternative Patterns (Chapters 14-16)

  • Adapter - System integration and compatibility
  • Facade - Simplifying complex subsystems
  • Service Locator - Managing dependencies
Real-world Application: Each pattern will be implemented as part of the Blade Racer game system!

How This Course Works

Weekly Structure

  • Lecture: Learn a design pattern and its use case
  • Implementation: Code the pattern in Unity for Blade Racer
  • Testing: Verify the pattern works correctly
  • Iteration: Refine and integrate with other systems

Theory (30%)

Understanding the pattern's purpose and structure

Practice (70%)

Hands-on implementation in Unity/C#

Example: Singleton Pattern

// Without Singleton - messy! public class Player : MonoBehaviour { GameManager manager; // Have to find this everywhere void Start() { manager = GameObject.Find("GameManager").GetComponent<GameManager>(); } } // With Singleton - clean! public class Player : MonoBehaviour { void Start() { GameManager.Instance.StartGame(); // Direct access! } }

Result: Cleaner code, easier access, guaranteed single instance

Assessment Overview

Weekly Assignments

Implement patterns in your Blade Racer project

40% of grade

Midterm Project

Integrated game systems with multiple patterns

25% of grade

Final Project

Complete Blade Racer with all patterns

35% of grade

Portfolio Bonus: This project will be a strong addition to your professional portfolio!

Before Next Class

Required Setup Tasks

  1. Install Unity 2021.3.45f2 LTS from archive builds
  2. Apply for free JetBrains educational license (use @my.okcu.edu email)
  3. Download and install Rider
  4. Configure Unity to use Rider as external script editor
  5. Create a Unity Hub account (free)
  6. Review C# basics if needed (learn.unity.com)

Optional Preparation

  • Browse the Unity Junior Programmer pathway
  • Review delegates and events in C#
  • Explore the Unity Asset Store
  • Familiarize yourself with Rider's interface
Using VS Code instead? That's fine! Just make sure you have the C# extension installed and configured for Unity.

Course Resources

Official Links

Getting Help

  • Office Hours: Schedule via email
  • Class Discord: Link on course website
  • Peer Programming: Encouraged!

Questions & Discussion 💬

Open Floor

Now is the time to ask questions about:

  • Course expectations and requirements
  • Technical setup and software installation
  • Design patterns and what to expect
  • The Blade Racer project scope
  • Anything else on your mind!

Welcome Aboard! 🚀

Today's Achievements Unlocked:

Next Class: C# & Unity Crash Course

Homework: Complete environment setup (Unity + Rider + Educational License)

Get ready to build something amazing! 🎮