Author Topic: CPA Timing  (Read 2339 times)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
CPA Timing
« on: May 14, 2013, 06:07:08 pm »
I'm looking at the CPA code at the moment (related to an expansion plot) and am rejiggering some very old timing code to be a bit more malleable (the current timings are fine for the normal case, just so I can tweak for plots, etc) and due to how the randomization is done I'm not 100% sure what the practical results of what I'm seeing would be.  So I wanted to check if my guess is actually what y'all generally see so I don't accidentally change the timing during the refactor.

From the code I can see that:

On Diff 7, the minimum time to the first CPA (and the minimum time between CPAs) is 3 hours, 12 minutes.

On Diff 8, it's 2 hours, 48 minutes.

On Diff 9, it's 2 hours, 24 minutes.

On Diff 10, it's 2 hours.

But that's only the theoretical minimum because once that threshold is reached it actually just gets to make a random roll every 90 seconds from (minimum) to (minimum*4), and if the time since the last CPA (or the beginning of the game, if no CPA has launched) is greater than the roll it announces the CPA (which launches when that visible timer runs out).

So on if the first roll is exactly on the minimum threshold there's actually zero chance of it announcing; exactly 90 seconds later it would get a second roll with some chance.  On Diff 7 it would be rolling a number between 11520 and 46080, and would only proceed if the result were less than 11610.  Or more simply it's rolling 0 to 34560 and hoping for less than 90.  That's roughly a 0.26% chance, I believe.  If it misses that, 90 seconds later it rolls again with a 0.52% chance, etc.

On diff 7, your cumulative chance (from the perspective of "before I make the first roll") of having a cpa is roughly 50% about 36 minutes after reaching the minimum, or a total interval of 3 hours, 48 minutes.
It's roughly 75% at 49 minutes after reaching the minimum, or a total interval of very nearly 4 hours.
It's roughly 90% at 63 minutes after the minimum, or a total interval of 4 hours, 15 minutes.

Those numbers squeeze closer together for the higher difficulties as the denominator on the rolls goes down (34560 on diff 7, 21600 on diff 10, linearly interpolated between I believe).


Anyway, my questions are:

1) Does this accurately describe what you're observing in the game?

2) Does this level of variation feel ok?  Would you prefer it to be less random?  More random?  (not that I'd really be ok with making it all that more, but may as well know what people think).
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline chemical_art

  • Core Member Mark IV
  • *****
  • Posts: 3,952
  • Fabulous
Re: CPA Timing
« Reply #1 on: May 14, 2013, 06:28:39 pm »
If the strength of a cpa scales with time neatly, i think the variation is fine. I've had times where i wishesd a cpa came earlier and others when it came later, so for me in practice.it is fine.
Life is short. Have fun.

Offline Hearteater

  • Core Member
  • *****
  • Posts: 2,334
Re: CPA Timing
« Reply #2 on: May 14, 2013, 07:04:06 pm »
I don't believe they scale with time, since you can calculate the exact number of ships that will be released based on AIP if I recall correctly.

As for spacing, that sounds about right from what I've experienced.  Just as a note on CPA spacing: I don't think I'd really want them much closer than 2 hours apart.  I'd rather a bigger CPA than closer together.  A bigger CPA can kill me.  Closely spaced CPAs will just be annoying.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: CPA Timing
« Reply #3 on: May 14, 2013, 07:19:46 pm »
I don't believe they scale with time
Right, the size of the CPA is not directly related to the interval.  The "alternate minimum AIP" rule is based on the game clock at the time of the CPA's announcement, but has no relation at all to the time of the previous CPA.

So if it misses a lot of these rolls it's mostly and advantage for the player (at least more time to work), and if it somehow nails the first roll it just hits the player earlier.

Quote
Just as a note on CPA spacing: I don't think I'd really want them much closer than 2 hours apart.  I'd rather a bigger CPA than closer together.  A bigger CPA can kill me.  Closely spaced CPAs will just be annoying.
True, since the player's time to recover from any non-fatal CPA is short enough that the next one would just get the same reception (and result), most likely. 

Unless the previous one took out some golems or otherwise soaked up some irreplaceables or caused a lot of AIP (either from warheads or killing stuff that causes AIP on death), etc.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline LordSloth

  • Sr. Member Mark III
  • ****
  • Posts: 430
Re: CPA Timing
« Reply #4 on: May 14, 2013, 07:41:59 pm »
On Diff 7, the minimum time to the first CPA (and the minimum time between CPAs) is 3 hours, 12 minutes.

So on if the first roll is exactly on the minimum threshold there's actually zero chance of it announcing; exactly 90 seconds later it would get a second roll with some chance.  On Diff 7 it would be rolling a number between 11520 and 46080, and would only proceed if the result were less than 11610.  Or more simply it's rolling 0 to 34560 and hoping for less than 90.  That's roughly a 0.26% chance, I believe.  If it misses that, 90 seconds later it rolls again with a 0.52% chance, etc.

On diff 7, your cumulative chance (from the perspective of "before I make the first roll") of having a cpa is roughly 50% about 36 minutes after reaching the minimum, or a total interval of 3 hours, 48 minutes.
It's roughly 75% at 49 minutes after reaching the minimum, or a total interval of very nearly 4 hours.
It's roughly 90% at 63 minutes after the minimum, or a total interval of 4 hours, 15 minutes.

Those numbers squeeze closer together for the higher difficulties as the denominator on the rolls goes down (34560 on diff 7, 21600 on diff 10, linearly interpolated between I believe).

Anyway, my questions are:

1) Does this accurately describe what you're observing in the game?

