galaxy numerical simulation in freebasic

User projects written in or related to FreeBASIC.
Post Reply
chung
Posts: 648
Joined: Jan 16, 2010 20:52
Location: France
Contact:

galaxy numerical simulation in freebasic

Post by chung »

galaxie chung is a galaxy numerical simulation trial i have written in fast compiled freebasic for calculation and openGL for displaying.

=> http://chungswebsite.blogspot.fr/search ... axie_chung

https://www.youtube.com/watch?v=0nGqHLgxTJk

Image
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: galaxy numerical simulation in freebasic

Post by D.J.Peters »

good job
do you use any paper for move() and gravity() ?

Joshy
chung
Posts: 648
Joined: Jan 16, 2010 20:52
Location: France
Contact:

Re: galaxy numerical simulation in freebasic

Post by chung »

no paper i think, its just an old program i made when i was studient , but on that time the computers were not enough powerfull (the most powerfull was the Cray 1 , which was unaccessible to me). Now i have the power of a Cray 1 with my netbook and i have freebasic and opengl , so it is worth running it.

(25/05/2014) load, save, replay added
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

Re: galaxy numerical simulation in freebasic

Post by TESLACOIL »

Fascinating stuff.

Galaxies shed energy over time in the form of light and cosmic rays. They also heat up due to the hidden energy that's released via fusion of light elements. It would be interesting to see how such factors shape the evolution. Also the speed of light/gravity will have an effect.


Crash of the Titans: Milky Way and Andromeda Galaxy
https://www.youtube.com/watch?v=2WEI8WBJkKk
KlausPeterVDL
Posts: 45
Joined: May 04, 2014 21:02

Re: galaxy numerical simulation in freebasic

Post by KlausPeterVDL »

http://play.infiniverse-game.com/

go there, click, then press backspace for a mindblowing javascript version of this very thing.
save the site locally, comment out "this.energy -= amount;" in ship.js and reload to explore.
his galaxy code is in. uh... galaxy.js clean oop, mindblowing and simple algos. love it

just thought you might enjoy working his noise code into your viewer (and library of general awesomeness)
h4tt3n
Posts: 698
Joined: Oct 22, 2005 21:12
Location: Denmark

Re: galaxy numerical simulation in freebasic

Post by h4tt3n »

This is great work Chung, I really love it. Despite having worked with gravity simulators and grid based physics before, I am a bit unsure how this works exactly. Would you care to describe what's going on in the simulator?

Cheers,
Mike
chung
Posts: 648
Joined: Jan 16, 2010 20:52
Location: France
Contact:

Re: galaxy numerical simulation in freebasic

Post by chung »

well , its more a computational cooking than a maths theory , heres what is done :
it has to run on a small netbook so cpu speed is the priority
the galaxy is considered as a 2D gas of stars.
at each iteration, each grid square of stars gas is applied a speed displacement and a speed gravity acceleration.
the near gravity (less than 1 square distant) is not taken in account as it would bring instability and at this scale the gas property and the numerical approximation are supposed to be preponderants.
after displacement each gas square is redistributed in the grid with the principe of mass and impulse conservation in the four nearest grid squares.
works with 70..100 squares grid fast enough.
Post Reply