True Bullets?

Posted in: Velocity Raptor | May 7, 2012 | 2 Comments

Thanks to the fine folks over at the xkcd fora, I’m happy to annouce I was wrong about the bullets in Velocity Raptor. I’m even happier to announce that the ‘measured’ bullets have been fixed.

They had been drawn in a way that slanted the bullets away from their true path. Given the argument outlined in April 30th’s post, I thought this was fine. I thought, in fact, it was a demonstration of the Thomas Rotation.

But it turns out this just wasn’t the case. The error in my thought process was that I had LEFT OUT the Thomas Rotation. Two boosts added together can make a boost + rotation. I thought the rotation sprang from my code naturally. But it didn’t. I needed to add that rotation in by hand.

Look how much happier Velocity Raptor is!

So thanks to everyone who brought it to my attention. The ‘measured’ bullets are now fixed in the game. Go enjoy the (now slightly-less) trippy world of Special Relativity.


Post a Comment

What’s up with the bullets?

Posted in: Velocity Raptor | April 30, 2012 | No Comments

That is undoubtedly the most common question about Velocity Raptor. As it turns out, I was wrong. Read the above post for more info…

That is undoubtedly the most common question about Velocity Raptor. And, admittedly, it is counterintuitive. Extremely so. Even and especially for people with a relativity course under their belts. (When I was making the game, it took me a lot of double-checking to feel comfortable with it.) But… we have to listen to the math. We can’t do relativity by intuition alone.

I mention this explanation in the Relativity 101 page, but I think these pictures, and elaboration, could help make the situation clearer.

To understand the behavior of the bullets, we just need one starting point: Length Contraction. If a train is speeding past, a stationary observer would measure it to be shorter than the same train when stationary. And the length contracts in the direction of the motion (the train seems shorter from engine to caboose, not from top to bottom). Not a hard pill to swallow.


As a concrete example about the motion of bullets in the game, we turn to Level 7. Our intrepid hero (Velocity Raptor) finds herself in a room with a cannon. The cannon is firing bullets horizontally across the screen, whereupon they hit a target. VR also decides to run up (vertically upwards on the screen). So we have three frames of reference.


  • That of the Raptor
  • That of the Room, gun, and target
  • That of the bullets

We’ll want to make sure to treat them each independently. For the purposes of this game, we are witnessing the world through the raptor’s frame of reference. So we need to figure out how (a) the room, and (b) the bullets will contract. Let’s start with the room.


Since the raptor is running upwards, to her the room seems to be going down. The direction of relative motion is vertical, so the Length Contraction happens vertically as well. The result is the room seems squished from top-to-bottom. Not a big surprise there.

In the exact same way, we can figure out how the bullets will behave. This time, there are two velocities to take into account. The raptor is running up, and the bullets are flying to the right. So in the view of the raptor, the bullets have a velocity that is down-and-to-the-right. Note that we are being extremely qualitative. Velocity addition in SR is more nuanced than in the standard Newtonian world, but all we care about is that the bullets seem (to the raptor) to be going down and to the right. For ease of our picture, imagine that we’ve chosen the velocities such that the final summed velocity points from one corner of the dotted-line-rectangle to the other.

Then we squish the bullets’ frame along its direction of motion. So in our example, we squish from one corner to the other. (That dotted rectangle around the bullets just helps us keep track of how the frame contracts. You can even pretend it is real, if you’d like… its addition doesn’t affect the results, just makes the picture clearer.)

Again, just a simple Length Contraction. Nothing special. So why did I pretend this was strange?

Ah yes, the final step. Let’s put all the pieces together. The raptor, room, and bullets of course exist together.


And there you have our result. The room is squished in one direction, the bullets in another, and thus the bullets are no longer sitting on a horizontal path across the screen. The cannon (where we know the bullets are starting) and the target (where we know the bullets are ending) lie along a perfectly horizontal line. But the bullets do not. They are sitting on a path aimed up and to the right. At an angle. So you won’t always find the bullets (seemingly) directly between the cannon and the target. In fact, depending on where the raptor stands, she may even see the bullets as emerging at a point distinct from the cannon… and disappearing at a point distinct from the target.

But remember, we didn’t do anything special. No magic, no tricks. Just boring old Length Contraction.

We have, in fact, rediscovered a known fact with our pictures. Two Lorentz boosts in non-parallel directions (aka combining the raptor’s motion and the bullets’ motion) together make not just another Lorentz boost, but also a rotation. Hence why the bullets don’t just seem squished, but also rotated.

Counterintuitive? Sure! But what good result in physics isn’t?

*Did you find a mistake in the steps? I’d love to hear about it. After all, in science, we must always reserve the right to be wrong 😉


Post a Comment

The Electric Field Mystery, part 1

Posted in: Electric Shocktopus, Lesson Time! | August 11, 2015 | No Comments

The forums were quiet.

…too quiet.

In this neck of the woods, Andy knew that meant trouble was brewing.  It was then that A Random Player walked into the room with a problem.  And that problem’s name was Shocktopus.

.     So I heard you made a game about electric fields.

.     That’s right, Andy said, looking up from the line of impeccably tilted test tubes that covered his desk.

.     And I heard the game is scientifically accurate.

.     Well, aside from the questionable marine bi   ology, I sure aim for it to be, Andy said cautiously, memories of Velocity Raptor’s bullet-conundrum swirling like a mist in the back of his head.

.     Then how do you explain *this*? Random said, throwing a picture down on the desk:


Screen Shot 2015-07-27 at 3.02.48 PM

Andy had seen volcanoes before… and they never looked like this.  There was nothing on the top of the screen, but there was an electric field emanating from it.

That was five nights ago, and Andy had been hitting the pavement ever since.  Looking for clues in a town full of shadows.  Where did he go wrong? Was this a bug?  Or worse: not a bug?  Either way, he knew that an understanding wouldn’t come easy.  Where did all this trouble begin?  Oh yes, with the Relaxation Method, which, as it turned out, was anything but.

The Case of the Relaxation Method

Back when he first started out as a gumshoe – programing the first prototypes of The Electric Shocktopus, the world was a simple place.  Electric fields were easy to come by, so long as you knew how solve a simple equation.  And with a computer at his fingertips, solving equations was one thing Andy could do.  Find all the electric charges in a level, find where the Shocktopus is, and you’ve found yourself the force.  Perfect forces.  Perfectly easy.

But, like all things in life, it was simple precisely up until the point when it was not.

And that point was when Andy took on the case of a grounded Conductor (who, incidentally, had been sent to the sleeper car without his supper).  As Andy pieced together the puzzle, he realized that you couldn’t just add conductors into The Electric Shocktopus.  There’s no simple rule for figuring out the forces, then.  No easy equation to solve.  For the fields affect the charges in the conductor, just as the charges in the conductor affect the fields.  You may as well try to track down a criminal who knows you’re on his tail.  Each move you make changes which way he’s running.




But, just like with that criminal.  There was a solution.  You just needed boundaries.  Walls, gates… or in this case, an electrified fence would do the trick.

If you’ve got a conductor all around the outside of your level, you’ve got a way to hunt down the electric field.  It’s called the Relaxation Method.  And just like playing a game of cat-and-mouse, it involves a lot of guessing.  But with each guess, you get closer to the criminal.  Or closer to the final, true electric field.



A Found Field


There’s only one problem.  By putting a ring of conductors up, you’ve changed things.



It just wasn’t the same anymore.


So, how can you put up a ring of conductors around the level, while at the same time not having them affect the level?  In all his years watching crooks melt into the shadows, Andy knew that everything leaves a trace.  Footprints. Cigarette ash. Or warped electric fields.

But there had to be a way.  And Andy had to find it.

To be continued…

Post a Comment

To Another Dimension!

Posted in: Gravity Simulator, Lesson Time! | May 21, 2014 | No Comments

One of the new visitors to the forums brought up a neat topic the other day: Dimensions. Namely, what would gravity look like, if instead of 3 spatial dimensions, we had 2? Or 4? Whoa.

I’ve talked about something similar before with the Electric Shocktopus, but this topic warrants more.  And it needs some swanky gifs from the new Gravity Simulator.



Let’s start off simple.  The world we live in, for all practical purposes, is in three spatial dimensions.  You can go up-down, left-right, or forward-backward.  And in this world, Newton’s Law of Universal Gravitation tells us that two objects with mass will attract each other, according to:


If you only care about the distance, the force goes as 1/R^2, which is why we call this an inverse-squared law.  Double the distance between the earth and the sun, and gravity will pull them together with 1/4 the strength.  Inverse square laws are beautiful, because they lead to cool things like closed and stable orbits.


1/R^2 Force law.  Ah, beautiful, closed orbits.  Home.

1/R^2 Force law. Ah, beautiful, closed orbits. Home.


All GREAT things for life!

Unfortunately, Newton’s Law of Gravity can’t help us when we’re in a world with a different number of dimensions.  The law only works in 3D.


Gauss’s Law

