something happened: either someone embedded this in an iFrame for some reason (why?!) or you don't have JS enabled
timestep:
mouse:
kinematics:
thermodynamics:
rendering mode:
heatmap mode:
heatmap gain:
enable links?
preset:
page color:
, text color:
This is a gravity simulation with newtonian gravity and repulsion. The particle radius for repulsion increases with heat, because of thermodynamics, and heat is generated by friction. This allows fairly accurate simulation of planets.
The initial conditions are random particles, spread evenly throughout space. Very simple.
Each particle attracts each other, via a force given by F = Gm1m2/r2, where F is the force inwards, G is the gravitational constant, m1 and m2 are masses, and r is the distance. This formula is calculated over every pair of particles.
Whenever two particles are near each other, two things happen. The first is a collision, computed as a force inversely proportional to the distance between them. The second is friction, where particles generate an amount of heat proportional to the square root of the difference in speed. The resulting heat actually makes the particles expand a little, through thermal expansion. You can actually explode a planet by overheating it because of this. Note that the particles don't actually slow down (and nor do they spin).
Related to heat, each particle loses heat over time to space itself, repersenting blackbody radiation. This is why planets don't get infinitley hot, explode, and then break the simulation.
All particles have the ability to link to other particles if they are in the right temperature range. If they get too hot or far, the link breaks, and if they're too cold, they can't form a link. Only at a certian range will links form. Links are disabled by default, as they are not performant at all. Links also increase in stiffness over time, with a stiffening proportional to temperature. Also, each particle can have up to 6 links, and no more. However, 6 should be enough links given a hexagonal arrangement of particles, which is what usually forms. The temperature ranges at which links form and break are expanded based on pressure.
If you want to know exactly how it works, I didn’t minify or obsfucate it, so just use a console (if you're on mobile, use eruda). Please note that if you are using the google sites version, there are a lot of extra layers piled on top of the actual simulation from google sites.
Also, some caveats: this is 2d, meaning some things simply can't be simulated and wave propagation through planets is different, although the law of gravity is still 1/r2 to allow stable orbits. This also uses verlet and not RK4 (aka it's not too stable), and the parameters aren't actually based off any IRL measurments. Actually, gravity here isn't quite 1/r2: it's (by default) 1/r2+ε2, where ε is the softening constant (default equal to 0.5), used to avoid particles exploding into infinity. However, this gets close to normal gravity very fast, and so orbits still exist.
versions 3 and below: physics.interface.bugfix.possibleWithBugfix
versions 4 and above: fundamentalChange.newThing.tweak.bugfix
4-alpha.3.5: literally twice as fast (well, not exactly, but very close), but total spring constant is removed (sadly), also you can now run code when setting a variable (any code) but since this isn't a server I don't think this'll cause issues and it helps with modding the google sites version (augh, looks like google sites really doesn't like html)
4-alpha.3.4: dark matter and gas preset added, flat planet preset added, scaling for default fixed, gas particles (the outermost ones) from disk and star don't link, and particles can have colors now (view: color, although temperature isn' accounted for) or not collide as hard (ex. sand and gas in disk and star)
4-alpha.3.3: save/load isn't Base64 encoded, also if a save has links, links will be enabled, along with a lot of other save/load improvments (ex.text in the save/load box is now very small), potentioal energy is removed for many reasons. also, the mouse radius is shown, along with scales for length, temperature, and time.
4-alpha.3.2: a save/load feature (particles only), so you can finally say you "noted down a whole planetary system". note: the savecodes are REALLY LONG. also they're just encoded in Base64, and the link pressure coefficicent thing is now way lower, softening is improves, potentioal energy calculation was removed for many reasons
4-alpha.3.1: a "preset" for the initialization function, reset keeps camera, there's a crosshair, the link thermal stiffening thing can be controlled, uhh yeah. oh yeah and you can pin particles and dragging won’t scroll the whole page on mobile. particles can also have their collisions disabled
4-alpha.3: no longer are you confined to a innerWidth - 15 × innerHeight - 140 space: you can now zoom in, zoom out, and pan around! this means less planet shredding, sadly, but no worries, as the scaling for the size increase and decrease is now ×1.25 allowing more percision! note that arrow, wasd, and scroll won't work to pan or zoom, and you have to scroll on the x axis to zoom when "zoom" is clicked for mouse interaction. also, links get thermally stronger under pressure, so that your iron cores can be rocky at 1,000K if you want. obviously, there must be a new control to reset the camera too. the other reset button will reset the camera too, let me know if this should be changed. by the way the way the code is now MORE THAN 1000 LINES AAA-
4-alpha.2.2: speed up particles tool, really cool down particles button, slow down particles button, gravitational softening, just some nice features and less randomly exploding planets. oh also the font should now work anywhere
4-alpha.2.1: links are way more performant, being calculated on the particles. before, links were seperate (each pair had to find a link in a haystack of 3,000 other links), but now, they only need to find links in arrays of at max 6. also, you can now change the link per particle limit. also, you can manually create and destroy links eithout heating and cooling.
4-alpha.2: links now exist between particles that are hot and next to eachother! of course, this warrents new views for links and an option to disable them because of how laggy they are. also you can now change a lot of things without inspect.
4-alpha.1: using p3 color space if possible, potential kenetic and mechanical energy fixed a bit, loopover accounting disabled
4-alpha.0: probably the biggest update yet. using Futura now, loopovers are accounted for (no longer shall the planets be shredded by the edge), collisions have been reworked to actually work, thermal but no glow exists (phew), gravity is actually 1/r^2 (used to be 1/r because of a bug), planetary differentiation is shown, and a slightly more performant (somehow)
3.5: Comic Sans instead of Futura or Chalkboard SE, but this time by downloading the font
3.1: realized that Chalkboard SE is a rare font and switched to Futura
3.0: repulsion is now stronger at lower distances
2.27: fixed FPS
2.26: more explanation, reset button
2.25: FPS counter, better changelog spacing
2.24: the timestep monitor is back from mysterious disappearance
2.23: canvas now renders properly in full screen
2.22: fixed typo
2.21: page customization
2.20: way, way better resolution
2.19: better mouse circle, buttons to change interaction radius, most buttons not needed
2.18: instant centering
2.17: fixed: no warparound on left and upper edges
2.16: an old bug fixed: canvas wraparound lines (use modulo instead of if-set)
2.15: new mouse modes: rotate. changelog format specified.
2.14: fixed heat conduction (the exponent was the wrong way) and very hot particles in fiery heatmap, increased mouse strength for heat effects, added optgroups for mouse setting
2.13: fixed: display text does not work on firey mode
2.12: new heatmap mode: firey
2.11: fixed: density and size do not account for thermal expansion
2.10: heatmap dropdown, not sure what to put there, updated version number in title
2.9: inflate button, longer timestep slider
2.8: new rendering modes: size and density, new render categories: constants and miscellaneous
2.7: new rendering mode: internal pressure (pressure renamed to extrnal pressure)
2.6: more rendering modes: pressure and friction
2.5: resized canvas to fit buttons, heat glow only on thermal
2.4: added changelog
2.3: more rendering modes
2.2: thermal data has colors
2.1: data rendering, heat glow
2.0: thermodynamics
1.0: canvas wrap-around and translucent blue particles