r/gaming • • Oct 05 '10

Gravity simulation (flash).

http://www.nowykurier.com/toys/gravity/gravity.html
718 Upvotes

233 comments sorted by

66

u/NanoStuff Oct 05 '10 edited Oct 05 '10

Made this over the last while. It's physically accurate but the physical constants differ (mass is arbitrary, not metric).

Update: I just noticed there is a performance leak somewhere. After generating a whole bunch of proto disks and allowing the particle count to drop, CPU usage remains much higher than it should for that number of particles.

I will probably get to making something a bit more efficient from scratch so I'll let the issue sit for now. If things get slow just refresh.

3

u/Sir_Vival Oct 05 '10

What does the "Integration is 0(n2) Eular" mean? I made a flash gravity simulation a while ago that wasn't technically correct in many ways and I'd like to know what it means.

3

u/NanoStuff Oct 06 '10

Euler is the integration method. O(n2) refers to the time complexity of the simulation, as opposed to O(n logn) which can be achieved with space partitioning.

3

u/notthemessiah Oct 06 '10 edited Oct 06 '10

This is the case because each star in the system is interacting under gravity with every other star in the system. Suppose you have a system of N stars, each time-step it calculates the forces on N-1 stars (since it doesn't interact with itself). Since it calculates N-1 forces for N stars in the system, that's N*(N-1)=N2-N force calculations, or approximately on the order of O(N2). If you take into account Newton's third law, you can even cut the number of force calculations in half, but it will still be O(N2).

2

u/Rebelius Oct 05 '10

instead of computing all the integration maths properly, it's done by the Euler method. I can't remember what the O(n2) means but it's probably something to do with the accuracy.

2

u/atrigent Oct 05 '10

Isn't O(n2) the performance? As in big O notation?

→ More replies (1)

2

u/adremeaux Oct 06 '10

First step should be to clear particles that move off screen after a few seconds. Also may want to check your memory management; Flash isn't very good with removing objects from memory unless you do a lot of manual cleanup before: just removing it from the stage and removing references isn't always enough. Make sure all event listeners are cleared and there are no references to any part of the object anywhere.

This simulation would be a perfect place to use the object recycling pattern. Rather than constantly delete and recreate new bodies, when a body is cleared it should be dropped into a recycler array that is tapped for a "new" particle instead of a new one being created. If there are no old particles left, a new one is made. This has a great effect on performance and memory usage, especially in Flash.

You should also put your paths into a single bitmap layer beneath everything rather than having an object draw its path upon itself. (I'm not sure you aren't already doing that, just a general idea).

1

u/NanoStuff Oct 06 '10

First step should be to clear particles that move off screen after a few seconds.

Possible optional feature, many people wouldn't be happy to find their planets vanishing when their orbit is too big to fit the screen. This isn't the source of my problem in any case.

Flash isn't very good with removing objects from memory unless you do a lot of manual cleanup before

I'm not very concerned about memory leaks, something is eating up CPU power despite cutting references in the particles vector. To be honest I didn't even check, it's probably some stupid little thing I overlooked. The problem will probably vanish with a fresh approach. The particles don't have event listeners attached btw.

Rather than constantly delete and recreate new bodies, when a body is cleared it should be dropped into a recycler array that is tapped for a "new" particle instead of a new one being created.

I found the number of collisions negligible enough to not bother with this but that's definitely the right approach.

You should also put your paths into a single bitmap layer beneath everything rather than having an object draw its path upon itself.

Yup I am. The path is still drawn as a vector but copyPixeled into the bitmap as soon as it's drawn at which point the vector is cleared. AS3 doesn't appear to provide means to draw a bitmap line directly short of implementing the feature on my own.

1

u/adremeaux Oct 06 '10

I'm not very concerned about memory leaks

Really? Here is your memory usage in a single minute of usage. I made a few particles then a couple proto discs and then did nothing else. This is a sample every 2 seconds.

76.61mb

81.46mb

84.29mb

87.38mb

89.82mb

92.13mb

94.49mb

96.85mb

99.20mb

101.43mb

103.74mb

105.99mb

108.24mb

110.50mb

112.77mb

115.02mb

117.23mb

119.46mb

121.70mb

123.93mb

126.18mb

128.37mb

130.64mb

132.88mb

135.11mb

AS3 doesn't appear to provide means to draw a bitmap line directly short of implementing the feature on my own.

Your best bet would be to have an invisible (or just not added to stage) sprite that you draw the vectors to every frame, then have the bmpdata draw that sprite onto itself then clear it.

1

u/NanoStuff Oct 06 '10

Really? Here is your memory usage in a single minute of usage.

Performance crapped out to make the whole thing essentially unusable before I could get to 250 MB. That's definitely wasteful but with gigabytes of RAM I won't cry over it. Whatever is causing the performance loss is probably tied to the memory leak however (if it is a leak, maybe it's just the garbage collector taking it's time).

Reusing particles instead of performing constant memory allocations is something I have not implemented which would likely solve at the very least the memory usage issue, but that's for the next version.

Your best bet would be to have an invisible (or just not added to stage) sprite that you draw the vectors to every frame, then have the bmpdata draw that sprite onto itself then clear it.

That's definitely more elegant than what I have at the moment, noted for 2.0!

21

u/Archnation Oct 05 '10 edited Oct 06 '10

My best shot at a star > planet > moon. http://i.imgur.com/PDu8i.png

Actually, i realized it's stable. It's just moving.

3

u/zaq1 Oct 06 '10

That gives it an interesting perspective that I've never thought about before.

3

u/missingpiece Oct 06 '10

The Sun actually does revolve around a point; it doesn't spin on its own axis... of course, the point it revolves around is still within the Sun, but it's not directly centered. THE MORE YOU KNOW!

4

u/[deleted] Oct 06 '10

... which is a method for astronomers to find stars with planets.

→ More replies (1)

15

u/Mythrl Oct 05 '10

Would be nice to have zoom in and out. Otherwise it's pretty cool.

12

u/[deleted] Oct 05 '10

Pretty damn cool. Since I can't really do anything smart with it, you should have a button to generate the solar system so I can destroy it.

4

u/xpinchx Oct 06 '10

A resounding YES, that would be awesome. I spent like 5 minutes setting up a huge mass with lots of orbiting planets just to send a huge chunk of mass through it and see how messed up it would get. Having stuff pre-generated would be fun.

→ More replies (1)

4

u/Roughy Oct 06 '10

I think there it has some presets. I ... have no idea what key I hit, but it spawned a spherical mass of bodies of varying size which were promptly sent flying by my massive balls of steel.

4

u/billwoo Oct 05 '10 edited Oct 05 '10

Its very nice. Does it run at maximum speed or a set speed? Cos if its set it would be nice if we could vary it (i.e. get it run at maximum possible speed!). I want to see if stable orbits occur. Also, an initial rotational velocity would be cool!

/ edit just noticed, it looks like the proto disk does have rotational velocity initially!

1

u/fall_ark Oct 06 '10

Would you be adding any new features / make an update anytime soon?

Like, I really wish I can toggle gravity on and off at will, so I can set up a scenario or something.

Toggle collision/collision mass gain would also be great.

And of course more presets and more ways to scatter stars!

It's brilliant as it stands though. Thank you sir. :)

1

u/NanoStuff Oct 06 '10

Would you be adding any new features / make an update anytime soon?

I have not planned for it but I'm somewhat surprise to wake up to 400 votes. Now I almost feel obligated.

Toggle collision/collision mass gain would also be great.

A lack of collisions would cause singularities (infinite acceleration where points meet), causing the particles to shoot off into the vastness of space, so it's also a requirement, not just a feature. I could add velocity/acceleration clamps but the results I had with these produced unnatural clustering.

1

u/fall_ark Oct 06 '10

Pity. I guess if clamp doesn't work then there's little choice. Nonetheless, a buggy feature might still be a fun feature, since it seems that it wouldn't be too much work/you've already done it?

I think I spotted a few infinite accelerations though... especially when a really big star is attracting smaller ones.

I'm sure you'll have a rough idea about future improvements (if any), but might I suggest an eraser tool anyway? Small stars are very difficult to delete right now.

Thanks again for the work! Sending this around with nerdgasms everywhere I see. :)

