Gravitas banner

Gravitas

10 devlogs
20h 49m 22s

Physics simulation for N-body and Hohmann transfer.

This project uses AI

used chatgpt for code validation (just to confirm that my code wasnt violating the laws of physics), copilot for autocompletion

grumpymarie

small css fixes, and replaced filler text with description

Attachment
0
grumpymarie

IM DONE WITH ANIMATIONSSSS

0
grumpymarie

made satellite mode

0
grumpymarie

UGH OKIE
WE HAVE SMTHING
tHIS WAS SM EASIER THAN NBODY

Attachment
Attachment
0
grumpymarie

wrote index.html
fixed font issues in nbody.html
ig did smthing on the css
will update later

0
grumpymarie

will write this properly. I promise. rn I need to lock innn

Attachment
0
grumpymarie

kinda in flow state so will update later alr???

0
grumpymarie

π€πππžπ π‘πŠ4 𝐒𝐧𝐭𝐞𝐠𝐫𝐚𝐭𝐒𝐨𝐧 𝐚𝐧𝐝 𝐜𝐚𝐦𝐞𝐫𝐚 𝐜𝐨𝐧𝐭𝐫𝐨π₯𝐬!!
β€Žβ€Žβ€Žβ€Ž

  • Euler was causing energy drift so added replaced with fixed step RK4.
  • getDerivs() temporarily overwrites positions so accel() can be evaluated at intermediate stages, then it restores them. (this took me so long to figure out… the bodies were teleporting because I forgot to restore.)
  • you couldnt see outer planets before, so I added cursor anchored zoom and pan
    β€Žβ€Ž
    so now…, you can see all the planets (and bodies in the future) cuz I added zoom and pan.
    orbits are now stable long term!!
    β€Žβ€Žβ€Ž
    TODO:
  • add gravitational softening
  • add new bodies on click
  • add trails behind bodies
Attachment
Attachment
0
grumpymarie

WE NOW HAVE 5 BODIES!!! AND THEY MOSTLY OBEY THE LAWS OF PHYSICS!!
β€Ž

  • added Sun, Mercury, Venus, Mars and Earth.
  • labeled bodies
  • gravity calculated b.w every pair of bodies
  • set G = 4π², stable orbits.
  • added integration using Euler method, so velocity and position update by (dt).
  • real time to sim. time scaling (1 sec = 0.05yrs in sim. time)
  • background changes (stars)
  • sim. time in corner
    β€Ž
    basically we got more planets, stable orbits, with gravity working for multiple bodies anddd speeds look realistic relative to each planet.
    β€Ž
    TODO:
  • SWITCH TO BETTER INTEGRATION METHOD FOR ENERGY STABILITY (RK4??)
  • add trails behind bodies (so basically orbital trails)
  • update and add back the navbar that I removed in this version
    β€Ž
    ramblings..
    I have a rough idea on how to add the bodies (like the user adds the bodies… the acutal point of this sim) , at least the research is done. ive also kinda figured out how to implement binary stars so… idk. anyway lot left to do but in theory, at least, I know what to do!!
Attachment
0
grumpymarie

ᴍᴀᴅᴇ Κ™ΚŸα΄œα΄‡ ᴅᴏᴛ ɒᴏ α΄‘Κœα΄‡α΄‡α΄‡α΄‡ α΄€Κ€α΄α΄œΙ΄α΄… Κα΄‡ΚŸΚŸα΄α΄‘ α΄…α΄α΄›β€Žβ€Žβ€Žβ€Ž
β€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Žβ€Ž
set up canvas and render loop now works!!
then added two bodies:

  • sun in the middle
  • small blue body orbiting it with sideways velocity.
Attachment
0