Planets and Moons Part 1


Now that the database for the solar system is complete, I started to work on the planet interpreter, sadly, I did not document that entire process since I was pretty excited to make it work. While doing that it also came to mind the process of actually starting the game, how to integrate the ship construction into the player creation and setting a spawn point for the player. So, as a way to test the planet interpreter in a secluded manner and having it be a valid way to set a spawn point during gameplay, I created a little solar system map:

In the final game, you may only select planets and moons with a surface base, but right now for debugging reasons, I can select any planet. To make up for the fact that I did not document the planet interpreter, I will include the moon generation in this post.

To generate a celestial body the game spawns a prefab node with a baricenter node and a CSGSphere. the baricenter node will act as the orbit center which will rotate in the Y axis. The body itself being represented by the CSGSphere. The scripts will retrieve the data from the database (Planets and Moons tables) and the data will be applied to the Sphere, be it a planet or moon.

In the previous screenshot you may see the planet creation subroutine, it retrieves the data from the planets table using the planet index number. This only applies to planets and has the moon spawning subroutine. The moon spawner subroutine is practically a copy of this routine, the difference being in the table being queried.

The moons, of course, instead of orbiting the sun, orbit their parent objects, in that last screenshot I figured the moons were a little on the big side and their orbits were way too high, nothing a little magic numbers on the interpreter cant fix.

Now that the moons are orbiting in the solar system map, we can apply this same coding to the local map on a bigger scale.

Had a little issue with the texture on the moon there but oh well.

The planets themselves at this moment don't really have any collisions nor the atmospheres have any real effect on the flying, but that's a feature I'm planning to do in the future, atmospheric drag, reentry heating, landing/crashing are things I'm very excited to add. Though the next thing I'll keep an eye out for is combat.

Leave a comment

Log in with itch.io to leave a comment.