ATOMIC SPACE NEWS #7: Smooth testing

FULL EDITING

At the end of last month’s update I talked about being very close to being able to go from editor to gameplay smoothly. That’s working now, which has led to some fun iteration. Before I’d done months of testing and development on a single level, and now I can whip a new one up in minutes. There’s a lot of bumps and bugs in it that I still have to work out, though. Working so long with a hard-coded level in a fixed unity scene led to code that is not structured well for loading and especially reloading.

BETTER LINE SMOOTHING

One change a long time coming that happened this month is line drawing. Previously, an object’s trajectory was drawn by simply getting a start and end time(ideally equal to one orbit in the simplest cases), then picking N points of time evenly spaced through it and getting the object’s position at those times. The problem is that an object only spends equal times at different parts of an orbit if it’s orbit is perfectly circular, if it’s highly elliptical you could run into cases where one end becomes visibly jagged even with high numbers of overall points.

 

An example of the old system breaking down.

The new system starts out making a set of points the same way as before, then refines the line further. At each initial point it takes the object’s velocity at that moment and extrapolates out an amount of time matching the time of the next point in the set. If the extrapolated and actual points are far enough apart it asks the simulation for another point at the time-midpoint halfway between the existing ones. I tried a few other smoothing methods, but right now this seems like the most reliable way to handle the particularly curly paths that can arise if you’re looking at the system relative to a moon.

PLAYTESTING

This month I did get to put the game in front of a couple friends and watched them come to grips with it. The state it’s in is rough enough that I wouldn’t want to throw it out to anyone that I can’t be there to guide, and that plus the fact that it was being tested by very good friends does mean that the opinions I got are far from perfectly objective, but I still learned a lot! I’ll list a few of the things I learned.

  • More parts of the racing interface are currently broken than I realized
  • People want the information those parts would provide without much prompting, so I really need to fix them!
  • The better line smoothing is still imperfect and needs more refinement.
  • If you don’t stop them, people will break the speed of light.
  • People really want to orbit the moon even if you don’t ask them to.
  • Orbiting the moon requires you to be a LOT closer than people expect.

It definitely gave me some useful information and ideas on what I should focus on next.

LAGRANGE POINTS

Something I’ve finally gotten around to testing this month is Lagrange points. If you’re unfamiliar, I’ll provide a quick overview of the idea. If you have one object of notable mass, like a planet, orbiting a larger object, like the sun, then in most cases a third object added to the system will not be able to keep a constant distance to both of them. It’s distance to either one or the other, if not both, will be constantly changing. However, at least if the orbit of the planet is relatively close to circular, there are five points where the forces can balance out such that an object can be placed there and keep a constant distance to both bodies. These are the Lagrange points. The first three are on a line with the two main objects, L1 between the two, L2 just outside the lesser object, and L3 on the far side of the larger object from the lesser. L4 and 5 sit on the same orbit as the lesser object, 60 degrees ahead and behind it.

Lagrange points are of some note because they’re commonly thought to be useful to a space-faring civilization, and they’re a feature that does not arise in some popular approximations such as the patched conics used by Kerbal Space Program. They should be something that naturally comes up in the simulation, and it hasn’t been urgent that I verify their presence, but with the editor working it’s become pretty trivial to check L3, 4, and 5, so I did.

 

In this example I made a Jupiter mass object at 1 AU in a circular orbit of a 1 solar mass object and then threw down a bunch of zero mass objects in the same orbit but offset a number of degrees, and named them according to the amount of offset. The A60 point thus corresponds with the L4 point and can be expected to be stable. The other objects don’t match any Lagrange points, so they shouldn’t be stable.

 

Then I wound the simulation forward 9 years. It might be a bit hard to see in the jumble, but relative to J the A60 is still in its place, while all the other ones have wandered around significantly. That’s what they’re supposed to do, so huge success!

Those are the high points for the last month. For the coming month, I need to focus on polish, and on organizing my internal documentation. The next post consequently might be a bit thin, but we’ll see! There tends to be more to talk about in these than I expect, so maybe I’ll be surprised.