1

u/NanoStuff Oct 06 '10

I guess if clamp doesn't work then there's little choice.

Well, it works, but the results are nothing other than what I would have expected. When two particles reach a point where they are supposed to collide and they don't, one way or another physics is going to break down, either by singularities or by clamps. Collisions were a much better idea because they allowed the proto disk formations and are generally much more interesting to watch than the alternatives.

I think I spotted a few infinite accelerations though... especially when a really big star is attracting smaller ones.

Yup, when they are moving very quickly the collision is not caught. This too is solvable but again there are issues of performance and how much time I can possibly devote to making everything perfect.

Sending this around with nerdgasms everywhere I see.

I've cross posted from WebGames but remarkably didn't get a single vote there.

2

u/Nukleon Oct 05 '10

Wow, I've been looking for one of these for ages. Played with one made in Java once, was never able to find it again :(

2

u/[deleted] Oct 05 '10

Lunar Lander game written for 1975 HP 25

Unfortunately, there was no Flash for the HP25.

1

u/jezmck Dec 01 '10

Ooh, negative numbers!

1

u/[deleted] Oct 06 '10

Request:

  1. new version with one big button "Generate proto disk" in the center of screen.

  2. add button for serialization of system state to text - so people can cut-n-paste and post here

  3. add button for deserialization, of text to system state - so people can get others' systems.

Let a thousand flowers bloom

→ More replies (1)

0

u/[deleted] Oct 05 '10

[deleted]

6

u/NanoStuff Oct 06 '10

