View Issue Details

IDProjectCategoryLast Update
0025671AI War 2Gameplay IssueOct 27, 2021 7:30 am
Reportertom.prince Assigned Totom.prince  
Status resolvedResolutionfixed 
Product VersionBeta 3.712 Loading Hotfix 
Fixed in VersionBeta 3.740 Code Panopticon 
Summary0025671: Spire cities should by default bolster some fleet.
DescriptionI realize that there are plans to add a UI to control which fleet a city bolsters. However, I think cities should
- bolster a fleet by default
- probably always bolster *some* fleet.

Right now, cities after the first don't bolster anything until you get a mark 3 city, and similarly for cities between the first mark 3 and first mark 4 city. And cities built after than never bolster anything.

I've attached a patch that makes cities that aren't bolstering any fleet bolster some city, and one that changes the logic to do so in a round-robin fashion.
TagsNo tags attached.

Activities

tom.prince

Oct 17, 2021 7:44 pm

developer  

spire-city-bolster.patch (2,099 bytes)   
# HG changeset patch
# User Tom Prince <[email protected]>
# Date 1634465351 21600
#      Sun Oct 17 04:09:11 2021 -0600
# Node ID b10390d384495bf4ad9b900950f99d49ea2a55d9
# Parent  f8871c8d6e9764134087effbfd04b50cf0b74644
Make spire cities automaticly bolster *some* fleet.

diff --git CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
--- CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
+++ CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
@@ -1958,12 +1958,17 @@ namespace Arcen.AIW2.External
             }
             #endregion
 
