## Gravity Simulator on Greenlight

Posted in: Gravity Simulator | December 8, 2016 | No Comments

After last week’s successful launch of The Electric Shocktopus (woo – it’s really out!), I’m wasting no time in getting my next game up there.

Gravity Simulator has always been a mainstay on this website – no matter what else I make, this project seems to dwarf the others in terms of traffic, eyeballs, engagement, and bug reports. So let’s see what happens when we get this one in front of Steam!

First thing’s first, we’ve got to get this thing through Steam Greenlight:

Greenlight, for the uninitiated, is a system where people vote for whether or not games should get up on Steam. Think Kickstarter, but where people just donate a vote instead of money. Which is a horrible analogy. (What next: “Twitter is like a cookbook where the recipes are people, and the ingredients are tweets.”)

Annnnyyyyway, keep your eye on this space for GSim hopefully following in Shocktopus’s tentaclesteps and making it way up on Steam soon.

*-Andy*

## The State of Things

Posted in: @Evolving_Art, Electric Shocktopus, General News, Gravity Simulator | October 18, 2016 | No Comments

Hello! It’s a beautiful fall out in Boston, little Max is walking and talking, and I figure we’re long overdue for a report on the latest hap’s at TestTubeGames. Let’s go!

**Gravity Simulator is on the move!**

After making all sorts of updates to the Gravity Simulator – which you can read about here – I decided it was *finally* time to post the web version on a site other than my own. So I brought it over to Newgrounds, excited to get some fresh eyes looking at the sim. And I was not disappointed, the game made it to the front page, and has been played more than 20k times. I’ve gotten some really helpful comments from people, and hope that we might see some creations from them in the forums.

I’ll be posting the simulator to other games portals now that I’ve shaken out a few new bugs, though am contemplating posting it on Steam Greenlight, too. Which brings me to…

**The Electric Shocktopus is coming to Steam!**

After sitting around in Greenlight purgatory for a while, The Electric Shocktopus made it through, and is going to be up on Steam soon! (I’ll be announcing the release date shortly.) I’ve been spending a bunch of time trying to learn all the ins and outs of Steam – and feel a bit like an out-of-touch person trying to understand what the kids are into these days WHICH I AM CERTAINLY NOT. Trading cards, badges, achievements, all sorts of bells and whistles to connect in to the game. So there’s a fair amount of research and work on my plate to prepare for the Steam release. (I’ll remind you that TES is already out, and you can download it, as always, here.) And speaking of storefronts…

**Upcoming release on TeacherGaming Store!**

I’ve been working with TeacherGaming, a teacher-facing games website, to get my projects posted on their site. The site is run by the fine folks that brought the world Minecraft EDU, among other educational projects. They are building a site that gets games into the hands of teachers, and provides them with some lesson plans connected to the game, to boot. They’ll be selling both The Electric Shocktopus and Gravity Simulator, with a release date within the next couple weeks.

**Our Site Revamped**

I went through, this past week, and cleaned up the TestTubeGames website, which, having grown organically, had some weeds in it. New fonts, new images, an updated footer, and fresh images for sharing to Facebook. (The default images that would pop up before when you shared a link were… not good.) I’m pretty pleased with how much fresher the site looks — and, as luck would have it — it got a test drive its first day out, when someone shared Velocity Raptor on reddit. Let’s put those new share-images to work!

**Little Entropy Project**

I worked on a fun little project recently, based on a puzzle posted over at Quanta Magazine. (A great site to check out for in-depth science news.) In their puzzle column, Pradeep Mutalik described a simple model of a universe, with finite states, and challenged the readers to answer some statistics questions about the entropy and evolution of such a world. Entropy is one of those topics I’ve been batting around, never really finding a great idea for, so I figured I’d go ahead and build a simulation of the world they described. You can read the puzzle here, and test out the model universe here.

**@Evolving_Art on hiatus**

I didn’t end up getting enough people interested in the art simulation on Twitter, so I’ve put it on the back burner for now. I might change it a bit and bring it to a web portal like Newgrounds — since, after all, the project only really works if we’ve got a lot of people contributing their opinions. But, with all that I’ve got on my plate (as well as a bit of contract work here and there), this won’t be happening anytime soon.

So, there you go, that’s what’s been keeping me busy lately. And kudos to you for making it through that uncharacteristically long post! As a reward, go play Quantum Marble Maze – a rad game by Crispin Cooper.

-Andy

Post a Comment## GSim Image of the Day

Posted in: Gravity Simulator | December 7, 2015 | No Comments

I’ve been enjoying the semi-regular Feel Bad Friday videos – so along those same lines, I’m going to be posting daily Gravity Simulator images. My goal: each day posting screenshot or gif of some interesting/wacky/pretty astronomical phenomenon.

Keep your eyes peeled on Twitter to see them. Here’s one to get us started:

Simple… and nothing big. But there is some neat stuff to be made here, and this will encourage me to keep playing around with the simulator. And when the time comes that I can do an update to it, I’ll have a *whole* bunch more ideas since I’ve been dabbling the whole time.

-Andy

Post a Comment## Too Many Asteroids?

Posted in: Gravity Simulator | December 4, 2014 | No Comments

I posit: there is in fact no such thing as too many asteroids. At least, if we’re talking about the virtual ones in the Gravity Simulator. I like to stay far away from them in the real world.

I’ve been working on the Gravity Simulator more, adding in features / fixing bugs for version 0.30.02 — which is coming shortly to computers near you! But along the way, I’ve been ~~getting distracted~~ … erm… doing research making some pretty, silly, and pretty silly orbits. Thought I’d share some of the latest. Most were created thanks to the new auto-fire feature, that let me draw *a lot* of stuff really quick. Because more is better.

**Ring of Asteroids**

More than a wee disturbance in the force, I’d say. That ring is made up of about 300 individual asteroids, so many that it looks solid. But as you can see, it’s clearly not. As you watch the video, notice which asteroids the planet flings away from the star, and which get pulled closer in. Why?

For a more, erm, patriotic version of this, let’s remove the star and planet entirely:

Kind of like the big bounce — everything coming together, but just missing the center.

Now how about if we get that ring moving…

We are well on our way to screensaver material, here, folks! A lot of asteroids of course means a lot of lines.

If, instead of putting down tons of asteroids, I instead add tons of planets (right on top of one another) — we get this:

Those yellow planets are all orbiting around one another very closely, while orbiting that distant yellow star. Since forces increase significantly as two planets get closer, having them all on top of one another requires a lot of accuracy — though I’m happy to see that the sim is cut out for the task.

You, too, will be able to play with the auto-fire soon. Pop over to the forums to keep an eye on the progress, or to get an advanced copy. Otherwise, it’ll be posted on Humble Bundle soon.

*-Andy*

## Tour de Force – (part 1)

Posted in: Gravity Simulator, Lesson Time! | June 21, 2014 | 1 Comment

Another week — another Gravity Simulator Lesson! This week: what happens when you change the laws of gravity? In the past, I’ve touched on this topic a bit, but this time we’re really gonna dive in.

**The Baseline****: 1/r^2**

Ah yes, Newtonian gravity. The perfect place to start. This is gravity as we know it in our universe (ignoring pesky things like general relativity for the moment). With the “one-over-r-squared” law, gravity decreases inversely as the square of the distance between the two objects.

That’s a mouthful, but really it’s quite simple: If we get twice as far away from the center of the earth, it’ll pull on us with one quarter of the force it does now. If we triple the distance, gravity will pull just one-ninth as hard.

And with this wonderful, happy force law, we get orbits that look like this:

(As usual, all the gifs you’ll see today are taken right from the Gravity Simulator. Feel free to play around, yourself!)

**Experiment 1: 1/r^2.1**

In the Gravity Simulator, we can do something you can’t do in the real world: we can change the force of gravity and see what happens! So let’s increase that exponent over ‘r’. So now the force goes as “one-over-r-to-the-2.1.” Doesn’t quite roll off the tongue as easy, eh?

Well, let’s see what happens:

Huh, the orbits no longer match up. That’s called precession — basically the planet is *nearly* making an ellipse as it goes around the star, but not quite. The path keeps twisting around and around. Turns out 1/r^2 is special — very few force laws will make orbits that don’t precess.

Why does making it 2.1 instead of 2 change things? Well, ‘r’ is raised to a slightly higher power, which means as two planets get further away, the force of gravity **drops off faster** than it would in our world. And as they get closer, the force of gravity **increases faster**, too!

So when the planet comes in close, gravity pulls on it stronger (than in our universe at least), deflecting its path even more, which gives it a tighter curve. That tighter curve when it’s close to the star means that the planet swings around faster than we’d expect. So by the time it comes back out to its furthest distance again, it’s gone **more** than 360 degrees. Matches with what we see above. (Go, science!)

**Experiment 2: 1/r^3**

Let’s keep going! Let’s raise ‘r’ to an even higher power! We should expect even stronger precession, right? Well, let’s see:

Huh, now we’re getting something different. When an object gets close, gravity starts pulling so strongly that the planet just spirals inward until it collides. And if the object is too far away, it spirals **outward**… and since gravity gets a lot weaker the further out you go, it keeps spiraling out more and more, never to return.

