Skip to content

Instantly share code, notes, and snippets.

@PtrMan
Last active June 17, 2024 07:23
Show Gist options
  • Save PtrMan/52f3ede7dbcc6041b53b9463746875f3 to your computer and use it in GitHub Desktop.
Save PtrMan/52f3ede7dbcc6041b53b9463746875f3 to your computer and use it in GitHub Desktop.

This article gives information about mathematical details which come up when one tries to build a realistic space simulation game with realistic physics. Focus here is on physics of various kinds, not graphics or networking because these topics are well treated at other places.

Example code is given in C#, because the language is high level and easy to understand and fast enoguh for copy and paste.

How to compute the thrust of multiple thrusters to fullfill the goal to accelerate in a direction or increase the rotational velocity?

This is a problem of mathematical optimization, which is related to operational research. One good method is to use optimization in the form of https://en.wikipedia.org/wiki/Linear_programming , more specifically the simplex algorithm .

TODO< deeper explaination how it relates to thrust vectors and the target vector > .

TODO< add basic implementation in C# >.

How to find the timing and strenght of acceleration for the goal of a given spatial position together with the velocity?

This is another optimization problem which may be solved with different algorithms.

One simple algorithm is to use a variant of rapidly exploring random tree (RRT). Important here is that the vertices in the tree correspond to a tuple of (velocity, position) and possibly other important properties. Not just the location alone!

TODO< explain further with pseudo code >

ref https://www.ieee-jas.net/en/article/doi/10.1109/JAS.2021.1004252

how to control acceleration of missile to hit a moving target?

https://en.m.wikipedia.org/wiki/Proportional_navigation

How to compute the direction where to shoot to hit a moving target?

https://github.com/PtrMan/gameProjectPsiDelta/blob/master/scripts/aiUtils.gd#L9-L45

Planets : How to generate geometry of planets?

https://publications.scss.tcd.ie/theses/diss/2010/TCD-SCSS-DISSERTATION-2010-067.pdf

Physics > compute tidal heating of planet

see https://en.wikipedia.org/wiki/Tidal_heating

Physics > compute tidal locking

https://en.wikipedia.org/wiki/Tidal_locking

Physics > thermodynamics > how to compute luminosity of a star?

https://www.omnicalculator.com/physics/luminosity

Rendering : Black holes : how to render gravitational distortion of black holes?

https://forum.spaceengine.org/viewtopic.php?t=458&start=15#p36682
https://forum.spaceengine.org/viewtopic.php?t=79&start=780

Physics > thermodynamics > how to calculate color of black body?

https://astronomy.stackexchange.com/questions/39994/what-is-the-rgb-curve-for-blackbodies

Physics > chemistry > how to compute if there is a ocean on a planet with a given temperature and pressure (?)?

use of https://en.wikipedia.org/wiki/Clausius%E2%80%93Clapeyron_relation ?

see https://forum.spaceengine.org/viewtopic.php?t=350#p31060

Physics > how to plan trajectory

https://www.youtube.com/watch?v=dhYqflvJMXc

astronomy > compute height of tidal waves

https://forum.spaceengine.org/viewtopic.php?t=531#p29236

@PtrMan
Copy link
Author

PtrMan commented Jan 22, 2024

https://forum.spaceengine.org/viewtopic.php?t=311 various sourcecode without license

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment