Package megamek.client.bot.princess
Class InfantryPathRanker
java.lang.Object
megamek.client.bot.princess.PathRanker
megamek.client.bot.princess.BasicPathRanker
megamek.client.bot.princess.InfantryPathRanker
- All Implemented Interfaces:
IPathRanker
-
Nested Class Summary
Nested classes/interfaces inherited from class megamek.client.bot.princess.BasicPathRanker
BasicPathRanker.FiringPhysicalDamageNested classes/interfaces inherited from class megamek.client.bot.princess.PathRanker
PathRanker.PathRankerType -
Field Summary
Fields inherited from class megamek.client.bot.princess.BasicPathRanker
bestDamageByEnemies, blackIce, ESTIMATE_NOISE_MARGIN, FACING_MOD_MULTIPLIER, HOLD_CREDIT_ATTACK_CAP_FACTOR, HOLD_CREDIT_DEFEND_CAP_FACTOR, LOG_DECIMAL, LOG_PERCENT, REPRESENTATIVE_TO_HIT, TEMPO_REFERENCE_MP, THREAT_CONTACT_RANGE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class megamek.client.bot.princess.BasicPathRanker
attackerMovementDamageDiscount, calcDamageToStrategicTargets, calculateAerospaceMod, calculateAggressionMod, calculateCloseRangeIncentive, calculateCrowdingTolerance, calculateFacingMod, calculateMovementMod, calculateMutualSupportMod, calculateOffBoardMod, calculatePositionHoldMod, calculateSelfPreservationMod, checkBlackIce, checkPathForHazards, distanceToClosestEnemy, doctrineScores, evaluateAsMoved, getBraveryMod, getPSRList, hexProperties, incomingFireTerrainDiscount, initUnitTurn, isExtremeRange, isLosRange, isWithdrawing, rankPaths, resolvedPostureFor, resolvePostureMethods inherited from class megamek.client.bot.princess.PathRanker
calcAllyCenter, calculateAlliesCenter, calculateMovePathPSRDamage, distanceToHomeEdge, findClosestEnemy, findClosestEnemy, getBestPath, getMovePathSuccessProbability, getOwner, getPathRankerStateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.client.bot.princess.IPathRanker
findClosestEnemy
-
Constructor Details
-
InfantryPathRanker
-
-
Method Details
-
rankPath
protected RankedPath rankPath(MovePath path, Game game, int maxRange, double fallTolerance, List<Entity> enemies, Coords friendsCoords) Description copied from class:BasicPathRankerEvaluates and ranks movement paths for MegaMek units based on multiple strategic factors. Returns a utility score where higher values represent more desirable paths.The utility score calculation combines several weighted factors:
utility = -fallMod + braveryMod - aggressionMod - mutualSupportMod + movementMod - crowdingTolerance - facingMod - selfPreservationMod - (utility * offBoardMod)Key Components:
- fallMod: Penalty for paths with risk of failing piloting rolls
- Calculated as
pilotingFailure * fallShame - Higher values = worse paths (more likely to fall)
- Calculated as
- braveryMod: Reward for paths balancing damage output vs. incoming damage
- Based on potential damage to enemies vs. expected damage received
- Higher values = better paths (can do more damage than take)
- aggressionMod: Penalty for staying far from enemies
- Calculated as
distanceToEnemy * aggressionValue - Higher values = worse paths (too far from enemies when aggression is high)
- Calculated as
- mutualSupportMod: Penalty for moving away from friendly units
- Calculated as
distanceToFriends * mutualSupportValue - Higher values = worse paths (isolated from allies)
- Calculated as
- facingMod: Penalty for not facing toward enemies
- Based on facing direction relative to enemies
- Higher values = worse paths (facing away from threats)
- selfPreservationMod: Penalty for not moving toward retreat edge when needed
- Special case: if reaching the home edge, gives a large bonus of
ARRIVED_AT_DESTINATION_FACTOR - Higher values = worse paths (not retreating when damaged)
- Special case: if reaching the home edge, gives a large bonus of
- movementMod: Reward for using movement effectively
- Based on multiple strategic factors
- Higher values = better paths (using speed effectively)
- crowdingTolerance: Penalty for ending in crowded areas
- Based on nearby threats relative to maximum weapon range
- Higher values = worse paths (too many enemies nearby)
- offBoardMod: Penalty for aerospace units at risk of flying off the board
- Applies as a multiplier to existing penalties
- Higher values = worse paths (likely to fly off the board)
The function uses behavior settings like bravery, aggression, and mutual support to adjust the relative importance of these factors based on the AI's configured personality.
- Overrides:
rankPathin classBasicPathRanker- Parameters:
path- The movement path to be evaluatedgame- The current game statemaxRange- Entity max weapon rangefallTolerance- a maximum PSR failure chance to be acceptableenemies- List of enemy units visiblefriendsCoords- Center of Gravity of friendly units (average coordinate position)- Returns:
- A double representing the utility/desirability of the path (higher is better)
- fallMod: Penalty for paths with risk of failing piloting rolls
-