**Experiment 3: 1/r^10**

What if we went really crazy with this? (*I always go really crazy with this.*) Let’s try a force law that decreases extremely fast. 1/r^10!!!! (Excitement, there, not factorials) Now if two objects get twice as far apart, the force between them is about 1000 times smaller! That makes for this weird world:

Objects really don’t notice each other in that weird universe, they mostly travel in straight lines… at least until they get juuuust close enough to the star. And once they do, they’re pulled quickly and without remorse into a collision. Boy, I’m glad we don’t live there! You can imagine how hard it would be to create galaxies in that universe, let along solar systems with stable orbits.

Tune in next week when we take things the other way… what happens for 1/r^1.9? Or 1/r? In the meantime, play around with your own force laws in the Simulator!

*-Andy*

## Black Hole or Bust

Posted in: Gravity Simulator, Lesson Time! | June 14, 2014 | No Comments

Last week I reported on General Relativity in the Gravity Simulator. And now that relativity is in place — this means the sim can have BLACK HOLES! YEAAAAA!

**Black Holes**

How hard could it be to add in black holes, right?

We all know that black holes are extremely massive, extremely dense objects. (Mostly.) Get close enough to them, and gravity pulls so strong, that not even light can escape. Whoa! So we just need to make a big star in the Gravity Simulator — and we get a black hole!

Well, no. You’ll never get a black hole if you’re dealing with boring, old Newtonian gravity, though. In the old simulator, say, you could make a star bigger and bigger and bigger, and all you’d get is a bigger star. Any astroid or planet or star can escape its pull, so long as it’s moving fast enough.

**Event Horizon**

Around black holes, there’s a line of no return called the Event Horizon. If you’re outside of this boundary — you could escape the black hole. But the moment you cross it, you’re sunk. You’ll get swept ever further into the black hole.

This happens because General Relativity contains our old friend Special Relativity. And, if you’ll recall, a key part of Special Relativity is that nothing can travel faster than light. The speed of light is the speed limit for everything. The Event Horizon represents the line near enough to the black hole where, if you wanted to escape, you’d have to travel at light speed. Fall in a bit closer, and gravity gets a bit stronger, and you’d need to go even faster than light to escape. No can do. You’re stuck.

In the pictures above, I draw where the Event Horizon would be on each the star. The smaller the star is, the weaker the gravity it, and the closer you’d have to get to reach the Horizon. In fact, most of the time, you’d actually have to go deep inside the star to find this line. Which means, it isn’t *really* an Event Horizon. The calculations I used to draw these assumed that all the mass of the star is **inside** the Horizon. As you can see above, that’s not the case. The stars aren’t dense enough, which means: no Event Horizon and no black hole.

But if we get enough mass in place, the Horizon grows big enough that it swallows up the whole star — and we finally get our black holes! Now let’s have some fun with them!

Black Holes have tons of neat properties, which you’ll all be able to check out in the next update to the Gravity Simulator. Stay tuned for more General Relativistic fun!

*-Andy*

## Relativistic Gravity

Posted in: Gravity Simulator, Lesson Time! | June 4, 2014 | No Comments

Thought I’d keep you all apprised of the latest addition I’m working on:

**RELATIVITY IN THE GRAVITY SIMULATOR.**

At least, *mostly* relativity. You see, we’d talked about adding in Black Holes… which would be awesome. But not just *nom*nom*nom* generic sci-fi ‘sucks-stuff-in’ Black Holes. This is TestTubeGames, after all. So I wanted to *at least* get stuff approximately right. Maybe so ‘orbits’ become something like this:

A while back, in an earlier chat in the forums, we found a General Relativistic formula for the attraction between two objects. Seems reasonable that we could plug in that force law (after all, we’ve got change-able force laws already). It won’t be precisely right (there won’t be gravity waves…), but it’ll get us close.

Simple, then, slap on a GR Force Law and call it a day! Well, nope. Because Black Holes have this neat feature where once something gets too close — ~~inside the event horizon ~~ — it’ll *never* come back out. Mwahahaha.

Never, that is, unless it travels faster than light. Which, in the real world (as far as we know) nothing does. But in the Gravity Simulator, you can launch stuff at any speed! Black Holes would lose all meaning, objects could escape at will. They’d become just ‘really strong stars’ instead of ‘points of no return.’ Boo, hiss.

That means I need to add **more** relativity in the sim, to make objects obey the speed limit of light. Now when something accelerates, it can get close to, but never reach the speed of light. And, lo and behold, we get neat orbits like this:

Great. Can we just paint that star black and stop there?

