Author Topic: Request to Keith - CPA Strategic Reserve Spawns  (Read 6973 times)

Offline Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Request to Keith - CPA Strategic Reserve Spawns
« on: November 28, 2012, 01:53:36 am »
Keith, any chance you could round up the CPA details into a single place for us?  I browsed through the release changes and they're all over the place, and the wiki page on these is sorely out of date (I'll throw an update into there once the details are nailed down).

Here's what I've got so far, trying for as complete as possible:

Cross Planet Attacks (CPAs) are time based assaults based on difficulty.  AIP is considered but time in game is the primary source of the volume.

CPAs will use x number of ships, ignoring firepower ratings.  Should your AI enemies be heavy on low-cap ships you'll see a larger firepower rating from a CPA than if they were using all gatlings.  These ships will start being collected at your current mark for AIP, then lower marks, drawing from barracks.  Should that be insufficient it will then pull from the strategic reserve for the defenses of the AI HWs at current mark.  Should that be insufficient it will then pull from increasingly higher marks (in the order of free -> Barracks -> Reserve) until the # of units is filled.

Strategic Reserve ships will be released from any random warp gate in the galaxy available command center, presumably as close to the player HW as possible. (This particular item is rather annoying...).

CPA ships are released as a general threat fleet with starting orders.  Should they get stymied, they'll attempt to join the existing threatfleet hovering somewhere out there in the galaxy.
« Last Edit: November 28, 2012, 03:43:35 am by Wanderer »
... and then we'll have cake.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #1 on: November 28, 2012, 10:01:25 am »
Cross Planet Attacks (CPAs) are time based assaults based on difficulty.  AIP is considered but time in game is the primary source of the volume.
Mostly correct: either AIP _OR_ time is factored in, depending on which would create the bigger attack.  But never do both impact the size of a single CPA.

The actual math is logged (if advanced logging is on) in LogicLog_AIMechanic_Waves_MainThread when a CPA is initially announced.  Look for the string "Triggering CPA" to find that entry as opposed to the normal waves.  FWIW, CPAs are actually just special kinds of waves as far as the game is concerned.

Note that the actual number of ships is shifted down according to cap scale.

Also, Core CPA posts use a different formula that doesn't consider game time:
size = 100 * AIDifficulty * Max(1,AIP/50) * (0.67 + (0.33*human_homeworld_count))


Quote
CPAs will use x number of ships, ignoring firepower ratings.  Should your AI enemies be heavy on low-cap ships you'll see a larger firepower rating from a CPA than if they were using all gatlings.
Yep.  Strictly speaking I'd like to change that to consider strength, but then it can't really give you a number of how many ships to expect in the announcement.  That might not be the end of the world but I haven't seen enough reason to take that step.

Quote
These ships will start being collected at your current mark for AIP, then lower marks, drawing from barracks.  Should that be insufficient it will then pull from the strategic reserve for the defenses of the AI HWs at current mark.  Should that be insufficient it will then pull from increasingly higher marks (in the order of free -> Barracks -> Reserve) until the # of units is filled.
Not exactly:

It starts on the AI's current tech level, but no higher than:
if ( AIDifficulty < 7) then 2;
else if ( AIDifficulty < 8) then Max(2,AITechLevel);  (smiley unintentional but left as-is because it gets the point across; it's less than 8 )
else 5;

The first thing it does is try to pull half the CPA's population from the strategic reserve.  If this would drop the reserve below 50% of max it stops at 50%, so the reserve may not have enough for this, but generally will (particularly if the AI's tech level is 1 or 2).

