BASIC

Author Topic: 3d Space Sim  (Read 1799 times)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
3d Space Sim
« on: 2019-Feb-14 »
its kinda fun, i find myself spending hours every night playing with profiles, formations.
Fact: Most solar systems have a jupiter-like planet circling near the star.
In this sim, you can actually see this sort of thing form, and you can see why it happens (if you watch)
Watching, waiting, thats what this sim is about, theres not much to do except to start the planets and watch them whirl merge and form orbits.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4230
    • View Profile
    • Portfolio
Re: 3d Space Sim
« Reply #1 on: 2019-Feb-14 »
collisions with beautiful slow motion explosions too???   ;/

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: 3d Space Sim
« Reply #2 on: 2019-Feb-15 »
its mostly just math physics not much in the way of special effect.
just a toy at the moment, no real plans for this side project.
my big dream is still to do a flight sim. i have all the code i need for one, just not the time i need.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: 3d Space Sim
« Reply #3 on: 2019-Mar-01 »
collisions with beautiful slow motion explosions too???   ;/

fine ok, as you wish. And how about comets and trails that push away from stars?
How about this lighting from the star to the planets?
These objects all share the same object, they are coloured by another light from the cam position.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4230
    • View Profile
    • Portfolio
Re: 3d Space Sim
« Reply #4 on: 2019-Mar-01 »
 <3 That is neat! Would it work better if the planet shading was more "hard", like a cartoon shade?
Looks awesome and I bet even better while moving about. :)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: 3d Space Sim
« Reply #5 on: 2019-Mar-02 »
<3 That is neat! Would it work better if the planet shading was more "hard", like a cartoon shade?
Looks awesome and I bet even better while moving about. :)
not sure, if it would or not?

heres a close up on the planets moving..
the ones on fire recently absorbed smaller things
the ones with trails (in this scene) are the smallest and original objects flying around, they take on color when they combine with something smaller, and lose the tails.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4230
    • View Profile
    • Portfolio
Re: 3d Space Sim
« Reply #6 on: 2019-Mar-02 »
That is great, so you have a whole simulation of accretion disks to form the planets? Do you have different process for rock, gas,ice planets? Rings too?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: 3d Space Sim
« Reply #7 on: 2019-Mar-03 »
There is a space sandbox simulator if you really want that kind of effect with gas...saw it on youtube
tho it doesn't do accretion disks directly, you can immitate them by shredding stars lol

To answer your q's: yes and yes
basically, during system creation when the profile is chosen, it is an accretion disk engine at the beginning
gas? gas physics are present in the comets, the star pushes the gas tail away from the star.
planets form, its based on solids only, ice...rocks..solid. also....some gas are solid or liquid in deep space anyway, no atmospheres yet.
IRL most of the universe is made of hydrogen, doesn't make a good platform for planets.
supernovae create the higher density elements, and that is what these simulated objects represent, without regard to chemical properties and effects.

yes the disks can be formed into rings....every dimensional feature of an accretion is disk is covered if im not mistaking, but im not a scientist so, maybe i missed something.
Directly, it uses these features to form the solar systems:

Code: GLBasic [Select]
                        // SOLAR SYSTEM CONFIGURATION
                        GLOBAL SPLITWAVE                                = FALSE                         // Initial planet formation splits into 2 directions.
                        GLOBAL SPACEWAVEFORM%           = 1                                     // 0 = direct VECTORADD addition, 1 = random VECTORADD addition ()
                        GLOBAL RINGS%                           = 12                                    // Number of rings
                        GLOBAL RADS%                            = 2                                     // # of radial hub arms
                        GLOBAL SPREAD#                          = 12.0                          // additional rad spread random angle on xz plane
                        GLOBAL DIST#                                    = 2000.0                                // RADIUS OF PLANET BELT, PER STEP
                        GLOBAL GAP#                                     = 8000.0                                // Magnitude between each ring
                        GLOBAL G#                                       = 0.000006674                   // Gravitational constant - time, the bigger the constant, the faster time goes. our universe irl is very very slow, constant is tiny and thats a good thing.
                        //PLANET PHYSICS
                        GLOBAL STARSIZE#                                = 1000000000.0          // 0 = normal object >0 = star to form in center, size starts at this size.
                        GLOBAL MaxMASS#                         = 1100000.0                     // RANDOM PLANET MASS MAX START SIZE
                        GLOBAL MinMASS#                         = 1000000.0                     // RANDOM PLANET MASS MIN START SIZE
                        GLOBAL VECTORADD#                       = 0.0                           // addition to SPACEWAVEFORM% angle of fall at initialization, 0 = stable, no variationss regardless of SPACEWAVEFORM%,
                        GLOBAL E#                                       = 120.0                         // solar system initial spin speed
 


Once the system is created and set into motion, its all Master Lord Sir Isaac Newtons Laws of motion in effect.
The algorithms he created and so beautiful, so beautiful they're compatible with computer code.
And to think he designed them 400 years ago without a calculator or computer is mind boggling.


[edit] it also has 3 cams, so far (these so tedious)
1 planet chase cam(not fixed, litteraly chases), 2 star tracking cam, and 3 freemouse cam
Freemouse cam also tracks with star, because it moves sometimes, quickly.
« Last Edit: 2019-Mar-03 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4230
    • View Profile
    • Portfolio
Re: 3d Space Sim
« Reply #8 on: 2019-Mar-03 »
Now I just wonder, you are probably dealing with numbers super small and huge, are you keeping it all float?

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2631
    • View Profile
Re: 3d Space Sim
« Reply #9 on: 2019-Mar-04 »
Looks very interesting Hemlos, looking forward to seeing it in motion!  :good:
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1536
    • View Profile
Re: 3d Space Sim
« Reply #10 on: 2019-Mar-04 »
Very cool and nerdy! :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10715
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: 3d Space Sim
« Reply #11 on: 2019-Mar-09 »
Very cool. How do you come up with that kind of ideas?

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1635
  • Particle Hawk
    • View Profile
Re: 3d Space Sim
« Reply #12 on: 2019-Mar-09 »
Very cool. How do you come up with that kind of ideas?

I randomly study of math and astrophysics on a regular basis, using GLBasic to visualize some math.
I really wanted to see gravity in action, to see; stars, planets and moons form and take on unique orbits.
When i saw the formula for gravity from Isaac Newtons principia, i figured it could be worked out using a double nested loop.
Also, it has become a great platform for refining my 3d libs for cameras, particle engine, lighting, and sfx, etc etc
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

Offline dreamerman

  • Global Moderator
  • Dr. Type
  • *******
  • Posts: 288
    • View Profile
    • my personal website
Re: 3d Space Sim
« Reply #13 on: 2019-Apr-22 »
Just waiting patiently to see this in action, at least in video..  :)
Check my source code editor for GLBasic - link