thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Decoupled Orbital Period and Distance #98

Closed thombruce closed 9 months ago

thombruce commented 9 months ago

So, for static gravitational bodies (stars, planets, moons), I think we want do decouple the orbital period from the visible radius of the orbit.

  1. The orbital period should appear to be accurate wrt the in-game clock (currently real time); this is already the case, but the orbits are very, very tiny
  2. The visible radii of the orbits (that is, what the orbits actually "look like" to the player) should probably not be true to life scale

So, how do we achieve this?

My initial thought is to first hardcode the real life values of the orbits; this is already done for most values apart from the radii.

For display, and to make the world more traversable, there should be a scaling factor applied before drawing each object at its position on the ellipse of its orbit... That's pretty straightforward - you just reduce the radius (or semimajor axis) of the ellipse by some factor.

For orbital timing however... we have to ignore that rescaling.

So the object should behave as if it were one distance from the star (or planet, or whatever it's orbiting) but look like it were a different distance.

That being the case, I figure we might be able to...

  1. Hardcode the values
  2. Calculate the orbital position for any given tick of the clock
  3. Rescale that position for rendering in the world (simply by moving it closer to the star by some constant factor)
  4. Et voila! The object behaves like it is one distance from the star, but looks like it is much closer.

Concerns?

Not many. Though the scaling that is applied needs to be... multiplicative, right? It can't be a root? For example, divide the distance by N and all distances from the centre to the edges of the ellipse will be adjusted proportionally with no distortion to the shape of the ellipse (important)... And that's not true for Nth root, because the scaling then is exponential. So... multiplicative scaling.

With that, the proposed solution seems sound.