Author Archives: Cameron Pittman

Why Portal 2?

Really, the question should read, “Why the Source engine?”

Over the years, game developers have recognized that the easiest way to make ultra realistic games is to build a game world that follows laws of physics. Rather than using a blank slate and adding objects with imbued laws of physics, game developers have created a physics backbone that determines how objects should behave. Let’s say a game developer wanted to build a game with two boxes of different masses and dimensions that both follow the laws of physics. Being that they have different densities and surface areas, they should fall through the air differently. Either code written for the boxes themselves can handle their respective behaviors, or the game itself can analyze the two boxes and use laws of physics to determine how they should behave. Instead of worrying about intrinsically applying laws of physics to each object individually, game developers simply create the objects and allow the physics engine to determine how the laws of physics affect each object.

Essentially, modern game developers use specialized physics simulators, called physics engines, to make games.

There are numerous physics engines in use by modern games. One of which is Valve’s Source engine.

While Source doesn’t stand apart in its technological capabilities, Valve has inadvertently added features that make it the perfect solution for classroom physics simulations.

  1. Source is free and widely distributed. You’ll notice in the Wikipedia list above that it’s listed under freeware. Creating games or modifying games under the Source engine is free and is actually encouraged. If you acquire any game made by Valve (some of which are free), you get all the tools necessary to mod with Source.
  2. Source is a little old. The first iteration of the Source engine was announced back in 2004, and while it has been updated many times since then, it’s reasonable to say that any computer bought within the last three years or so can run it. Though schools don’t have the most up-to-date technology, it’s much, much easier to run Source on school computers than it is to run other modern physics engines which require nothing less than dedicated gaming PCs.
  3. Source is easy to use. A few months ago this statement wouldn’t have been true. Applying the tools game developers use to make video games is a tedious and time consuming process, for good reason. Games are meticulously designed, with all the nuances game developers need to include to create an immersive world. It takes about an hour for the uninformed to learn how to create a basic room with four walls, a ceiling and a floor using Hammer, Valve’s world creator for Source. A similar process for any other physics engine would take about as much time. You’re looking at hours of tedious work to make something simple because of the amount of freedom given to the user. However, in May, Valve released the Portal 2 Puzzle Maker, which shrinks the process of learning level creation basics down from an hour to about 30 seconds. Of course, it isn’t nearly as powerful or detailed as Hammer, but it’s unmatched in terms of ease and intuitiveness.

Though Valve didn’t have education in mind, it created a physics simulator that is powerful, accessible, free and easily modifiable. In other words, it’s perfect for the classroom.

Oscillators

Correction: I originally labeled this post and the corresponding youtube video as describing a simple harmonic oscillator. Incidentally, it isn’t. It’s just an oscillator. Not sure what I was thinking when I made this. I’ve made all the corrections I could without changing the video. I’ll post an updated version eventually.

Oscillators run through physics. Light waves, sound waves, pendulums, bouncing balls, shock absorbers, springs, circuits, and any other repeated process can be described using the math of oscillators. In Portal 2, we can make an oscillator using two portals placed on a horizontal surface.

A few things to note:

1) Objects other than the player are dampened because they feel air resistance. The strength of the air resistance will be covered later.

2) There is a minimum amplitude for oscillations through portals. No matter the object, eventually it will become an undampened simple harmonic oscillator.

3) As described in the video, the math behind finding the period of an oscillation is pretty simple and appears to work. That being said, it’s worth investigating a little more rigorously to determine the accuracy of the Source engine. Other physics engines have been found to cheat with physics, especially in terms of the way time goes by in the game. For instance, the Karma engine that Unreal Tournament 2004 uses has been found running time at 110% speed. I’d be interested to know if Source does something similar.

edit: 4) This isn’t technically a dampened oscillator! I’ll be investigating the differences soon!

the physics of momentum flings

One of the main mechanics in Portal 2 is the momentum fling, which allows a player to send themselves great distances through the air. A momentum fling redirects momentum gained through potential energy into a parabolic path through the air. It involves two portals, one placed well below a player and another usually placed on a vertical or angled panel. Whatever momentum a player gains going into the portal below them will be conserved as they are flung out of the vertical or angled portal and then fly through the air.

A few things to note:

1) The player flies farther than the companion cube. The player doesn’t feel air resistance while the cube does. Also, it appears that the player lands exactly where the equations say she should (of course, slight approximations were involved, so a little more detailed experimentation would be a good thing). +1 for the Source engine’s accuracy.

2) In class, the momentum fling can be used to investigate multiple areas of physics, including: momentum, conservation of energy, projectile motion, and air resistance. All great physics topics.

3) Adding barriers or obstacles would make this a perfect way to test student knowledge of projectile motion. Give students a maximum ceiling height or a minimum path height (i.e. a wall is between the player and the destination) and allow students to calculate the necessary starting height and portal angle to make it to their destination.

4) Add a moving target to further torture students. Make them calculate the time it takes to make it to a destination. Now they have to figure out the math to fling themselves not only to the right place but at the right time.