Monthly Archives: June 2012

shoot the coconut

For some reason, one physics problem that has stuck with me since I was an undergrad is the “shoot the coconut” problem. The scenario involves a coconut falling from a tree and another projectile being thrown or launched at it. Students have to calculate the right angle and velocity of the projectile to hit the coconut before it hits the ground.

The Puzzle Maker is perfect for bringing physics problems to life. Here’s my take on shooting coconuts in Portal 2.

Let’s do a little bit of informal physics to calculate the velocity of cube 2 when launched. For simplicity’s sake, we’ll label the falling cube C1, and the launched cube C2.

C1 falls about 13 panels (units) before striking C2. Using the equation for displacement, we find that it takes about

t = sqrt (2*h/g)          (1)

to reach the point of impact. By equation 1, t = 2.35 s. That is, of course, without air resistance. Taking into account air resistance and the amount of time it takes for the cube to actually leave its dispenser give us t = 3.6 s (calculated with a stopwatch, by the way).

It takes almost 2.7 s for C2 to drop, roll, hit the AFP and get launched through the air (this number actually varies from test to test because cubes don’t always leave their dispensers in exactly the same way).

That leaves us with about 1.1 s for C2 to leave the angled panel, fly through the air and strike C1 as it falls. C2 leaves the orange portal at an angle, θ = 45 degrees and has to travel 4 panels in the x-direction to reach C1. So, in the x-direction, C2 has a velocity, vx = 3.6 u/s. Using trigonometry, we start with

vx = v*cos(θ)          (2)

and then rearrange to find

v = vx/cos(θ)          (3)

which tells us the initial velocity of C2. After plugging in our variables, equation 3 tells us that C2 has an initial velocity of v = 6.9 u/s.

Gotta love physics.

Advertisement

Why teach with Portals?

Physics classrooms are behind the times. At school, kids use 1990s technology (if they use technology at all) but then go home and play ultra realistic games. [Sidenote: if you clicked on the first link in this sentence, you found PhET, run by CU Boulder, which I actually use all the time. I don’t mean to bash PhET at all because it’s actually awesome and shows some great examples of physics simulators. They’re perfect in many cases for their ease and utility in the classroom. But there’s a big difference between them and modern games.] There’s a huge disconnect between what kids are exposed to and used to in terms of technology and what we give them in school. It’s no wonder that students are falling behind in science.

But we can adapt.

As teachers, we’re receiving students with the built-in capability to be fully immersed within game worlds. Why not use those same skills and game worlds to teach them physics? Give them something they’re used to and simply reroute their attention from killing each other (which is, unfortunately, what normally happens within games) to building physics experiments. It isn’t much of a leap, especially considering that Portal 2 is, at its core, one big physics puzzle after another.

We’re wasting valuable resources when we don’t harness our students’ innate ability to use technology and lose themselves in game worlds. Using some careful planning, teachers can create a classroom environment where students manipulate digital worlds to create measurable scientific experiments that run on laws of physics. It’s a unique opportunity for educators. For the first time, we can let students play god and design their own worlds. We can put students in impossible situations (for safety concerns or otherwise) that run on actual laws of physics and instruct them to run tests and see what’s going on behind the scenes. They can build their own virtual experiments as valid as their physical counterparts in less time and with less effort. Teaching with Portal 2 is about students actively building and applying what they’ve learned.

Basically, Portal 2 is a tool that allows for easy creation, manipulation and sharing of virtual worlds that run on actual laws of physics. What can be done with it is only limited by the creativity of the educator.

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!

%d bloggers like this: