SpaceCraft: StarGen 0.1a

Posted By BOwen on April 26, 2012

It doesn’t look like much but finally I have something to show. I suppose a more experienced programmer would have a good chuckle at this relatively simple device but we all have to start somewhere don’t we? Everyone starts off as a “newbie” so let us bask in the glow of our “minor” accomplishments.

So what this is, is the beginning of SpaceCrafts universe generation. The main window right now is just a console display to give me feedback but later it will display detailed information on the major star types or well, that’s the plan currently.

Star Type data and generation odds are read in from an XML file so it will be player modable as I think I mentioned before. Most of the rest of the display is pretty self explanatory. I’m hoping a friend of mine will help me pretty this up a bit.

What the script is actually doing right now is randomly generating stars by mass rather than class. It then fudges the mass a bit and then calculates the star’s subtype. I decided to do it this way because the star’s mass can be used extensively in calculations and have the game look everything by star type turns out to be more combersome the more I think about what I want to do. So star type and subtype and by extention other features I haven’t worked on yet are all calculated by the star’s mass.

After that is figured out each star has a 1 in 10 chance of being randomly aged. (Approximately 90% of all stars are main sequence stars which is where I came up with 1/10 odds). As you can see from the screenshot the random aging produces a variety of results which are also based on the star type. A Class O star for example will eventually become a black hole while your typical G class will even up as a black dwarf etc.

The coordinate system right now is pretty basic. It finds a spot within a 100×100x10 space which I plan to also make configurable. Although personally I think a universe of 100,000 locations to fly around in is plenty big enough for most purposes. Well, ok technically it’s closer however many stars your have but that’s still not to be sneezed at.

It doesn’t save the data yet. I will hopefully get around to that in the next week or so. I’m becoming amazed at just how fast time flies when I’m doing something that seems so simple. Of course, thinking up a better way to do something you’ve already done doesn’t speed things along in the short term either. (It is worth the time investment though).

About the author

BOwen

Comments

Leave a Reply

Please note: Comment moderation is currently enabled so there will be a delay between when you post your comment and when it shows up. Patience is a virtue; there is no need to re-submit your comment.

You must be logged in to post a comment.