**NO!**

Because once you have objects traveling near the speed of light, well, then E=mc^2 becomes important. Namely, mass is energy, energy is mass. So what? So EVERYTHING. Imagine two stars colliding. They rush inwards to meet one another, then *boom* they combine to form a single, stationary star.

The total energy has to remain the same, which means that Kinetic Energy had to go somewhere. In our sim, there’s only one place that energy can go: into rest mass. Just as two subatomic particles can combine to form something massive (wee protons crashing into each other to make the Higgs boson, anyone?), two stars can combine to make one *huge* star.

What other parts of relativity will come into play down the line? Well, the Schwartzschild radius is important. And relativistically slowed clocks are awesomely fun…

Where does this all end? With a bang? With a whimper? Will the simulation collapse into a singularity under all the weight of the new code? Stay tuned to find out!

*-Andy*

## Negative Mass

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

This week, I want to talk about negative mass. Wait… negative mass? Like antimatter?

*No.*

Antimatter, in spite of its ‘anti’ name, still has a positive mass. An electron and an antielectron (positron) have opposite charge, but they have the same mass. Charge flips to negative, mass stays the same.

If antimatter is out of the picture — what in the world *does* have negative mass? Well, nothing really that we know of. It would take a very strange, exotic form of matter to have negative mass. The closest we come is with the complex Casimir Effect. But let’s imagine that a chunk of negative mass does exist. What do we know about it?

First off, negative masses would have… negative energies. When an object is moving, it has a kinetic energy equal to 1/2*m*v^2. If the mass is negative, the kinetic energy is negative. Even when you look at E = mc^2, the rest energy of matter, you’d find that the negative mass would lead to negative energy here, too!

Strange stuff. The faster it goes, the less energy it has. The more you have of it, the less energy you’ve got.

**Gravity Time!**

What would a negative mass mean for gravity? Well, we can check this out in the Gravity Simulator. Two planets with positive mass will, of course, attract.

This is because the force between them is:

Where m and M represent their masses. Positive masses mean a positive force, which in this case means the objects pull towards each other.

What about negative masses? Suppose we had two planets with negative mass.

Looking at the equation above, if we change m to -m and M to -M… the equation doesn’t change at all! (Negative*Negative = Positive!) So they should attract as before, right?

**Wrong!**

There’s an extra bit of the puzzle we’ve left out. The force hasn’t changed, but the acceleration has. To figure out how something will move, we use F=ma. The force is equal to the mass times acceleration. Even if the force hasn’t changed in our example… if the sign of the mass has flipped, the sign of the acceleration has to flip. So instead of the pulling force making the planets accelerate together… they accelerate apart.

With all that in mind, the final puzzle is: what happens when you have a positive mass and a negative mass. Will they attract? Will they repel?

The test is easy to do (Note, you can do all these tests and MORE in the Gravity Simulator):

…whoa. Why did that happen?*You’ve now got enough information to figure that one out.*

As a final note, it would seem that having two planets suddenly zoom off the screen, ever faster, would violate Conservation of Momentum, or Conservation of Energy. But in fact, it doesn’t. As the positive mass gains positive kinetic energy, the negative mass gains **negative **kinetic energy. They cancel out.

Same with the momentum. Both planets may start moving in the same direction in that gif above, but the planet with *negative* mass has its momentum moving to the *right*. (Momentum = m*v, so flipping the sign of the mass flips the direction of the momentum). So even with strange negative masses around, conservation laws stay intact.

Will we ever really encounter a chunk of negative mass? Who can say. But at least we can make some good predictions about how we’d expect it to behave.

*-Andy*

## 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.

**3D**

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.

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.

**2D**

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:

**4D**

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:

**Beyond**

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.

*-Andy*

## Gravity Simulator Updates

Posted in: Gravity Simulator | May 2, 2014 | No Comments

The gravity simulator has been undergoing a steady string of updates since I released the new version last month. And I’ve been slowly but surely checking things off the to-do list.

**The Latest Additions:**

- -Set the orbit trails to the length you want, they aren’t always infinite, now
- -Snap the planets to the grid, for some easy symmetry
- -You can now fling the ‘fixed’ stars… they still won’t be affected by gravity
- -Edit planets on the move — change their mass, speed, position…
- -Set the density of an object to whatever you like
- -Pick whatever force law you like. The force goes as tan(r)? Sure! Or maybe r^ln(pi*r)? Uh, that’s fine too!
- A bunch more… naturally. Check out the forums to learn more!

Also, keep your eyes peeled for some YouTube videos of the simulator in action. But hey, why not just go grab the simulator, yourself? Get playing today!

*-Andy*