Instead, our starting point instead is Gauss’s Law.  Take a point mass, make an imaginary spherical surface around it.  Imagine that instead of gravity, the point mass is just shooting out 100 bullets in random directions.


How many bullets pass through the sphere around the point mass?  No matter how big or small you make your sphere, the answer will always be 100.  That’s the core of Gauss’s Law.  The number of bullets passing through a sphere doesn’t depend on its radius.  When we’re talking about gravity, the bullets represent the Flux, which is simply the strength of gravity times the area of your sphere.


So then:


If the total flux is always the same, that means the Force of Gravity is proportional to 1/(Total Area of a Sphere).  In 3D, a sphere has a surface area of 4PI*R^2.  So the Force goes as the inverse of that, or 1/R^2.



Suppose we were like the Flatlanders, and lived on a 2D plane.  We could move forward-backward and left-right, but not up-down.  How would that change gravity?

Well, Gauss’s Law still holds.  But this time our ‘sphere’ that we draw around the point mass is actually just a circle.  (Remember, we can’t leave our 2D surface!)  The ‘surface area’ of the circle is just its circumference: 2PI*R.  Which means that the Force of Gravity goes as 1/R.  And we get orbits that look like this:

1/R Force Law.  Notice that the orbits don't match up nicely anymore.

1/R Force Law. Notice that the orbits don’t match up nicely anymore.




What if there were an extra dimension?  Suppose we lived in a world where we could move up-down, left-right, forward-backward, and… and… uh… 4Up-4Down.  We don’t have a word for those last two of course, since we never move through a fourth spatial dimension.  But nonetheless, we are armed with all the information we need to figure out how gravity would look.

This time the ‘sphere’ we make around a point charge is in 4D, which is hard to draw, but we can figure out what it must be like with a simple pattern.  In 2D, the ‘surface’ of a sphere is a line.  In 3D, the ‘surface’ of a sphere is an area.  So in 4D the ‘surface’ of a sphere should be a volume.  Its units should be length cubed.  No surprise, then, that the surface ‘area’ of the 4D sphere is 2*PI^2*R^3.  Which means that the Force of Gravity must go as 1/R^3.  So we get orbits like this:


A 1/r^3 Force Law.  Yikes, I'd hate to be on *any* of those planets.

A 1/r^3 Force Law. Yikes, I’d hate to be on *any* of those planets.



You’ve now got everything you need to ponder the force of gravity in any number of dimensions.  And with the Gravity Simulator, you can check out what any of these worlds might look like.  Try to make a 5D solar system, I challenge you!

This was just a quick introduction to some interesting topics — so if you wanna know more, there are plenty of resources out there you can use.


Post a Comment

TestTube Lesson: ‘Seen’ Distances

Posted in: Physics Lessons, Velocity Raptor | May 19, 2013 | 2 Comments

I just got a great question about Special Relativity. (And I imagine this might kick off a series, so do ask any physics questions prompted by the games/point out cool physics you come across)

The Problem

A player (‘BARP’) commented on a previous post, wondering:


“In the seen view of VR, the room shrinks/gets closer behind the raptor. But light should take longer to reach the raptor from behind him, so the view behind the raptor should be stretched out.”


So what’s up?  A great question, and since it cuts to the core of the ‘Seen’ view (and requires some images) I thought I’d answer it in post form.  If you haven’t played Velocity Raptor yet, do that first.  This post will make a lot more sense once you reach level 25.

The basis for the ‘Seen’ view is that when you see something, the light from it didn’t reach your eyes instantly.  Light travels fast, sure, but it takes time to reach you.  So when you look at a star that’s many light-years away, you’re seeing it as it was many years ago.  In Velocity Raptor, with slower light, you notice this even with nearby objects.

The commenter makes a perfectly intuitive point.  If the light from an object takes longer to reach you, it would make sense that the object appears further away.  The light from the moon takes longer to reach you than the light from your computer monitor, and it certainly appears further away.  When you (as Velocity Raptor) are running away from, say, the left hand wall, there’s some extra lag for the light to reach you (check out Level 26, and keep the Doppler shift firmly in mind).  So shouldn’t the wall appear further away?  And yet on the screen, it appears much closer to you.


On the left, the raptor standing still. On the right, the raptor running to the right.

On the left, the raptor standing still. On the right, the raptor running to the right.


Why that doesn’t happen

It turns out that how far away an object appears to be doesn’t depend at all on how long the photons have been traveling towards you.  Truly, your eyes can’t detect the ‘age’ of a photon.  All your eyes detect are things like the color, and the angle the light is coming from.  It’s that second one that tells our brain how big an object appears…