Then it loops over all planets, and for each one where the humans have fewer than 1/3rd the military ships there than the AI:
- if there's a barracks on the planet, free ships of the target tech level from that barracks until either the CPA is full or the barracks has no more ships of that tech level.
- if there's AI military ships on the planet that:
-- are the target tech level
-- and are guarding something (guard post or command station) OR are in PlanetaryRoamer behavior (old one, not used for much) OR are in SpecialForces behavior
-- and are not a starship or guardian or carrier
-- and are not being protected by an immobile forcefield (note that it's possible a mobile forcefield is passing over them right at that moment and conceivably is the one considered to be giving them protection, so this filter would not apply)
--- then free them until the CPA is full or the planet has no more such ships
- And then it checks the next planet for barracks and then for guard/SF ships, and so on

After that, if the CPA is not full, it decrements the target tech level and loops over the planets again.  If the target tech level hits zero it gets set to the starting tech level + 1 and tries again, and instead of decrementing at the end it increments.  Once it hits 6 while incrementing it stops this part.  Assuming it didn't stop because it had enough ships, of course.

At this point, if the CPA is still not full it does another pull on the strategic reserve for the balance (at the original target tech level), and is willing to leave the reserve bottomed out at 0% if it has to do so.

Quote
Strategic Reserve ships will be released from any random warp gate in the galaxy available command center, presumably as close to the player HW as possible. (This particular item is rather annoying...).
Actually it's been tracking where it's pulled all the non-strategic-reserve ships, and spawns the reserve ships on each of those planets in proportion to the percent of non-reserve ships spawned there.  So if a given planet is providing 20% of the non-reserve ships, 20% of the reserve ships will spawn there.  If it gets to the last planet with any non-reserve spawns it just dumps all the remaining reserve ships there but the percentages should have already worked out elsewhere.

As for spawn point it first looks for an AI command station, and then for a warp gate, and if none of that it just dumps them at point 4000,4000 (not far from the planetary center).

Quote
CPA ships are released as a general threat fleet with starting orders.  Should they get stymied, they'll attempt to join the existing threatfleet hovering somewhere out there in the galaxy.
I think that first sentence is right but just to be clear: they're released as standard threat (like if they'd been guarding a guard post that you just did a drive-by on).  Nothing special after that; they have no memory of being part of a CPA.  But yes, like any other threat they go threatfleet after 30 minutes of meditating on the angst of the engineer without a control node (i.e. existing as threat).


Did I miss anything? :)
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 TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #2 on: November 28, 2012, 10:11:25 am »
Quote
These ships will start being collected at your current mark for AIP, then lower marks, drawing from barracks.  Should that be insufficient it will then pull from the strategic reserve for the defenses of the AI HWs at current mark.  Should that be insufficient it will then pull from increasingly higher marks (in the order of free -> Barracks -> Reserve) until the # of units is filled.
Not exactly:

