Portland Community College | Portland, Oregon Portland Community College

CCOG for MM 278 Spring 2024

View archive version »
Course Number:
MM 278
Course Title:
Game Physics
Credit Hours:
4
Lecture Hours:
30
Lecture/Lab Hours:
20
Lab Hours:
0

Course Description

Applies the fundamentals of physics to games from both a technical and creative perspective. Provides hands-on experience with 2D and 3D game physics engines to explore how the basic principles of physics (force, mass, acceleration, friction, inertia, kinematics and mechanics) can be represented in games. Teaches calculations used to control, create, and debug physics effects. Explores physics-based effects and mechanics at play in modern games and theorizes how they were achieved. Prerequisites: MM 242 or MM 243, and (WR 115 and RD 115) or IRW 115 and MTH 20 or equivalent placement. Audit available.

Intended Outcomes for the course

Upon completion of the course students should be able to:

  1. Identify the role of physics engines in game-making software and describe how they interpret real-world physics to simulate physical systems.
  2. Demonstrate primary physics components to create predictable interactions.
  3. Use math functions within game engine.
  4. Combine aesthetic and physics principles to create meaningful gaming experiences.

Course Activities and Design

Course material will be presented in a lecture format. This course is designed to maximize learning through the use of strategies such as outcome based instruction, collaborative learning, contextual application and performance based assessment. Lecture material will consist of discussion, diagrams, multimedia, and other educationally sound practices. Other activities will include hands-on utilization of multimedia software. Demonstration and handout materials will be provided.

Outcome Assessment Strategies

The instructor will outline the methods used to evaluate student progress and the criteria for assigning a grade at the beginning of the course. Evaluation will be based upon a combination of in-class participation, attendance, examinations, and quality of the multimedia project(s). Determination of problem solving skills, team work, and communication skills may also be included.

Course Content (Themes, Concepts, Issues and Skills)

·       Introduce the concept of physics in games at a high level

o   Why do games have physics systems?

o   How do they affect game design and the player’s experience?

·       Introduce math and science of real-world mechanics  

o   Units (Unity uses metric)

o   Newton’s laws of motion

o   Key terms

§  Force

§  Mass

§  Friction (static, moving)

§  Energy (kinetic, potential)

§  Velocity vs. Speed

o   Key formulae:

§  Force = mass * acceleration

§  Velocity = distance * time

§  Acceleration = change in velocity / change in time

§  Parametric equations

§  Weight

§  Friction (and μ)

Defining Game Physics

  • Survey of physics in games
    • 2D vs. 3D
    • Realistic vs. artistic/surreal
    • Modern vs. retro
    • How does a computer, game console, or phone calculate physics effects?
      • CPUs, GPUs, and PPUs (physics processing units)
  • Overview of common game physics engines
    • 2D: Box2D, matter.js, p2.js
    • 3D: Unity, Unreal Engine
    • What do they have in common? What’s different between them?

2D Physics, Cartesian Plane

  • Workshop: Intro to 2D Physics in Unity
    • Math: the Vector2 data type
    • Rigidbodies and colliders: Rigidbody2D Collider2D
    • Attaching and modifying physics components on GameObjects
  • Configuring a GameObject for physics interaction
    • Mass, Drag, and Angular Drag properties
    • Kinematic objects
    • Interpolation
    • Collision Detection modes
    • Constraints (e.g., restricting physics behavior to one or more axes)
  • Adding force 
    • rigidbody2D.AddForce() method
    • rigidbody2D.AddTorque() method
    • Types of force:
      • Sustained (e.g., gravity, bodies of water)
      • Impulse (e.g., two objects collide)
      • Rotational (e.g., moving a seesaw)

2D Physics in Unity

    • How Unity processes physics code (the FixedUpdate() loop versus the Update() loop)
  • Explore: Tools to measure and debug physics
    • Debug.DrawRay() to visualize collisions
    • Collider graph (Collision Matrix)
    • Packaging scripts, prefabs
  • Introduce: Simple machines and work
    • Lever
    • Wheel and axle
    • Pulley
    • Inclined plane
    • Wedge
    • Screw
  • Learn: Joints and Springs 
    • Character (ball-and-socket, 360º)
    • Configurable (skeletal, constrained motion)
    • Hinge (shared origin – fingers, doors)
    • Fixed (connected rigid bodies that break)
    • Springs (elastic connected bodies)

3D Physics Overview

  • Overview: going from 2D physics to 3D physics in Unity
    • 3D Plane (XYZ)
    • Vector3()

2D Effectors and Configuring Collisions

  • Learn: Types of Effectors 
    • Surface (collision properties – i.e., falling on a conveyor belt)
    • Area (collision properties in specific areas – i.e., entering a whirlpool)
    • Point (collision interactions – i.e., bodies with different masses and pulls)
    • Buoyancy (floating on surfaces)
    • Platform (one-way collisions) 

Trig Functions – Practical Implementations

  • Learn: Trig functions: sin(), cos(), tan() 
  • Discuss: Real-world examples
    • Sound
    • Engineering
    • Astronomy
    • Motion

Quaternions

Introduce:  Quaternions

  • What is a quaternion?
    • A representation of rotation of an object in 3D space that avoids the problem of gimbal lock (which is also a very weird concept to wrap one’s head around)
  • This is weird and complex stuff, and the math is very hard, but Unity will handle most of it for you
  • Euler angles
  • Linear interpolation
  • Spherical interpolation
  • Look rotation

Escaping Real-World Physics

  • Discuss: Collisions of real-world materials, objects of different densities, etc
  • Connect: real-world physics in class to artistic implementations that enhance users’ engagement
  • Discuss: Language to describe experiences
    • Metaphors
    • Sensation versus explicit action
    • Common feed back and its meaning