Orbit Plotting Faster, K-Leg Boneyard

Hey Folks! Hope everyone had a good weekend. We went to the zoo one day, and painted ceilings another. Plus we gorged ourselves on pho, which I think did wonders for our recouperation. Not a bad weekend at all!

Back at the office, I resumed working on local maneuvering via RCS. Early in the day, I actually stumbled across an optimization that made a pretty huge difference in the orbital plotter. While trying to fix off-screen projections for stations, I inadvertently made my off-screen culling better, and framerate shot through the roof. It appears to be truly bound by how much is on-screen now, so zooming-in to local space around a station gives me ~70fps! I actually thought I broke something when I saw that (and I still worry I might have.)

Once that was done, I added some code to further randomize derelict starting situations. Random orientation, angular velocity, and lateral velocity. This gives things a slightly less artificial look than "all ships pointed due north and 0 velocity."

From there, I started refining the code to make spawning ships around a specific target easier. And my first test is the K-Leg boneyard. This is ultimately what I'm trying to build, so our starting situation has ships to mine in a setting-appropriate way.

Today's screenshot shows progress so far. We've spawned a dozen or two ships in a 50km radius of K-Leg (transponder OKLG). Unfortunately, we have two problems.

First, OKLG gradually drifts away from the spawned derelicts. The derelicts are not attached to nor orbiting K-Leg, so they're just sitting there fixed in space, and will eventually (like, decades from now) get pulled into the Sun. K-Leg's gravity is so low I don't even think it would draw them in if it sat still right in their center.

Technically, I could give them a starting velocity that might result in an orbit around the sun that stays close to K-Leg. Or even one that orbits K-Leg very slowly. However, this would require a lot of precision and accuracy in my simulation, and especially with that many ships, it would probably be a waste of CPU.

Instead, I think I'll fake it by extending the docking system code to allow for ships to track an orbiting body at some fixed range. Its a step down from the way stations are done now. Stations follow predicted orbits around their parent object, while these will probably sit still. I could make each of these a station, but I think it'd both be expensive and unnoticed.

Anyway, once I do that, at least they'll stay in a reasonable range of K-Leg for players to explore and pilfer.

Secondly, we have a precision issue with their starting position. You'll notice all the ships are clumped together in the four corners of a square shape. I'm pretty sure there's a precision loss going on when the random starting position is chosen, and it's resulting in limited granularity in starting position.

In fact, another thing I added today might help: the "range" indicator at the top of the scope. It tells the user the radius of the scope in real-world units. I put this here to help users gauge how far things are from the center of the scope.

So in this case, it looks like those clusters are spaced about 25-33% of the scope's radius apart, or about 115-150km. Once I sort out the precision bug, they should appear in a nice ring shape.

Once those are behaving, I'm looking forward to spawning outside K-Leg with a fresh character, and trying to dock with one for some salvaging. Maybe even hop from one to another to cannibalize for parts?

Tags: Ostranauts


ra1's picture

I can understand the need for derelicts to be near the space station(s), because that is where many would come to die. However, they would neither orbit the station, nor would even a real-world system be able to keep them all in a perfect ring that orbits around the sun.

Consequently, I think you should start out with derelicts around the station -- but also many more placed farther away, and all drifting on slightly misaligned orbits. Over time, I would EXPECT drift, unless some force is actively propelling these derelicts back into position.

dcfedor's picture

I think that's sort of what's happening, and I probably just explained it poorly.

The "ring" of derelicts is mostly about putting a junkyard that stayed put near K-Leg, where ships are purposely decommed for scrapping sometime in the future. And given 1036-Ganymed's small mass, a lot of these are assumed to be kept "parked" artificially, not really orbiting. E.g. "Hulk IG-1882 looks like it's drifting a bit again, Bern, give 'er a nudge with the drone tug sometime today, would ya?"

More generally, derelicts are just randomly peppered around the system, assumed to have gotten there via some accident. Their course could be static, an orbit, or linear, and they just continue on until something changes that.

Dan Fedor - Founder, Blue Bottle Games