I'm aware of that, however RK4 would have been several times slower. In actionscript such a thing would have crippled the particle count from an already limited number. Euler is sufficiently accurate so long as the orbit speed (cycles/sec) is not too high (> 1/sec). Proclaiming RK4 superiority seems a bit misconceived when performance versus accuracy/stability needs to be weighed. RK4 is superior in non-interactive simulations because the time step can be dynamic (predicted error) and thus arbitrarily low. When 60 FPS needs to be maintain regardless of expected error the situation differs.

0

u/[deleted] Oct 06 '10

[deleted]

3

u/NanoStuff Oct 06 '10

Right, but notice that I need to maintain a high framerate regardless, because of visual appeal. The simulation would not be very fun at 5 FPS even if accurate. At 60 FPS Euler is very accurate, only failing in the most extreme of situations.

RK4 would however allow for time acceleration to progress the simulation without destabilizing it too much (a fast forward feature). If I'm going to implement RK4 it would have to be conditional or user selectable, as Euler will still be superior in most situations due to the large performance benefits and negligible error.

4

u/zeug Oct 06 '10

RK4 will reduce your computation time by several orders of magnitude over simple Euler integration for a given error tolerance, but you will still get out of control errors when objects get too close and accelerations get large. Aside from saving clock cycles, RK4 does not do anything that Euler (essentially RK1) doesn't do.

For n-body gravitation problems where n is not outrageously large, an adaptive step algorithm like RKF will be much more realistic.

1

u/NanoStuff Oct 06 '10

RK4 will reduce your computation time by several orders of magnitude over simple Euler integration for a given error tolerance

It would, but as I've mentioned elsewhere my constraint is not a given error tolerance but a given frame-rate to produce a visually smooth simulation. As this is not a scientific sim, a high frame rate must be maintained regardless of error, and at 60 FPS the benefits of RK4 diminish considerably, but the dramatic performance loss at that same frame rate is still there.

3

u/zeug Oct 06 '10

I agree with you 100%. My point is that RK4 is just as inappropriate for a scientific simulation as the errors explode when the gravitationally attracted bodies pass close to each other. Your simulation cleverly bypasses this problem by having the inelastic collisions at close approach where the particles clump together.

I think that I see your point - Euler at 60 steps per second produces too small an error at non-collision distances to be visually recognized, and if you used RK4 to drop the number of iterations per second it would look all jumpy even if you removed some error.

Anyone who puts up a page saying that RK4 is the best thing for gravitational simulation in all cases does not know much about celestial mechanics.

3

u/NanoStuff Oct 06 '10

Your simulation cleverly bypasses this problem by having the inelastic collisions at close approach where the particles clump together.

The primary intent was to avoid the issue of singularities, which would occur regardless of the means of integration (the alternate solution was to clamp/restrain forces). Nice behavioral dynamics was the second (star system formation without needing excess particles by summing masses). I suppose eliminating extreme conditions which break the integrator would be a happy third reason.

