Friday, January 21, 2011

Time Dilation Program

The other day I was sitting in my Life in the Cosmos class, and "we" were having a "discussion" about the fact that light does not travel instantaneously from one point to another, and therefore the stars you see in the night sky actually appear as they existed some number of years ago, depending upon how distant they are.

I say "we" and "discussion," because what actually happened was that the professor mentioned the fact in passing, and then every single person in the class except for me proceeded to ask a question to the effect of "wait, did you say that we're seeing the star as it existed years ago?"

I'm exaggerating a little, but I was nonetheless extremely frustrated.

In any case, thinking about the concept of seeing things as they were rather than as they are got me thinking about whether such a phenomenon might be useful or interesting in video games. Braid plays around with time in a lot of ways that are very suggestive to me of quantum mechanics, and more importantly, in ways that are extremely effective as gameplay mechanics. But this is one particular phenomenon that we didn't see. At least, I'm not aware that we saw it.

In any case, before going to bed last night I sat down and spent a few hours writing a small simple simulation to test the idea. You can download it here. As far as I know, it will only run in Windows.

When you run the program, you will see a number of circles appear on the screen. With the cursor keys, you can move the green one around, and you will immediately notice that the other circles' movements are affected by the green one's position. In particular, the nearer the green circle is to them, the more current the solid circle's position appears to you (i.e. the more closely it overlaps the hollow circle that represents the circle's actual position). Furthermore, when nearer the green circle, the other circles become bluer and move more slowly, whereas when farther away, they become redder and move more quickly. This was kind of an afterthought that I added when I started thinking about gravitational time dilation and color shifting.

By pressing the S key, you can hide the hollow circles. By holding shift, you can double the speed of the green circle. 

And just to be clear, this post is not about a dream. However, after coding this, I went to bed and I did have a dream about coding it.

1 comment: