[PB 4.31] Random realistic solar system

Share your advanced PureBasic knowledge/code with the community.
Kelebrindae
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 01, 2008 3:23 pm

[PB 4.31] Random realistic solar system

Post by Kelebrindae »

Hi,

Here is the sequel of these two previous threads:
- Random terrain
- Random planet mesh

The purpose of this program is to generate "scientifically sound" solar system, along with a lot of informations about each of its planet (type, year duration, temperature, atmosphere, etc..).
It is mainly based on two (rather old) articles :
- "Habitable Planets for Man", S. H. Dole (1964)
- "Extra-Solar Planetary Systems: A Microcomputer Simulation", Martyn J. Fogg (1985)
and on several implementations of an algorithim called "Accrete" (Pascal, C, C++, Java...).

The principle is to create a random star with a random quantity of gas and dust around it, and to simulate the accretion of these gas and dust to form planets. Then, from the size/mass/composition/position of these planets, it computes what it looks like.
I can't say that I have a complete understanding of the theory, far from it :wink:, but I actually managed to get something that works. I've even added a few things here and there (what's in a liquid state on the surface, etc..).

Well, here you go. It's a beta version, not perfect nor complete, but it's already quite fun. I can't post the code here (too big) but you'll find it in this zip archive:
http://keleb.free.fr/codecorner/downloa ... ete-en.zip
along with an EXE to test it.

Screenshot:
Image

The ergonomy of the screen is quite bad, so:
- Type in a number in the "seed" zone (or let it blank) to initialize the random number generator, then click on "Generate".
- To browse the planets of the system, click on the tiny buttons under the image
- To zoom on a planet and browse its satellites, click on the tiny "+" button.

A few seeds that gives interesting results:
- 863150: 11 planets, 1 terrestrial planet with 1 terrestrial moon, both habitable
- 25329 :9 planets, 1 sub-Gas giant with its outer layer at 14.8°C and 1 habitable moon (perfect if you want to install a gas mine a la Bespine)
- 528439: 12 planets, 1 venusian, 1 non-habitable terrestrial, and a nice asteroids belt
- 103365: 13 planets, 1 oceanic planet with breathable atmosphere

To do:
- Some infos are missing for moons (distance from the planet, rotation, etc.).
- Add rings around planets.
- Improve the planet classification (I still don't know what to do of the "gas dwarves", which are massive enough to accrete gases like the gas giants, but are composed of almost 100% solid stuff like the rocky planets).
- The name generator could be better.


That's all! Now, it's time to boldly go where no man has gone before...
LCD
Enthusiast
Enthusiast
Posts: 206
Joined: Sun Jun 01, 2003 10:55 pm
Location: Austria, Vienna
Contact:

Re: [PB 4.31] Random realistic solar system

Post by LCD »

I had a similar one on ZX Spectrum, which calculates a complete solar system depending on the size of the sun.
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
Thalius
Enthusiast
Enthusiast
Posts: 711
Joined: Thu Jul 17, 2003 4:15 pm
Contact:

Re: [PB 4.31] Random realistic solar system

Post by Thalius »

Whoa, Great Stuff! ;) Somehow brings back memorys of David Braben's Elite(tm) Series :D

Cheers,
Thalius
"In 3D there is never enough Time to do Things right,
but there's always enough Time to make them *look* right."
"psssst! i steal signatures... don't tell anyone! ;)"
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: [PB 4.31] Random realistic solar system

Post by IdeasVacuum »

A fabulous piece of work -concise, clever and very interesting. Reading your code is an education itself and the GUI works really sweetly.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
kinglestat
Enthusiast
Enthusiast
Posts: 732
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: [PB 4.31] Random realistic solar system

Post by kinglestat »

only 1 word

wow!

Well done
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
Kelebrindae
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 01, 2008 3:23 pm

Re: [PB 4.31] Random realistic solar system

Post by Kelebrindae »

Thanks a lot for your kind comments, guys; It means a lot to me! :D
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: [PB 4.31] Random realistic solar system

Post by yrreti »

I hate to tell you this, but avast reports a virus: Win32:SkiMorph [Cryp] :?:
on your file at http://keleb.free.fr/codecorner/downloa ... ete-en.zip.
Could you or someone else check it as it looks very interesting. But avast won't let
me download it.
Thanks
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4326
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: [PB 4.31] Random realistic solar system

Post by Rook Zimbabwe »

Likewise with I had same issue with my Avast. :evil:

I used my honeypot cpu to DL it at work though... It has several viri attached to it. Looks like it was attracted on host or on transmit host account! :evil:

Sad... this look sSO COOL!!!! I was wondering if you could add a graphic for the "life zone" around eaach star... (there are formulas for this!) :D
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
luis
Addict
Addict
Posts: 3876
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [PB 4.31] Random realistic solar system

Post by luis »

EDITED: sorry, I wrote bad things about Avast, when usually it's quite good.

I confused it with another: Avira, don't know why... well probably because the name is similar.

Anyway, just donwloaded the zip, I followed exe execution until startup. It doesn't do anything suspicious.

A normal PB executable IMHO.

Nice idea for the program BTW :)
"Have you tried turning it off and on again ?"
A little PureBasic review
somic
User
User
Posts: 66
Joined: Sun Jun 29, 2008 9:11 am
Location: Italy
Contact:

Re: [PB 4.31] Random realistic solar system

Post by somic »

Very Nice.

Thank you for sharing.

It remembers me when I was playing (a lot) with my ZX Spectrum (me too, LCD ;-) and (less) with Elite (me too, Thalius ;-).

rgds,
Somic
----------------------------------------------------------------------------
Semel in anno licet insanire (Seneca)
email: somic@libero.it, website: http://www.semelinanno.com
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: [PB 4.31] Random realistic solar system

Post by rsts »

Incredible. :shock:

Very nice. Thanks for sharing.
Post Reply