Author Topic: Simplifying turn calculations: orbital elements  (Read 259 times)

0 Members and 1 Guest are viewing this topic.

Offline nitrah

  • Leading Rate
  • *
  • n
  • Posts: 5
Simplifying turn calculations: orbital elements
« on: June 12, 2018, 11:51:06 AM »
I am curious how the locations of the planets and other orbiting objects are calculated under the hood.

I suspect (but could be wrong) that you are calculating X/Y locations for every object every time you hit the 5 day cycle.  I suspect this is the case just by the amount of churn which hits every 5 days and how it drastically increases as the game goes on.

If this is the case, I would humbly suggest you consider looking into changing the calculation process to using a modified orbital elements method of storing the location.

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

Because the game is two dimensional and you dont simulate orbital eccentricity, you could use semi major axis, starting true (or mean) anomaly, the amount of delta mean anomaly per 5 day period, and the date to store all X/Y information.  The only variable which changes per pulse is the date.  Then, you would only need to convert to X&Y if the player is looking at a specific system or if a player or NPR has a ship with orders to go to the orbital body.

I suspect this would significantly increase turn processing time.

Thanks
 

Offline Steve Walmsley

  • Aurora Designer
  • Admiral of the Fleet
  • S
  • Posts: 6869
  • Thanked: 1501 times
    • http://www.starfireassistant.com
Re: Simplifying turn calculations: orbital elements
« Reply #1 on: June 12, 2018, 06:30:47 PM »
Orbital movement is done by calculating the change in bearing based on orbital period and passage of time and recalculates the new location based on distance and bearing from the sStar. What takes time is loading and saving from the DB and checking for orbiting fleets, etc.

For C# Aurora, there is no loading or saving during turn execution and fleets are flagged as requiring orbital movement when they enter orbit. I checked my current campaign (with 500 systems and 60,000 system bodies) and with asteroid orbits on, orbital movement dropped from three minutes to 0.1 seconds.

 

Offline JacenHan

  • Lt. Commander
  • ********
  • Posts: 261
  • Thanked: 23 times
Re: Simplifying turn calculations: orbital elements
« Reply #2 on: June 12, 2018, 08:12:24 PM »
Out of interest, how long did a Colonial Wars construction increment as a whole typically take in VB6?
 

Offline QuakeIV

  • Registered
  • Lt. Commander
  • ********
  • Posts: 226
  • Thanked: 14 times
Re: Simplifying turn calculations: orbital elements
« Reply #3 on: June 12, 2018, 09:15:47 PM »
I have had games where there are tightly orbiting planets, and the low granularity of orbital movement (it seemed to hit every construction cycle) could actually warp planets tactically significant distances and disrupt engagements between ships and oribtal defenses.  Is there any intention to alter this?
 

Offline Steve Walmsley

  • Aurora Designer
  • Admiral of the Fleet
  • S
  • Posts: 6869
  • Thanked: 1501 times
    • http://www.starfireassistant.com
Re: Simplifying turn calculations: orbital elements
« Reply #4 on: June 13, 2018, 04:47:26 AM »
I have had games where there are tightly orbiting planets, and the low granularity of orbital movement (it seemed to hit every construction cycle) could actually warp planets tactically significant distances and disrupt engagements between ships and oribtal defenses.  Is there any intention to alter this?

I could move orbital movement from construction phase to movement phase - depends if the game play gain is worth the performance hit. Although on current performance, it would probably be fine.
 

Offline Steve Walmsley

  • Aurora Designer
  • Admiral of the Fleet
  • S
  • Posts: 6869
  • Thanked: 1501 times
    • http://www.starfireassistant.com
Re: Simplifying turn calculations: orbital elements
« Reply #5 on: June 13, 2018, 04:48:32 AM »
Out of interest, how long did a Colonial Wars construction increment as a whole typically take in VB6?

A while - can remember exactly but several minutes. I had asteroid orbital movement off and generally sensors off in Sol (unless there was potential for combat).
 

Offline QuakeIV

  • Registered
  • Lt. Commander
  • ********
  • Posts: 226
  • Thanked: 14 times
Re: Simplifying turn calculations: orbital elements
« Reply #6 on: June 13, 2018, 08:48:39 PM »
I was getting like 15mkm hops, it would help a lot if you were to do that.
 

Offline DEEPenergy

  • Able Ordinary Rate
  • Posts: 3
  • Thanked: 1 times
Re: Simplifying turn calculations: orbital elements
« Reply #7 on: June 13, 2018, 10:29:41 PM »
One reason I can think to move orbital movement from the construction phase to the movement phase - correct me if I'm wrong - if you're assaulting a planet with ground troops and ships a construction cycle could occur midway in your assault, causing the planet to suddenly "jump" a million miles away from your bombarding ships.
 
The following users thanked this post: JacenHan

Offline QuakeIV

  • Registered
  • Lt. Commander
  • ********
  • Posts: 226
  • Thanked: 14 times
Re: Simplifying turn calculations: orbital elements
« Reply #8 on: June 13, 2018, 11:01:54 PM »
Yes, thats exactly what I'm on about.  It isn't particularly acute in the solar system or normal sized star system, but closer to say mercury's orbit, if you have a lot of planets at that general altitude, it can be really serious.
 

Offline Steve Walmsley

  • Aurora Designer
  • Admiral of the Fleet
  • S
  • Posts: 6869
  • Thanked: 1501 times
    • http://www.starfireassistant.com
Re: Simplifying turn calculations: orbital elements
« Reply #9 on: June 14, 2018, 07:13:06 AM »
No problem with that in principle. Maybe I should restrict to any phase of one hour or more, rather than going to 5 second increments.
 

 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52