top of page
Search

[10] Lunar Lander WIP [5/9]

  • Writer: Conlan Walker
    Conlan Walker
  • Dec 2, 2021
  • 2 min read

Updated: Jan 3, 2022

This week, I proportioned my time in arguably irresponsible ways, such as scratching my head for two days on how to implement an optimized version of some algorithm before just taking the smooth-brain easy way of doing it in a single hour. That, paired with some more good old data entry makes for a pretty uneventful blog post, so here goes nothing.

To start, this is the thing that took two days for me to realize it wasn't worth making the optimized thing for:

ree

I realized this after I saw how little it impacted performance, despite being called 30/s (right now, physics are supposed to update 30/s, hence why it's that figure).

The reason this even took an hour to make is due in part to how the separator array works:

ree

Given that the simplest version of the range finder is just a for loop of continuous and linear comparisons, you can see why index 1 would put a slight wrench in the spokes of that. Though in reality, this hiccup only costed an extra event in the function, but it took me an hour to figure that out, which is why it didn't take 15 minutes like it should've.


Another thing I wanted to work on this week, is landing zones.

Originally I was going to make an object type, where I could edit the size and score modifier as instance vars, which would then be pinned to the Moon at various image points. I would then rotate those zones such that they would always be parallel with the Moon's surface.

This posed a problem, because I wanted to only start updating the zones' rotation values when they're about to appear on-screen. This would require another boring algorithm, and this isn't some under-the-hood feature I really would want to pour much time into. So right now I'm opting for a distance-based, rather than contact-based, landing scheme, where you land on a 'zone' by simply being within a certain range of it:

ree

On top of returning the closest image point with the actual distance of said point, I thought It would be trivial to fetch the given name of that image point given its index.

Apparently not, so I had to do that myself:

ree

The main problem with min_landing_zone is that it currently doesn't work, so I guess that headache will be something for next week me to solve.


That's it for this week.

 
 
 

Comments


bottom of page