Isotope Mine Bug, and More Course Plotting

Hey Folks! Bit of a split day today, as I worked on both mobile bugs and the space prototype.

The morning bug fix session focused on me catching-up on forum bug posts, and then tackling an encounter crash reported in the Isotope Mine. It seems if the encounter uses part of a stack of items, the game crashes with a null pointer.

The culprit, as I discovered, was that the encounter clean-up code was deleting the unused stack items along with the used ones. This was due to some bad recordkeeping as it started removing items from the stack, leaving the game thinking it was safe to delete them when it wasn't. Adding some extra code to check every item in the stack fixed the issue, which should fix maybe a handful of encounter screens in the game.

On the space prototype, I continued refining the flight computer course plots and execution, to get a bit closer to the target location and velocity.

One problem I ran into was that the ship would end up far away from the target planet, and sitting still. This was just a minor bug in the code that forgot to apply the velocity-matching thrust correctly (it was doing it half way, then undoing it the second half).

Fixing that resulted in an endpoint where the ship was moving roughly the right direction and speed, but was offset from the planet by a wide margin. This, too, was related to incorrect application of the velocity-matching. In this case, I wasn't accounting for how much the ship would be offset by this component of the thrust over the time of the trip.

The solution (so far, anyway) was to figure out how much error this velocity-matching component introduced during the trip, add the opposite of that to the desired destination point, and then re-plot the course.

The result? Much better agreement at the destination. I haven't yet added code to show me the distance from target apart from just the visual plot, but I did add a relative velocity output to the screen. And if my calculations are correct, it arrived with a relative velocity of about 6500km/h (roughly half to a third of the space shuttle's typical re-entry speed). Not bad for some napkin math and a multi-day burn from across the system!

Further refinement will be needed, but we're getting close to something I can leave as "good enough" while I move on to other game systems. Basically, I want to be able to roughly keep track of the ship traveling, know how long the trip takes, and then the crew sim knows how long until the next event happens (such as docking).


ascavone's picture

Hey Dan,

Is this the same space game that you were posting about a while back before the neo scavenger mobile? Hopefully - that looked really interesting!

dcfedor's picture

Indeed it is! This is just the course-plotting UI within that prototype. Similar to the On/off switch and battery meter UIs I was toying with.

Dan Fedor - Founder, Blue Bottle Games

ascavone's picture

Awesome, looking forward to it!