Monday, May 3, 2010

Hole extraction

I've returned to work on my lunar lander program by spending some time on the planet generation code. It now collects closed polygons and then throws out any that have negative area, so there are no longer any inaccessible interior regions:

I lost a fair amount of code in doing this. There is no longer a BSP representation; I'll need to do that in a different way if I end up needing it. There's also not a triangulation yet either, but I have code lying around that I should be able to plug in for that.

The current top priority is coming up with landing targets. I've been trying to think of a good way to identify accessible landing targets on a random terrain like this. Ideally it would be able to find "interesting" places to land.

Andy Korth said...

The planet is looking really good! It definitely looks like something I'd want to fly around and interact with. The closer the landing pad to the center of the planet, the more interesting stuff you'd have to fly through to land, so raycasting from the center outwards could work to find some good points.

I could see the game working well as instructing the player to fly all the way around the planet and landing on each of the 12 or so landing pads as they loop around. Then maybe it's not to important where the pads are, since you're moving around the planet anyway. A mix of high and low pads would seem to work well.

Regarding the accessibility of landing points.. Now that you've removed the closed off caves, are many of those spots too small to feasibly get into? I guess I see a couple that might look tight, but I'm not sure how big the ship is. Pulling in the surface by the ship's radius might be an easy solution to make sure everything is accessible.

James McNeill said...

Good ideas!

I think I may try doing something along the lines of what you're suggesting: expand the planet by the rocket radius, look for self intersections and trim away newly-created interior regions, then run around the remaining surface and evaluate suitability for landing.

The simplest suitability criterion would be to estimate the local slope and curvature; if both are low it's a decent landing spot. Additionally I could cast rays from each candidate spot to estimate its "ambient occlusion"; how much of the sky is visible from it. That might be a good proxy for its challenge level.