If I make a version 2.0 (I'm considering it) the first priority will not be the integrator but the acceleration structure. At the moment I'm thinking quad-trees but these seem to fare poorly in collision detection of particles of an indeterminate size. I will probably add RK4 while I'm at it for all the complainers :), but Euler will still probably be default because I still see it as most suitable given the circumstances.

Another approach I've considered is RK4 with independent time-step which could produce performance and accuracy higher than Euler, however this would need to be paired with path interpolation and tweening for mis-predicts. This could get very difficult and ultimately produce glitchy visuals with negligible gains in accuracy and/or performance, so I'm not sure if I want to invest the time for such experimental endeavors. At this point I'm undecided so a convincing argument might convince me one way or another.

→ More replies (3)

16

u/r4and0muser9482 Oct 05 '10

If you use Euler then you are a bloody idiot

...subtle

9

u/DanDixon Oct 06 '10 edited Oct 06 '10

In casual use it's hard to tell the difference between the two (other than RK4 'feels' a little slower), as nearly circular orbits are stable using both modes. It's most noticeable with extremely elliptical orbits simulated with Euler at high time steps. These simulated orbits can lose or increase their eccentricity within a few orbits.

You can toggle between using Euler and RK4 in Universe Sandbox and see this for yourself. Universe Sandbox is a 3D, real units, interactive gravity simulator that I made and continue to improve: http://universesandbox.com/

To see the difference:

  • Open up the "Earth & Moon" simulation in Universe Sandbox.

  • Use the space bar to pause the simulation.

  • Click on the gray bar on the far left to open the view controls. A the top you can toggle between the two "Accuracy Mode" options: Euler & RK4.

  • Click on the Moon and change its eccentricity (the ecc text box on the right side) from it's near zero value to 0.9 or something similar.

  • In the view panel, turn up the trail segments to 500 (this is a little below where you toggle Euler or RK4).

  • Set the time step to '3 hours' (at the top left of the window next to the click icon). This will increase the speed, but decrease the accuracy of the simulation (and make the differences in Euler and RK4 more apparent).

  • Press the space bar to resume the simulation and observe.

  • Press Ctrl+R to restart the simulation, switch to the other mode, and repeat the above steps. Notice what happens to the shape of the orbit when in Euler.

→ More replies (1)

6

u/Stickyresin Oct 05 '10

Wow, thanks for that link. I'm actually making a 3d scorched-earth type game in OpenGL for my senior project. I have a lot done already but I did use this Eular integration for calculating the projectile position with gravity and wind. Not that I chose it on purpose, i just don't really have any 3d programming experience and that's what came to my head when i thought about implementing projectiles. Guess i'm a bloody idiot!

→ More replies (2)

0

u/[deleted] Oct 06 '10

[deleted]

1

u/NanoStuff Oct 06 '10 edited Oct 06 '10

It's accurate so long as the situations are not too extreme. It's accurate as a physical function of gravity, obviously there will be integration error. If there are strong visible hard knees in the path then things are moving too quickly (masses too high, too close).

33

u/crazyex Oct 05 '10

I really, really wish there was a zoom option. If there is one, I really, really wish I was smart enough to have seen it.

9

u/NanoStuff Oct 06 '10 edited Oct 06 '10

I considered the idea but there were issues with the path canvas and scaling of radiuses/collision detection. There is no concept of a camera distance like in 3D so the problem is not as simple as merely zooming.

It's doable but I honestly didn't think this would even get 2 votes so I didn't bother :) I might get to it.

It's also the very first thing I ever made in actionscript, so maybe there is some elegant simple feature I'm overlooking to scale the render.

4

u/crazyex Oct 06 '10

I didn't mean it to sound too negative, I just scrolled the mouse wheel and was kind of disappointed when it didn't zoom. It an awesome program. I messed around with it for about 45 minutes yesterday and added it to my favorites.

I also posted about the zoom before I tried the protodisk. That helped keep things in view. I really enjoy seeing ellipse trails for some reason.

1

u/adremeaux Oct 06 '10

You could just scale the entire sprite that everything is a child of...

The only thing that would have trouble with that would be the paths, if they are being written to bitmap data, as they'd get ugly when you zoomed in. You'd pretty much just have to clear the paths on zoom if you want to be able to maintain any sort of performance.

1

u/NanoStuff Oct 06 '10 edited Oct 06 '10

You could just scale the entire sprite that everything is a child of...

Interesting, but would that provide more space or just make things smaller? Shrinking the container would produce vacancies around it's sides.

Perhaps if I made it vastly larger than the stage dimensions (if such a thing can be achieved) to give a lot of zoom headroom. Even then it seems that won't get the job done because the position variables in the integrator are coupled with the display coordinates, and display coordinates in the Sprite will not compress, their range will simply get smaller.

1

u/adremeaux Oct 06 '10

Aren't your particles already being retained outside of the bounds of the stage though?

Perhaps if I made it vastly larger than the stage dimensions (if such a thing can be achieved) to give a lot of zoom headroom.

Hmm? You don't need to make anything any specific size in Flash. Just put your main sprite in the center of the stage and scale as necessary, there really is nothing else involved. Going back to the bmpdata/sprite drawing object from the other thread, you can still attach both of those to the main sprite and the drawing should scale properly automatically.

Even then it seems that won't get the job done because the position variables in the integrator are coupled with the display coordinates, and display coordinates in the Sprite will not compress, their range will simply get smaller.

I think you need to (mentally) separate the math and the drawing, here. If you put something at 100,100 inside a sprite, then scale that sprite to 50%, the object's x/y as reported by the Flash will still be 100,100. You wont need to change your math at all.

Oh, one last thing you may try for optimization would be store the objects actual x/y coordinates as floats separate from their stage position, which should be (int)ed to reduce redraw calculations.

That is, roughly: obj.realX = calculateX(obj.realX); obj.x = int(obj.realX);

→ More replies (4)

24

u/npotency Oct 05 '10

I'm trying to get planetary orbits to work. The planets tend to collide.

6

u/[deleted] Oct 05 '10

I got a two body system going http://i.imgur.com/TyUms.png

→ More replies (4)

11

u/[deleted] Oct 05 '10 edited Oct 06 '10

I tried but I couldn't get much done. Best I could do.

Edit:Spelling

4

u/chipbuddy Oct 05 '10

in the very very lower left hand corner there is a "generate proto disk". try hitting that.

5

u/rean2 Oct 05 '10

its a great example of how solar systems form. I even got a binary solar system up (Two suns rotating around each other). I also got a planet with moons orbiting the binary star

3

u/[deleted] Oct 05 '10

2

u/fall_ark Oct 06 '10

Yeah. A "no collision" or "collision eliminates the smaller object" mode would be most welcome.

2

u/[deleted] Oct 06 '10

1

u/[deleted] Oct 05 '10

I got one here http://imgur.com/Bs0LJ.png. It works similar to how I would assume our planets affect our sun, the sun constantly moves and is being pushed by the gravity of the planets around it. I could be wrong though.

0

u/[deleted] Oct 05 '10

[deleted]

8

u/zaq1 Oct 05 '10 edited Oct 05 '10

Generate a proto disk and plop an OMFG in the middle. You'll get one that circles short, one that circles far and one that shoots off somewhere else. It looks like a pinwheel you'd see in someone's yard. I'd take a screenshot but I just closed it.

That said, I'm flat out amazed that this rock we're on even still exists.

edit: I don't know what I'm doing

4

u/uncleawesome Oct 05 '10 edited Oct 05 '10

this is what i got the gaps in the white orbit are from the bottom yellow planet pulling it. the central yellow orbit became smaller when the bottom planet went into the central omfg.

later with a beautiful elliptical and an ugly fishing ling orbit

addition of a large and huge really changes the orbits

20

u/[deleted] Oct 05 '10 edited Oct 05 '10

Stable star system. This is fun.

EDIT: Heh, check this out - Planet with moon orbiting central star

→ More replies (2)

3

u/paladin161 Oct 06 '10

Generate a proto disk and plop a -1,000,000,000 in the middle.

17

u/barnold Oct 05 '10 edited Oct 05 '10

I wrote this simulation of planetary motion a few months back if anyone is interested. http://brendan.sdf-eu.org/JWrngSci/JWrngSci1_2010_12/applet/

6

u/[deleted] Oct 05 '10

There's gotta be some kind of story behind that.

→ More replies (1)

2

u/mrspaznout Oct 06 '10

lawl i love you for that

1

u/[deleted] Oct 06 '10

That's what happens if you use Euler integration.

1

u/[deleted] Oct 06 '10

It says you went over your quota.

→ More replies (2)

11

u/[deleted] Oct 05 '10
  1. Make about 500 tiny particles standing still.

  2. Put an OMFG particle in the middle.

  3. Watch the universe end.

4

u/tk993 Oct 06 '10

And then in the middle of the universe ending press "Show paths" and enter warp-speed.

1

u/icefreez Oct 06 '10

I did this and some how one little planet survived into a very fast orbit. It was pretty cool to watch that one little guy survive the largest disaster known to the universe. :P

11

u/apeape28 Oct 06 '10

3 features that would make this already very cool app even more awesome:

  1. a speed up function. I like to see how a system would stabilize, and the movement of the objects slows down considerably as it goes along.

  2. A zoom out function. I have 23 objects on screen according to the counter, but I only see about 4. What are those other 19 doing? Plus zooming out without making the dots smaller would be really cool.

  3. A focus feature. There usually ends up being one 'sun', or at least a largest mass that all the others orbit around, but that sun slowly moves away, and if I have to move the view to keep up with it then the paths get erased. It would be cool if I could click on the sun, and the camera would stay centered on that one object.

Very cool!!

9

u/klaq Oct 05 '10

i thought it said gravy simulation. god im hungry

1

u/DDay629 Oct 06 '10

Yeah, I thought that too. I was disappointed till I saw how awesome the simulator was.

7

u/[deleted] Oct 05 '10

http://imgur.com/lbuXC

I have no idea what i'm doing...

7

u/BloodReign Oct 05 '10

http://imgur.com/SLYiO.png it took me a while to get this but its still going

7

u/yesnoyes Oct 05 '10

I prefer this toy/tool for simulating solar systems: http://phet.colorado.edu/sims/my-solar-system/my-solar-system_en.html

4

u/NonAmerican Oct 05 '10

Shit, you see that and then think how silly it is to try to predict how the earth was formed. Even a simplistic simulation of 3 objects can create extremely complex patterns, imagine the universe.

3

u/sgnl03 Oct 05 '10

Well, not really. Our solar system formed from a disk of matter, not just a random star that captured bits of rock. Enough matter accreted at certain radii to form the planets (gas shedding for outer planets if you believe some theories), etc...

2

u/elustran Oct 05 '10

Thanks - I bookmarked this a while back, but I lost it. It's quite excellent.

7

u/[deleted] Oct 05 '10

wow this is really cool, I have no idea what the fuck I'm doing but I feel like that guy called God.

6

u/weazx Oct 05 '10

What if God was one of us?

4

u/kidtachyon Oct 05 '10

He would be a slob

3

u/MrsFuckYou Oct 06 '10

A stranger on the bus?

→ More replies (1)

77

u/bigmur72 Oct 05 '10

This took me a little while.

http://i.imgur.com/bAGlV.jpg

31

u/[deleted] Oct 05 '10

95 particles it says.... That looks way more then 95. Fake? Or am I wrong? Or am I missing the obvious sarcasm?

40

u/Catses Oct 05 '10

I can tell by the astral bodies and from seeing a few solar systems in my time.

5

u/bigmur72 Oct 06 '10

haha, yea, it's fake, I thought it was pretty obvious! haha. Cool flash thing though!

9

u/[deleted] Oct 06 '10

6

u/oldguy60 Oct 06 '10

I made a pretty too!

EDIT: Thats a sun, planet and moon in stable orbits after 20 "years"

...or me playing with on-line spirograph.

→ More replies (2)

12

u/zaq1 Oct 05 '10

Awesome. Make it generate random planets to start with and you (I) can use it as a screensaver.

3

u/Adamsky Oct 05 '10

I've been pressing 'i' on my keyboard to try and make it go full screen like a screensaver because I dun can't read good boss.

6

u/Pyronious Oct 06 '10

If you like this, you should really check out my friend Dan's Universe Sandbox. It's an awesome gravity simulator with a ton of cool presets, slick 3D graphics, and explosions!

3

u/fall_ark Oct 06 '10

Whoa. That's fucking awesome. Submit that, dude.

//saw a few submissions but they're years old....seriously, submit that.

5

u/cheeseburgertwd Oct 05 '10 edited Oct 06 '10

I wonder how long it'll take to get all the way around...

Edit: I gave up on it, sorry. This took like 40 minutes by itself.

5

u/Shenorock Oct 05 '10

This thing is addictive, here is (was?) my galaxy. http://i.imgur.com/Mxs6T.jpg

5

u/draculacalled Oct 06 '10

I thought it said gravy simulation. Disappoint.

4

u/chipbuddy Oct 05 '10

this is the best orbit i've been able to make so far

4

u/caltheon Oct 05 '10

I think i made a spirograph. Center is about 10 OMFGs combined, orbiter is a tiny

http://imgur.com/M0x2jl&EXwFU

3

u/zane17 Oct 05 '10

You don't have to combine 10 OMFGS, just go to the text box and add an extra zero.

3

u/caltheon Oct 06 '10

I didn't do it on purpose =)

4

u/chowmeiniac Oct 06 '10

So the thickness is the speed? http://imgur.com/0Ds5m.jpg

1

u/ddevil63 Oct 06 '10

Wowa, what do you call this at the top? This happened randomly when generating a proto disk.

1

u/NanoStuff Oct 06 '10

It's just a secondary orbit, just doesn't look like it from the camera's perspective. As a more extreme case kind of how the moon's orbit appears to loop back on itself from the sun's perspective

1

u/Jewey Oct 06 '10

"you shouldn't have done that"

1

u/NanoStuff Oct 06 '10 edited Oct 06 '10

Nice find :), I was waiting for this.

[edit]. Oh wait, you're not the first. Damn, that didn't take long.

→ More replies (1)

1

u/incredulouspig Oct 06 '10

This is fantastic. I've been trying to create a simple sun-planet-moon orbit, but it's proving quite difficult!

1

u/NanoStuff Oct 06 '10

but it's proving quite difficult!

An issue of the specific math involved or general programming burdens?

1

u/hobofats Oct 06 '10

what really blew my mind was, after having a really hard time getting multiple stable orbits, i realized i was only working with 2 dimensions. i would love to be able to model objects orbiting the same mass traveling on different planes. hoooooly shit im a nerd.

2

u/NanoStuff Oct 06 '10

I'd love that too but particle density is already sparse enough in 2 dimensions. If flash gave access to the system vector hardware that would be a gravity party.

I'm planning on creating a 200,000 particle sim on CUDA at some future point in time. That would blow your socks off in 3D, but not for a while yet.

3

u/[deleted] Oct 05 '10

Make this into a game: Establish stable orbit. It took me a good 5 minutes.

3

u/fatnino Oct 06 '10

stable orbit is no big deal. now getting a "moon" around your "planet" is hard.

3

u/Tordek Oct 06 '10

Levels, man,

Level 1: Stable orbit.

Level 2: Stable orbit + Moon.

