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?