Pulsar4xDevs / Pulsar4x

A Fan work recreation of Aurora4x in C#
Other
159 stars 68 forks source link

Orbital Improvements #223

Open se5a opened 5 years ago

se5a commented 5 years ago

Some improvements that need doing to the current orbital code:

See #224 for bugs/critical stuff.

se5a commented 5 years ago

Changing to storing radians wasn't as painful as I initially thought, I was cleaver and changed the name of existing properties to make it obvious that it returned a value in degrees. I then added new properties to store the values in radians. I then changed the existing properties to convert on get/set from/to the new properties. I then checked the Angle.ToRadians conversion for usages and removed unnecessary conversions.

The constructor on OrbitDBs are still mostly using AU, that will need cleaning up at some point, but I got rid of 70 or so conversions, many of which happened N times a physics frame, and a couple that happened N times a graphics frame. (N being the number of orbiting entities).

I've done a similar thing for distances, but not yet checked the conversion and removed unnecessary conversions yet.

22367rh commented 4 years ago

297 Covers the orbital logic split into a separate project.