Level 3: 2 Stable Orbits...

and so on.

→ More replies (1)

3

u/NonAmerican Oct 05 '10

This is the best thing I've seen on the internet in a month.

3

u/spiffelight Oct 05 '10

My Galaxy

3 Planets orbiting the red one,

The stray-path-planet at bottom collided with the planet (that got a few pathlines within the many large pathline-set), making the big orb of pathline-net... then that one collided with the big path-planet, making the darker (orange?) path.

Wow, I suck at explaining, but I was amused watching two planets collide, forming a new one, then that one and another collide, but it's still orbitin' so it's awwwwwwright, no?

3

u/77ScuMBag77 Oct 05 '10

You guys must be pros because this is all I'm getting :(

4

u/listos Oct 06 '10

you must have a computer that wants the universe to explode.

→ More replies (1)

3

u/gonzo1984 Oct 06 '10

Am I the only one who read "Gravy simulation"?

3

u/tehsam016 Oct 06 '10

Very cool little game or w/e. Left mine going for about 2 hours and came back to this.

3

u/[deleted] Oct 06 '10

I put 5 clusters together and stretched across both monitors, let it run for half an hour and threw a couple PS filters on. a half decent wallpaper if i do say so myself

2

u/[deleted] Oct 05 '10

This is awsome. That being said, can you make one where you can set your own masses and velocities? I wanna try to get some crazy galaxy simulations going haha

1

