Monday, April 23, 2012

System Generator - Iteration Two

First, a video:



That was created by the second iteration of the solar system generator.  I finished it this morning and spent the rest of the day flying around different systems until I realized it would be a cool idea to make a video.

The first "iteration" of the generator just placed an earth-sized planet and moon in each planet slot.

The first real iteration was basically me throwing code at the engine and seeing what stuck.  I developed some basics ideas for how the generator would work.  I refined those a little bit, but the thing was still a hulking mess by the time I called it "done".

For this iteration I went back to square two.  Using the strategies I had developed last time I rewrote the entire class.  The methods were cleaned up, things were reorganized, data structured were expanded, cake was had.

A lot of the stuff that changed in this iteration was simple number tweaking and reorganization.  The coolest thing though was planetary motion.  Planets and moons now have realistic orbital periods.  In the video, you can see the white circles representing each planet's orbit.  Unfortunately all orbits are circular at the moment, but perhaps in the future I'll expand them to ellipses.  Afterall, how hard can that be?

One of the things I'm not quite happy with is the moons.  Their orbits look great, but it's their size I'm concerned about.  If you look at the information scrolling on the left, you'll notice that most of the moons are around the same size.  I'm definitely planning on adding some more variety there in the future.

The System

There are two major parts to the procedural galaxy.  The first is the galaxy generator, which is run once at the beginning of the game.  It initializes the database and fills it with as many star systems as you want.  But these systems aren't complete yet.  When each star is created, the generator chooses a fraction of their mass to be left in the protoplanetary disk to form planets.  It also holds an integer entry for the number of planets in the system.

Those star system entries sit in the table until the player visits one.  At that point, the incomplete entry is handed off to the system generator which finishes the job.  The system generator takes the mass left for the planets and smears it out across a disk, and then integrates that mass function in concentric rings to form planets.

Next Iteration

I'm going to be taking a break from this for a while (not too long, probably a week or two) so I can work on other stuff.  Here's roughly what I'm hoping to accomplish next time:

- Moon Variety
     As mentioned above, moon sizes are a little too consistent.

- Wormhole Bridges
     These will serve as the main form of transport between solar systems.  There's a lot of interesting stuff I want to talk about with these, so I'll save it for another post.

- Other System Types
     Right now the system generator only creates planetary systems.  Eventually (hopefully next iteration) I'm hoping to expand it to the other two types of systems in the database: barren and debris.  More on those later.

- Rings
      Rings were removed since the last iteration because they were just randomly put in there.  In the future I'll be looking at a more realistic way of creating them.

- Planetary Characteristics
     Each planet data structure has three float parameters and three integer parameters as unused placeholders (easily expandable if I need more).  This is the least important of the things I want to get done, so I might not even get to it.

2 comments:

sterling baldwin said...

"It also holds an integer entry for the number of planets in the system."

I dont know if this is even something worth adding, but a solar system isnt just planets, there are asteroid belts and things like the Ort cloud. Maybe you could do the division as a float, and then distribute the fraction into one or more rock clouds. Asteroid belts are after all failed planets.

The same is true of rings around planets, instead of having integer moons only, why not take some fraction of that mass and distribute it in a ring? On the other hand, particle effects can be a pain in the butt, so this whole idea might be way to much effort.

Schiavo said...

I do have plans to add things like that in the future, once I decide on the best method to actually represent them in the scene graph.

I'm probably going to do rings as a textured triangle strip, which will render tiny rock voxels when you're very close to it. Rendering them as particles would be pretty inefficient.

The way I'm thinking of generating the rings is building all the moons, and testing if any are within their roche limit. If they are, they'll become rings instead.

Post a Comment