It starts on the AI's current tech level, but no higher than:
if ( AIDifficulty < 7) then 2;
else if ( AIDifficulty < 8) then Max(2,AITechLevel);  (smiley unintentional but left as-is because it gets the point across; it's less than 8 )
else 5;

I'm a little unclear about this. You mean it is willing to pull from slightly higher mark levels than the current tech level if the current tech level is I in higher difficulties? (Or a lot higher in very high difficulties?)



So basically, Only if after freeing all "can join a CPA" eligible ships, going through all barracks, and exhausting all of the strategic reserve, across all tech levels, it is still short of the announced number will it "cut its losses" only only free less ships than the CPA announced?
Of course, good luck ever seeing this sort of situation...

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #3 on: November 28, 2012, 10:16:23 am »
Quote
It starts on the AI's current tech level, but no higher than:
if ( AIDifficulty < 7) then 2;
else if ( AIDifficulty < 8) then Max(2,AITechLevel);  (smiley unintentional but left as-is because it gets the point across; it's less than 8 )
else 5;
I'm a little unclear about this. You mean it is willing to pull from slightly higher mark levels than the current tech level if the current tech level is I in higher difficulties? (Or a lot higher in very high difficulties?)
That rule there only applies to finding the original target tech level for the CPA; if it can't get enough of that tech level it always tries the next one down and if it can't get enough counting down it goes back to target+1 and counts up.
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 Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #4 on: November 28, 2012, 11:01:14 am »
I haven't played games where I'm literally standing on the edge of ruin, so I might be talking out of my rear end here, but...do we really HAVE to know how many ships will be released?
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #5 on: November 28, 2012, 11:08:36 am »
I haven't played games where I'm literally standing on the edge of ruin, so I might be talking out of my rear end here, but...do we really HAVE to know how many ships will be released?

It helps me know whether I need to pull everything back and commit everything to defense, or if I can commit only part of my fleet and continue offensive operations with only part of my fleet.

Then again, a rough estimate of "effective ship count" would be enough for that, rather than needing an exact value.

Offline Mánagarmr

  • Core Member Mark V
  • *****
  • Posts: 4,272
  • if (isInRange(target)) { kill(target); }
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #6 on: November 28, 2012, 11:14:05 am »
Then again, a rough estimate of "effective ship count" would be enough for that, rather than needing an exact value.
If I've understood the number correctly isn't that already what it is?
Click here to get started with Mantis for Suggestions and Bug Reports.

Thank you for contributing to making the game better!

Offline Hearteater

  • Core Member
  • *****
  • Posts: 2,334
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #7 on: November 28, 2012, 11:30:03 am »
It could just change that "1,000 ships incoming" to "Estimated 1,000 ships incoming" and I think that would be fine, and clearly distinct from wave warnings which are exact.  Also, if it is going to account for caps, then it could average all available ship types the AI has to find the "average cap size" and use that to modify the estimated number on the theory that, in general a CPA will contain a fairly even mix of the ship types the AI has available.

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #8 on: November 28, 2012, 11:51:38 am »
Then again, a rough estimate of "effective ship count" would be enough for that, rather than needing an exact value.
If I've understood the number correctly isn't that already what it is?

Not quite.

When I meant "effective ship count", I meant after "factoring in" ship caps. So a, say, Spire stealth battleship may count 20 to this estimate, but a standard fighter only 1. (Or whatever the proper ship cap ratio is).

Also, the current value displayed is an exact count. The AI will try its darn hardest to free exactly that many ships. The only time the AI will fail to get that number is if the AI literally does not have enough in the galaxy to meet that count, even after exhausting all "auxiliary" sources.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #9 on: November 28, 2012, 12:07:34 pm »
It could just change that "1,000 ships incoming" to "Estimated 1,000 ships incoming" and I think that would be fine, and clearly distinct from wave warnings which are exact.  Also, if it is going to account for caps, then it could average all available ship types the AI has to find the "average cap size" and use that to modify the estimated number on the theory that, in general a CPA will contain a fairly even mix of the ship types the AI has available.
I still think that could produce some apparent-bug situations because if an AI starts with fighters, bombers, missile frigates, and laser gatlings, and the first three planets it picks for spawning from have primary focus on laser gatlings, and have barracks... well, that 400 ship estimate (even if the raw size is 300 and the 400 was based on the average-cap or whatever) could wind up being 800.  Not much of an estimate, right?
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 Wanderer

  • Master Member Mark II
  • *****
  • Posts: 1,579
  • If you're not drunk you're doing it wrong.
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #10 on: November 28, 2012, 12:38:30 pm »
Thanks for detailing that for us Keith.  I'll try to consolidate it later and confirm it again with you and then transfer it over to the wiki.
... and then we'll have cake.

Offline Hearteater

  • Core Member
  • *****
  • Posts: 2,334
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #11 on: November 28, 2012, 01:00:37 pm »
I still think that could produce some apparent-bug situations because if an AI starts with fighters, bombers, missile frigates, and laser gatlings, and the first three planets it picks for spawning from have primary focus on laser gatlings, and have barracks... well, that 400 ship estimate (even if the raw size is 300 and the 400 was based on the average-cap or whatever) could wind up being 800.  Not much of an estimate, right?
Yeah, but that's Laser Gatlings.  It's not like they'd be a threat :) .

Offline TechSY730

  • Core Member Mark V
  • *****
  • Posts: 4,570
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #12 on: November 28, 2012, 01:21:24 pm »
I still think that could produce some apparent-bug situations because if an AI starts with fighters, bombers, missile frigates, and laser gatlings, and the first three planets it picks for spawning from have primary focus on laser gatlings, and have barracks... well, that 400 ship estimate (even if the raw size is 300 and the 400 was based on the average-cap or whatever) could wind up being 800.  Not much of an estimate, right?
Yeah, but that's Laser Gatlings.  It's not like they'd be a threat :) .

I doubt you will be saying that if the difference between 10000 ships and 35000 ships. ;)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #13 on: November 28, 2012, 02:01:22 pm »
I still think that could produce some apparent-bug situations because if an AI starts with fighters, bombers, missile frigates, and laser gatlings, and the first three planets it picks for spawning from have primary focus on laser gatlings, and have barracks... well, that 400 ship estimate (even if the raw size is 300 and the 400 was based on the average-cap or whatever) could wind up being 800.  Not much of an estimate, right?
Yeah, but that's Laser Gatlings.  It's not like they'd be a threat :) .
That's not the point ;)  The point is that someone will see "it told me 400, it sent 800, the estimate was a bug, *mantis*".  And eventually they'll pile up and I'll either make it closer to the estimate through some tomfoolery (unlikely) or remove the estimate ;)
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 Hearteater

  • Core Member
  • *****
  • Posts: 2,334
Re: Request to Keith - CPA Strategic Reserve Spawns
« Reply #14 on: November 28, 2012, 02:03:22 pm »
Doesn't matter at that number TechSY, I'd just use a Martyr either way ;) .

You could do "Estimate 300-800" using the AI's lowest and highest ship cap multipliers to calculate.  That should avoid bug reports.