u/Sarley Oct 06 '10

We're just missing some exact velocity control. You can set the mass using the text box, but you'd have to figure out your scale. I'm no scientist, but we need a zoom function too. :)

2

u/saulgold Oct 05 '10

All must generate proto disk!

2

u/keepingitcivil Oct 05 '10

Dippin Dots: The game.

2

u/Xazen Oct 05 '10

Just got a perfectly spherical orbit that does nothing but overlap itself.

...I can't turn it off now.

2

u/[deleted] Oct 06 '10

So uh, making a super massive planet and then creating a proto disk is kinda cool. http://i.imgur.com/ro1zy.png

1

u/[deleted] Oct 06 '10

Lol. Make a super massive planet in bottom left corner, then bottom right (which sends them flying towards eachother, off the sides of the screens), then repeat in the top corners. Then make a proto disk. http://imgur.com/17AMb.png

2

u/fatnino Oct 06 '10 edited Oct 06 '10

here's some hot unprotected underage proto disk sex

http://i.imgur.com/EOsbw.png

EDIT: after some fumbling, the centers met http://i.imgur.com/Qq72I.png

2

u/[deleted] Oct 06 '10 edited Oct 06 '10

This was from Generate proto disk (slow start) (bottom left button), on the first try.

http://imgur.com/t7pUC.png

It's a stable trinary star-system, plus one lucky comet (note total of 15 particles, most off screen.)

Nature's imagination is greater than my imagination, even in simulation.


EDIT after a few hours, the comet returned... this time not so lucky: http://imgur.com/74hnL.png

Note the curve to the right. Looks like space junk off screen is in orbit, and the net mass of the system, as a whole, is at the center of that curve. That may well be a necessary consequence of the starting conditions of the initial "proto disk", so that it will always occur for all such systems.

2

u/[deleted] Oct 06 '10

For some reason when I saw this link, I read it as "Gravy simulation." now that would be impressive.

2

u/Botunda Oct 06 '10 edited Oct 06 '10

Dude, make this a game now. MOre so than it is. Add a way to pan around it, color the planets and trails. I will give you $20 seed money right now. Do this please, because I've forgotten this:

In the book, Sagan related his thoughts on a deeper meaning of the photograph: wikipedia

From this distant vantage point, the Earth might not seem of particular interest. But for us, it's different. Consider again that dot. That's here, that's home, that's us. On it everyone you love, everyone you know, everyone you ever heard of, every human being who ever was, lived out their lives. The aggregate of our joy and suffering, thousands of confident religions, ideologies, and economic doctrines, every hunter and forager, every hero and coward, every creator and destroyer of civilization, every king and peasant, every young couple in love, every mother and father, hopeful child, inventor and explorer, every teacher of morals, every corrupt politician, every "superstar," every "supreme leader," every saint and sinner in the history of our species lived there – on a mote of dust suspended in a sunbeam. The Earth is a very small stage in a vast cosmic arena. Think of the rivers of blood spilled by all those generals and emperors so that, in glory and triumph, they could become the momentary masters of a fraction of a dot. Think of the endless cruelties visited by the inhabitants of one corner of this pixel on the scarcely distinguishable inhabitants of some other corner, how frequent their misunderstandings, how eager they are to kill one another, how fervent their hatreds. Our posturings, our imagined self-importance, the delusion that we have some privileged position in the Universe, are challenged by this point of pale light. Our planet is a lonely speck in the great enveloping cosmic dark. In our obscurity, in all this vastness, there is no hint that help will come from elsewhere to save us from ourselves. The Earth is the only world known so far to harbor life. There is nowhere else, at least in the near future, to which our species could migrate. Visit, yes. Settle, not yet. Like it or not, for the moment the Earth is where we make our stand. It has been said that astronomy is a humbling and character-building experience. There is perhaps no better demonstration of the folly of human conceits than this distant image of our tiny world. To me, it underscores our responsibility to deal more kindly with one another, and to preserve and cherish the pale blue dot, the only home we've ever known.

This hits home on a could be imaginable scale.

edit: stupid me formatting

3

u/DanDixon Oct 06 '10

I already made it and keep improving it; it's called Universe Sandbox. The game is full 3D gravity simulator and uses real units. You can color the planets, fade the trails, or blow them up.

Download or learn more: http://universesandbox.com/

→ More replies (1)

2

u/EngineerDIVO Oct 06 '10

I read this as "Gravy simulation".

2

u/D__ Oct 06 '10

This is the most fun I had setting up slingshot maneuvers since Orbiter.

2

u/[deleted] Oct 07 '10

haha...if you enter in a negative value, it creates an object that just repels everything else

3

u/cridenour Oct 05 '10

DAE say NOM every time a larger object ate up smaller ones?

1

u/mrspaznout Oct 06 '10

i do more of an "awwwwwwwwww ooohhhhh" when they get close then "awwwwwwwwww booooom" or just "bloop" when they hit.

1

u/[deleted] Oct 05 '10

Mind sharing the source code?