2) Does this level of variation feel ok?  Would you prefer it to be less random?  More random?  (not that I'd really be ok with making it all that more, but may as well know what people think).

1). For the life of me, I cannot remember a single time I've gotten my first 7/7 CPA before hour four. I expect CPAs to regularly trigger at 4:20, with about ten minutes leeway in either direction. Anything before 4:10 or after 4:30 and I'm surprised, though 4:40 feels understandable while I'd do a doubletake at a 4:00 CPA. This is not commentary on what the timings should be but what my general impressions and expectations from experience are.

2). As the AIP and CPA wave sizes are tied together, the level of variation feels odd but fair. With last weeks level of counterattack guard posts, my fourth hour was fairly limited in what I would -try- to do. I don't actually know what number of Warp Counterattack guard posts to expect. In the past I wasn't playing with a Spire Hammer and Starfleet Commander combo, so while I had to take measures, I didn't really care about popping a WC GP. Destroyers, Cruisers, Battleships made me worry a bit more about things synching up.

As an aside, the four starships that the Starfleet Commander gets... do they cut into the fleetship budget of each wave, or are they in addition? I feel this AI has type has got an unintended boost on the old wave power scale. Dealing only with waves:
Vanilla -> Old Starfleet Commander -> Sledgehammer -> Stealth Master -> New Starfleet Commander -> Hard AIs.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: CPA Timing
« Reply #5 on: May 14, 2013, 07:48:10 pm »
1). For the life of me, I cannot remember a single time I've gotten my first 7/7 CPA before hour four. I expect CPAs to regularly trigger at 4:20, with about ten minutes leeway in either direction. Anything before 4:10 or after 4:30 and I'm surprised, though 4:40 feels understandable while I'd do a doubletake at a 4:00 CPA. This is not commentary on what the timings should be but what my general impressions and expectations from experience are.
Interesting that the distribution would be so tight.

In any event what I'm doing is actually retaining exactly the same math (if I got it right -- I should not be trusted with math) but it computes the target time (using the series of roll, if you fail +90 and try again) and then saves it rather than rolling random every 90 seconds.  That way if you save before the announcement and then reload it won't potentially announce at a different time.

Quote
As an aside, the four starships that the Starfleet Commander gets... do they cut into the fleetship budget of each wave, or are they in addition? I feel this AI has type has got an unintended boost on the old wave power scale. Dealing only with waves:
Vanilla -> Old Starfleet Commander -> Sledgehammer -> Stealth Master -> New Starfleet Commander -> Hard AIs.
The starships are straight bonus on top of the waves.  Same with the spire hammer stuff.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: CPA Timing
« Reply #6 on: May 15, 2013, 03:09:25 am »
Anyway, my questions are:

1) Does this accurately describe what you're observing in the game?

2) Does this level of variation feel ok?  Would you prefer it to be less random?  More random?  (not that I'd really be ok with making it all that more, but may as well know what people think).
1. Yes it does. I always get my first CPA at about 2 hours 5 minutes - 2 hours 10 minutes. 10/10 difficulty of course.
2. Seems good to me.
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!