Jump to content

Generation


DoctorCruz

Recommended Posts

So I was practicing my Python skills this morning and I hit upon the idea to make a script to generate a Galaxy. It picks a random number of star systems and then picks a random number of planets in each one. It turned out to be fairly interesting. The (very) simple script I built generates 1 whole galaxy of stars and planets, then writes them to a .txt file. Look at some stats:

Starting Generation.....
This Galaxy has 412674 stars
This Galaxy has 1238040 planets
Generation took: 6.60699987411 seconds

This is an example of the output file (which tends to have a size of ~100 MB):

This star system has a Red Dwarf at its center
It is called the Eeloosum System
It has 0 planets

This star system has a Yello Dwarf at its center
It is called the Leohun System
It has 6 planets
....Planet 0 is a Gas Giant Planet
....Planet 1 is a Rocky Desert Planet
....Planet 2 is a Icy Tundra Planet
....Planet 3 is a Tropical Rainforest Planet
....Planet 4 is a Water Planet
....Planet 5 is a Icy Tundra Planet

This star system has a Red Dwarf at its center
It is called the Gammepic System
It has 4 planets
....Planet 0 is a Gas Giant Planet
....Planet 1 is a Gas Giant Planet
....Planet 2 is a Gas Giant Planet
....Planet 3 is a Icy Tundra Planet

This star system has a Blue Giant at its center
It is called the Sosaoogla System
It has 4 planets
....Planet 0 is a Icy Tundra Planet
....Planet 1 is a Water Planet
....Planet 2 is a Gas Giant Planet
....Planet 3 is a Icy Tundra Planet

This star system has a Red Giant at its center
It is called the Sumdim System
It has 4 planets
....Planet 0 is a Gas Giant Planet
....Planet 1 is a Rocky Desert Planet
....Planet 2 is a Rocky Desert Planet
....Planet 3 is a Rocky Desert Planet

I'm thinking of adding something to make it more realistic. Perhaps an orbit statistic and then calculate average temperature and such from proximity to star. That would require me to also simulate the stars size and overall mass. What do you guys think I should add?

Link to comment
Share on other sites

Spectral class of the star (OBAFGKMLT). And luminosity too, I guess.

All these calculations will really wreak havoc on the time to generate. It is already taking 6+ seconds for 400,000+ stars, so with the star calculations and planet orbit and size calculations, I'm probably looking at around 45 seconds.

Link to comment
Share on other sites

All these calculations will really wreak havoc on the time to generate. It is already taking 6+ seconds for 400,000+ stars, so with the star calculations and planet orbit and size calculations, I'm probably looking at around 45 seconds.

So add in a ton of cool stuff, start the thing running, go eat a sandwich and watch some GoT, come back when it's done, ???, profit.

Link to comment
Share on other sites

So add in a ton of cool stuff, start the thing running, go eat a sandwich and watch some GoT, come back when it's done, ???, profit.

Or maybe I could start, go play some KSP, come back when its done. I'm going to work on this. Habitability criteria also might be something cool to do.

Link to comment
Share on other sites

What application do you have for the generator? Just how often are you planning to generate a galaxy that a few seconds matter?

You know, its something that I do more often than you might think :P. I think I should start with a Mv calculation. That'll help me classify the stars. Then mass, then temperature. Is that somewhat realistic?

Edited by DoctorCruz
Link to comment
Share on other sites

Idea: Instead of generating the data, set it up to be procedurally generated. Why generate 100,000 stars when you're only going to look at a handful of them?

Good idea. I really don't need to generate 900000+ stars. It performs super well at around 100000

Link to comment
Share on other sites

I was going to suggest applying the Drake equation to it, but I don't think you will have enough stars to get a positive result, unless you do a special one with many more stars and let it run over night.

Link to comment
Share on other sites

I was going to suggest applying the Drake equation to it, but I don't think you will have enough stars to get a positive result, unless you do a special one with many more stars and let it run over night.

That's a good idea, if you're looking to populate it with life, too. You can fiddle the numbers in the equation to get a positive result, most of them are guestimates anyway. And I would leave out L and Fc, too.

Wiki article if you haven't seen it.

Link to comment
Share on other sites

Is it already procedural?

If not, make it procedural.

Also, add a graph that gives you positions of the stars (galaxy center being (0,0))

The positions of the stars could be procedural.

And also a type of galaxy.

And, this is a long shot, but constellations and star positions from the center (POV in all directions, using mouse)

Edited by KASASpace
Link to comment
Share on other sites

It has to be procedural, it only takes six seconds to generate thousands of star systems. Fairly sure it's not being done by hand.

Well, it could be something else. I mean, there is more than one way to generate pseudo random values.

Link to comment
Share on other sites

It has to be procedural, it only takes six seconds to generate thousands of star systems. Fairly sure it's not being done by hand.

No not like that. I mean like how Minecraft is procedural. The world is millions of KM square, and every single x/y location is predetermined, but if you asked a computer to actually generate the whole thing the CPU would melt if the hard drive didn't fill up first.

I was suggesting he not actually generate the stars, but instead define them based on a seed value (say, their x/y/z location in the galaxy) so they don't get generated until you actually look at them.

Link to comment
Share on other sites

No not like that. I mean like how Minecraft is procedural. The world is millions of KM square, and every single x/y location is predetermined, but if you asked a computer to actually generate the whole thing the CPU would melt if the hard drive didn't fill up first.

I was suggesting he not actually generate the stars, but instead define them based on a seed value (say, their x/y/z location in the galaxy) so they don't get generated until you actually look at them.

Yes, that is what I mean when I say "procedural"

A seed that generates a set of numbers that only represent properties of the object and location. Or anything really. In "Elite" they got entire text lines from procedural generation.

Link to comment
Share on other sites

No not like that. I mean like how Minecraft is procedural. The world is millions of KM square, and every single x/y location is predetermined, but if you asked a computer to actually generate the whole thing the CPU would melt if the hard drive didn't fill up first.

I was suggesting he not actually generate the stars, but instead define them based on a seed value (say, their x/y/z location in the galaxy) so they don't get generated until you actually look at them.

So more like a chunk system. Also I might do the Drake thing. I've started to do calculations when generating each star, but have no idea how to implement a seed system, im not a huge expert in procedural generation.

EDIT: Seeds are a lot easier than I imagined in python, so I will implement this. The Kerbal system will be a reality!

Edited by DoctorCruz
Link to comment
Share on other sites

What are your goals with this? That's the big factor in whether an on-demand generation system is appropriate. If you want to do statistical analysis on the galaxy as a whole, then complete generation at start-up is the way to go, if it takes less than a minute and the data only takes up 100MB or so you're not going to melt any CPUs with that. If you're looking to make the systems visitable or observable with greater detail, then on-demand might be better, though if you visit or observe enough systems the memory requirements may become unpleasant.

Both systems are procedural in nature.

Link to comment
Share on other sites

What are your goals with this? That's the big factor in whether an on-demand generation system is appropriate. If you want to do statistical analysis on the galaxy as a whole, then complete generation at start-up is the way to go, if it takes less than a minute and the data only takes up 100MB or so you're not going to melt any CPUs with that. If you're looking to make the systems visitable or observable with greater detail, then on-demand might be better, though if you visit or observe enough systems the memory requirements may become unpleasant.

Both systems are procedural in nature.

I'm going to upload this project when its done, but here is a preview of how it does with a couple million stars:

Enter a seed: 23451012803127831247632838921483172938129421
Starting Generation.....
This Galaxy has 1921195 stars
This Galaxy has 5762570 planets
Generation took: 48.235 seconds

Thats calculating mass, radius, and luminosity, then determining each stars class using those three things. Python is what I am using for development BTW.

Link to comment
Share on other sites

No not like that. I mean like how Minecraft is procedural. The world is millions of KM square, and every single x/y location is predetermined, but if you asked a computer to actually generate the whole thing the CPU would melt if the hard drive didn't fill up first.

I was suggesting he not actually generate the stars, but instead define them based on a seed value (say, their x/y/z location in the galaxy) so they don't get generated until you actually look at them.

Unless something isn't being shown in the OP, I'm not sure it's even bothering with coordinates right now.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...