1

u/alexrixhardson Oct 05 '10

Amazing! I just spend 2 hours of playing this and it felt like 5 seconds...

1

u/ButtonFury Oct 05 '10

I could spend hours trying to construct a galaxy. Hmm....

1

u/Adamsky Oct 05 '10

I'm gonna loose a few hours with this one, very good. I like the slow orbits.

1

u/actionscripted Oct 05 '10

Can't control-click on a Mac -- triggers the context menu. :(

1

u/chikara Oct 05 '10

Beautiful. Thanks.

1

u/nrs5813 Oct 05 '10

I just spent over an hour playing with this in class. Very nice.

1

u/smallcrummy Oct 05 '10

I got lots of binary pairs, circling each other OR sharing orbits and taking turns overtaking/weaving around the other. So cool!

1

u/[deleted] Oct 05 '10

I lost almost 1 hour there. amazing

1

u/[deleted] Oct 05 '10

I made orbit!

1

u/mjrice Oct 06 '10

Am I the only one who created a pretty little solar system, then dropped a few red giants in the middle of it when I got bored? Take that, galileo.

1

u/karoop Oct 06 '10

Lost half an hour of sleep because of that :/ Here's my last stable system.

1

u/VampireInBlack Oct 06 '10

Ok, I have been playing with this for hours. You get an up vote.

1

u/mrspaznout Oct 06 '10

is there a way to pause it set everything up then see what happens?

1

u/Man4msouth Oct 06 '10

Very nice sir!!

1

u/Toukishru Oct 06 '10

Made my own orbit ;D

1

u/JRose11 Oct 06 '10

I love this too much. orbit

1

u/[deleted] Oct 06 '10

Yay! I have a large star, a large planet, and a moon!!! http://imgur.com/UNILG.png

1

u/[deleted] Oct 06 '10

Ooh nice, reminds me of doing something similar a few years ago for school. Had to make a barnes-hut quadtree based gravity simulator, it was bunches of fun o:

1

u/tscharf Oct 06 '10

manually adding many zeros to the mass crushes the universe into a singularity. This is fun.

1

u/chowmeiniac Oct 06 '10
  1. Shoot as many small, tiny, mediums as far off the screen as possible. (Like light years away)

  2. Manually adjust mass to a fairly large size 1000000000 huge.

  3. Paths on.

  4. Click to create super massive black hole to end the universe

1

u/[deleted] Oct 06 '10

It's ridiculous how much fun this is! Thank you.

1

u/Wehoe55 Oct 06 '10

Thank you. I can't wait to show it to my young children. It'll be a wonderful introduction to physics and gravity for them.

1

u/iPlunder Oct 06 '10

I love simple, fun physics shit like this. Keep it up. Good work.

1

u/counterplex Oct 06 '10

I made a twin star system and then flew some comets through it. Made for some interesting paths.

1

u/DoctorThunder Oct 06 '10

It's fun to create an ultramassive object by clicking an OMFG size one for a few seconds then pelting things at it. That, or after it's established, just click a proto-dish.

1

u/oh_the_humanity Oct 06 '10

I just wasted an hour in a gravity simulation, it was cool.

1

u/washburnmav Oct 06 '10
  1. Check 'Paths'

  2. Generate Proto Disk

  3. ???

  4. PROFIT!!!

1

u/trashacount12345 Oct 06 '10

Thank you so much for including (flash) in the title. I wish everyone would do this.

1

u/[deleted] Oct 06 '10

Set the mass to a negative number and got this...

http://imgur.com/qaY6r.png

1

u/fall_ark Oct 06 '10

I planted some and they're actually quite amazing...also seems to resist collision when their own mass is large(small?) enough.

1

u/Feltasneezecoming Oct 06 '10

Cool! they repel!

1

u/JJ1230 Oct 06 '10 edited Oct 06 '10

So far so good with this orbit... http://imgur.com/YBGg1

Tomorrow I'll post the full one after its done

EDIT - Here it is...http://imgur.com/pG3J2.jpg

1

u/TwoCat Oct 06 '10

Holy fucking shit theres so much science here! fucking science bitch

1

u/[deleted] Oct 06 '10

somebody make an earth with a moon orbiting a sun

1

u/atimholt Oct 06 '10

Man, I got stuck for like an hour on this thing.

1

u/listos Oct 06 '10

this is so cool. I could just sit here for hours watching a tiny orbit around an "OMFG"

1

u/Slarti Oct 06 '10

I just glanced at the title and thought it said "Gravy simulation(flash)" I'm really disapointed now.

1

u/mindbear Oct 06 '10

Cool, particles fuse when they collide.

1

u/TheDrBrian Oct 06 '10

With all the time people are spending on this could it be the new minecraft?

Anyway I managed to get 3 stable orbits with 1 'planet' spinning anticlockwise. Very pretty

http://imgur.com/7bycD.jpg

1

u/[deleted] Oct 06 '10

I find that real life is also a good gravity simulator. Very realistic