+            Fleet defaultFleetToBolster = null;
+
             #region Missing Centerpieces
             //look for any missing centerpieces, and fix them
             World_AIW2.Instance.DoForCityFedMobileFleets( null, FleetStatus.AnyStatus, delegate ( Fleet cityFedFleet )
             {
                 if ( cityFedFleet.FleetQualifier == "FallSpi" )
                 {
+                    if (defaultFleetToBolster == null) {
+                        defaultFleetToBolster = cityFedFleet;
+                    }
                     GameEntity_Squad mobileFlagship = cityFedFleet.Centerpiece.GetSquad();
 
                     if ( mobileFlagship == null ) //missing flagship!
@@ -1994,6 +1999,10 @@ namespace Arcen.AIW2.External
 
                 //what fleet is this city bolstering?  Might be null, that's okay
                 Fleet fleetForMobile = fleetForCity.GetFleetBolsteredByThisCity();
+                if (fleetForMobile == null) {
+                    city.FleetMembership.Fleet.CityBolstersFleetID = defaultFleetToBolster.FleetID;
+                    fleetForMobile = defaultFleetToBolster;
+                }
 
                 #region First Remove Any Old Bolstered fleet lines
                 //now look at all the other spire cities and make sure we're not boosting any of those
spire-city-bolster.patch (2,099 bytes)   
spire-city-bolster-round-robin.patch (2,789 bytes)   
# HG changeset patch
# User Tom Prince <[email protected]>
# Date 1634513488 21600
#      Sun Oct 17 17:31:28 2021 -0600
# Node ID a1ffd9b663a4e5469704a11d3f3266fe5c0d1eac
# Parent  b10390d384495bf4ad9b900950f99d49ea2a55d9
Bolster spire fleets in a round-robin fashion by default.

diff --git CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
--- CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
+++ CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
@@ -1926,9 +1926,11 @@ namespace Arcen.AIW2.External
 
         #region RecalculateSpireCityMobileFleetContents_MainThreadSimOnly
         private readonly Dictionary<string, int> spireShipsToAdd = new Dictionary<string, int>( 100 );
+        private readonly Dictionary<int, int> spireCitiesPerFleet = new Dictionary<int, int>( 100 );
         public void RecalculateSpireCityMobileFleetContents_MainThreadSimOnly( Faction faction, ArcenHostOnlySimContext Context )
         {
             spireShipsToAdd.Clear();
+            spireCitiesPerFleet.Clear();
             List<GameEntityTypeData> spireCityBuildings = GameEntityTypeDataTable.Instance.GetAllRowsWithTagOrNull( "SpireFeedsFleet" );
 
             int maxMarkLevelOfAnyCity = 0;
@@ -1941,6 +1943,14 @@ namespace Arcen.AIW2.External
                     return DelReturn.Continue;
                 if ( fleetForCity.MaxMarkLevelOfAnyInFleet > maxMarkLevelOfAnyCity )
                     maxMarkLevelOfAnyCity = fleetForCity.MaxMarkLevelOfAnyInFleet;
+                Fleet fleetForMobile = fleetForCity.GetFleetBolsteredByThisCity();
+                if ( fleetForMobile != null ) {
+                    if (!spireCitiesPerFleet.ContainsKey(fleetForMobile.FleetID)) {
+                        spireCitiesPerFleet[fleetForMobile.FleetID] = 1;
+                    } else {
+                        spireCitiesPerFleet[fleetForMobile.FleetID] += 1;
+                    }
+                }
                 return DelReturn.Continue;
             } );
             #endregion
@@ -1966,7 +1976,7 @@ namespace Arcen.AIW2.External
             {
                 if ( cityFedFleet.FleetQualifier == "FallSpi" )
                 {
-                    if (defaultFleetToBolster == null) {
+                    if (defaultFleetToBolster == null || spireCitiesPerFleet[defaultFleetToBolster.FleetID] > spireCitiesPerFleet[cityFedFleet.FleetID]) {
                         defaultFleetToBolster = cityFedFleet;
                     }
                     GameEntity_Squad mobileFlagship = cityFedFleet.Centerpiece.GetSquad();

tom.prince

Oct 18, 2021 1:49 am

developer   ~0062981

spire-city-bolster-v2.patch (2,132 bytes)   
# HG changeset patch
# User Tom Prince <[email protected]>
# Date 1634465351 21600
#      Sun Oct 17 04:09:11 2021 -0600
# Node ID 267e29f9ae39cbcca3009d35bd4cfac9cb5e7f2e
# Parent  06e73af7fea0cdb1d243946fab8e7c2f461d04c8
Make spire cities automaticly bolster *some* fleet.

diff --git CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
--- CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
+++ CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
@@ -1958,12 +1958,17 @@ namespace Arcen.AIW2.External
             }
             #endregion
 
+            Fleet defaultFleetToBolster = null;
+
             #region Missing Centerpieces
             //look for any missing centerpieces, and fix them
             World_AIW2.Instance.DoForCityFedMobileFleets( null, FleetStatus.AnyStatus, delegate ( Fleet cityFedFleet )
             {
                 if ( cityFedFleet.FleetQualifier == "FallSpi" )
                 {
+                    if (defaultFleetToBolster == null) {
+                        defaultFleetToBolster = cityFedFleet;
+                    }
                     GameEntity_Squad mobileFlagship = cityFedFleet.Centerpiece.GetSquad();
 
                     if ( mobileFlagship == null ) //missing flagship!
@@ -1994,6 +1999,10 @@ namespace Arcen.AIW2.External
 
                 //what fleet is this city bolstering?  Might be null, that's okay
                 Fleet fleetForMobile = fleetForCity.GetFleetBolsteredByThisCity();
+                if (fleetForMobile == null && defaultFleetToBolster != null) {
+                    city.FleetMembership.Fleet.CityBolstersFleetID = defaultFleetToBolster.FleetID;
+                    fleetForMobile = defaultFleetToBolster;
+                }
 
                 #region First Remove Any Old Bolstered fleet lines
                 //now look at all the other spire cities and make sure we're not boosting any of those
spire-city-bolster-v2.patch (2,132 bytes)   
spire-city-bolster-round-robin-v2.patch (2,971 bytes)   
# HG changeset patch
# User Tom Prince <[email protected]>
# Date 1634513488 21600
#      Sun Oct 17 17:31:28 2021 -0600
# Node ID d1d04539171d5372aee98d4ba50978dfc2c4e701
# Parent  267e29f9ae39cbcca3009d35bd4cfac9cb5e7f2e
Bolster spire fleets in a round-robin fashion by default.

diff --git CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
--- CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
+++ CodeExternal/AIWarExternalDeepProcessingCode/src/DeepInfo/DLC1/FallenSpireFactionDeepInfo.cs
@@ -1926,9 +1926,11 @@ namespace Arcen.AIW2.External
 
         #region RecalculateSpireCityMobileFleetContents_MainThreadSimOnly
         private readonly Dictionary<string, int> spireShipsToAdd = new Dictionary<string, int>( 100 );
+        private readonly Dictionary<int, int> spireCitiesPerFleet = new Dictionary<int, int>( 100 );
         public void RecalculateSpireCityMobileFleetContents_MainThreadSimOnly( Faction faction, ArcenHostOnlySimContext Context )
         {
             spireShipsToAdd.Clear();
+            spireCitiesPerFleet.Clear();
             List<GameEntityTypeData> spireCityBuildings = GameEntityTypeDataTable.Instance.GetAllRowsWithTagOrNull( "SpireFeedsFleet" );
 
             int maxMarkLevelOfAnyCity = 0;
@@ -1941,6 +1943,14 @@ namespace Arcen.AIW2.External
                     return DelReturn.Continue;
                 if ( fleetForCity.MaxMarkLevelOfAnyInFleet > maxMarkLevelOfAnyCity )
                     maxMarkLevelOfAnyCity = fleetForCity.MaxMarkLevelOfAnyInFleet;
+                Fleet fleetForMobile = fleetForCity.GetFleetBolsteredByThisCity();
+                if ( fleetForMobile != null ) {
+                    if (!spireCitiesPerFleet.ContainsKey(fleetForMobile.FleetID)) {
+                        spireCitiesPerFleet[fleetForMobile.FleetID] = 1;
+                    } else {
+                        spireCitiesPerFleet[fleetForMobile.FleetID] += 1;
+                    }
+                }
                 return DelReturn.Continue;
             } );
             #endregion
@@ -1966,7 +1976,10 @@ namespace Arcen.AIW2.External
             {
                 if ( cityFedFleet.FleetQualifier == "FallSpi" )
                 {
-                    if (defaultFleetToBolster == null) {
+                    if (!spireCitiesPerFleet.ContainsKey(cityFedFleet.FleetID)) {
+                        spireCitiesPerFleet[cityFedFleet.FleetID] = 0;
+                    }
+                    if (defaultFleetToBolster == null || spireCitiesPerFleet[defaultFleetToBolster.FleetID] > spireCitiesPerFleet[cityFedFleet.FleetID]) {
                         defaultFleetToBolster = cityFedFleet;
                     }
                     GameEntity_Squad mobileFlagship = cityFedFleet.Centerpiece.GetSquad();

tom.prince

Oct 27, 2021 7:30 am

developer   ~0063006

I ended up making cities bolster the nearest fleet.

Issue History

Date Modified Username Field Change
Oct 17, 2021 7:44 pm tom.prince New Issue
Oct 17, 2021 7:44 pm tom.prince File Added: spire-city-bolster.patch
Oct 17, 2021 7:44 pm tom.prince File Added: spire-city-bolster-round-robin.patch
Oct 18, 2021 1:49 am tom.prince Note Added: 0062981
Oct 18, 2021 1:49 am tom.prince File Added: spire-city-bolster-v2.patch
Oct 18, 2021 1:49 am tom.prince File Added: spire-city-bolster-round-robin-v2.patch
Oct 27, 2021 7:30 am tom.prince Assigned To => tom.prince
Oct 27, 2021 7:30 am tom.prince Status new => resolved
Oct 27, 2021 7:30 am tom.prince Resolution open => fixed
Oct 27, 2021 7:30 am tom.prince Fixed in Version => Beta 3.740 Code Panopticon
Oct 27, 2021 7:30 am tom.prince Note Added: 0063006