What’s really going on

You can think of your eye like a pinhole camera.  Light rays from an object come in and get projected on the back wall (aka your retina).  The closer — or bigger — an object is, the bigger the image on your retina.


The further the blue bar, the smaller the image cast on the retina.

The further the blue bar, the smaller the image cast on the retina.


When the raptor is running away from the wall, the eyeball is now moving away from the incoming light.  That means the light that enters the eye has to travel further before it reaches the retina.


A stationary eye at the top, and a moving one on the bottom.

A stationary eye at the top, and a moving one on the bottom.


In the bottom image, the dotted-line box shows where the camera was when the light passed through the pinhole.  The solid box shows where the camera is when the light finally hits the retina.  It keeps the same angle of attack the whole time, but has longer to spread out, and makes a bigger image on the retina.  Thus, the wall appears bigger.  (Keep in mind that we should take length contraction into account… but that ends up being a second order issue.  The effect I’ve described exists with or without length contraction.)  This explanation, by the way, relies heavily on the great site, which you should definitely check out if you want to learn more.


Now in 3D!

The question remains… does that mean the wall is closer, or does it mean the wall is bigger?  If Velocity Raptor were from a first-person perspective (like A Slower Speed of Light), it wouldn’t make a big difference.  In such a game you don’t see the distance of objects.  An object could be small, or it could be far away.  But with the bird’s-eye-perspective in Velocity Raptor, the distance needs to be drawn right on the screen.

It turns out the wall appears closer, instead of bigger.  You can think about the true path of an object… if it is traveling in a straight line, you should always see it at some point along that path.  Imagine standing on train tracks and watching the train race away from you.  Should it appear bigger (wider and taller) than it is, or closer than it is?  If it appeared wider, then the train would no longer seem to fit on the tracks.  The wheels would be spaced to far apart.  But the contact point of the wheel and the newly-run-over track must appear to be at the same place.  The photons, after all, are emerging from the same location.  Thus, the train cannot seem wider, and must seem closer.

So, excellent question, BARP, I hope this helps explain the ‘Seen’ view just a bit.  Lingering questions/qualms with this explanation?  Ask away in the comments below.


Post a Comment

Wednesday Update #2

Posted in: Wednesday Update | December 5, 2012 | 2 Comments

Another full week!

I had a very pleasant surprise this past weekend when I discovered a new review of Agent Higgs.  You can read it here.  The final verdict: “Buy it.”  Heck yeah!

As for my upcoming games, I mentioned last week that I’m putting the quantum game on hold.  So this week I focused mainly on two other games/simulations.



First up, the electromagnetism game.  And there all that quantum work came in quite handy.  In fact, I was able to transform what existed of the quantum game (a standard 2D platformer) pretty quickly to prototype some levels.  The basic idea is that your character (and his/her bullets) are electrically charged.  Of course, this means they attract and repel to certain objects.  But they are also affected by magnetic fields.  And it isn’t at all like the basic notion of magnets that gets used all the time in games (yes, magnets can attract and repel, we get it).  Instead, a moving charge will curve in the field.

I’m looking forward to making some fun levels that make good use of those curving paths.  As I mentioned, right now it is a 2D platformer… but I’m bouncing some other ideas around.  Heck, imagine the strange complexities these extra forces would introduce into a game like Cut the Rope.  Or even your run-of-the-mill space shooter!  Or EVEN — ah, sorry.  I get carried away sometimes.



Mostly, though, I was working on the evolution simulator.  How does it simulate evolution, you ask?  Mutation and Selection.  You start with a very basic creature (imagine sticks attached to each other with motors).  It can move, but not well.  Then it has 6 offspring.  They are similar to the parent, but have very slight mutations in their bodies and behaviors.  The siblings compete in a high-stakes footrace.  The losers are all… sent to a farm somewhere.  The winner, though, makes 6 new offspring.  Mutation and Selection.

It is shaping up nicely.  Just today I was working on the graphics.


Run!  Run!

Creature 4 seems to have found a shiny object back there


Aside from the simulation side of it, I’ve been thinking of ways to make it a bit more of a game.  So I’m adding in an extra competitive mode. After all, you tenderly create these creatures over hundreds of generations.  They need to make it out into the real world and interact with one another!   In this extra mode, you can challenge your friends, pitting your creatures against one another in an American-Gladiator style showdown.  Who can evolve the better beast?  Well, in a few weeks, you’ll be able to find out!



Post a Comment