feat(ai): improving agents planning and memory
This commit is contained in:
@@ -41,50 +41,27 @@ internal sealed class FactionCommoditySnapshot
|
||||
internal float NetRatePerSecond => ProductionRatePerSecond - ConsumptionRatePerSecond;
|
||||
internal float ProjectedProductionRatePerSecond => ProductionRatePerSecond + CommittedProductionRatePerSecond;
|
||||
internal float ProjectedNetRatePerSecond => ProjectedProductionRatePerSecond - ConsumptionRatePerSecond;
|
||||
internal float OperationalUsageRatePerSecond => MathF.Max(ConsumptionRatePerSecond, BuyBacklog / 180f);
|
||||
internal float LevelSeconds => AvailableStock <= 0.01f
|
||||
? 0f
|
||||
: AvailableStock / MathF.Max(OperationalUsageRatePerSecond, 0.01f);
|
||||
|
||||
internal float ShortageHorizonSeconds
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ConsumptionRatePerSecond <= 0.01f && BuyBacklog <= 0.01f)
|
||||
internal CommodityLevelKind Level =>
|
||||
LevelSeconds switch
|
||||
{
|
||||
return float.PositiveInfinity;
|
||||
}
|
||||
<= 60f => CommodityLevelKind.Critical,
|
||||
<= 180f => CommodityLevelKind.Low,
|
||||
<= 480f => CommodityLevelKind.Stable,
|
||||
_ => CommodityLevelKind.Surplus,
|
||||
};
|
||||
}
|
||||
|
||||
if (NetRatePerSecond >= -0.01f)
|
||||
{
|
||||
return float.PositiveInfinity;
|
||||
}
|
||||
|
||||
return AvailableStock / MathF.Max(0.01f, -NetRatePerSecond);
|
||||
}
|
||||
}
|
||||
|
||||
internal float ProjectedShortageHorizonSeconds
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ConsumptionRatePerSecond <= 0.01f && BuyBacklog <= 0.01f)
|
||||
{
|
||||
return float.PositiveInfinity;
|
||||
}
|
||||
|
||||
if (ProjectedNetRatePerSecond >= -0.01f)
|
||||
{
|
||||
return float.PositiveInfinity;
|
||||
}
|
||||
|
||||
return AvailableStock / MathF.Max(0.01f, -ProjectedNetRatePerSecond);
|
||||
}
|
||||
}
|
||||
|
||||
internal float PressureScore =>
|
||||
MathF.Max(0f, (BuyBacklog + ReservedForConstruction) - (OnHand + Inbound))
|
||||
+ MathF.Max(0f, ConsumptionRatePerSecond - ProductionRatePerSecond) * 120f;
|
||||
|
||||
internal float ProjectedPressureScore =>
|
||||
MathF.Max(0f, (BuyBacklog + ReservedForConstruction) - (OnHand + Inbound))
|
||||
+ MathF.Max(0f, ConsumptionRatePerSecond - ProjectedProductionRatePerSecond) * 120f;
|
||||
internal enum CommodityLevelKind
|
||||
{
|
||||
Critical,
|
||||
Low,
|
||||
Stable,
|
||||
Surplus,
|
||||
}
|
||||
|
||||
internal static class FactionEconomyAnalyzer
|
||||
|
||||
Reference in New Issue
Block a user