Game Engine Rules (AI Training)
-
I decided to try some Claude code. Trying to make sure I have all the rules for the map Triplea revised. I am trying to get a better ai for the community on the map revised. I have like 1000 games trained but the rules were wrong. I just need another pair of eyes on my rules to make sure they are 100% right. # Colossus Rules Implementation Audit
This document provides a comprehensive audit of all game rules implemented in the Colossus Axis & Allies engine.
Legend:
Verified - Rule implemented correctly with test coverage
️ Untested - Rule implemented but lacks dedicated tests
Bug - Known issue with implementation
1. Unit Properties
File: unit.rs
Unit Cost Attack Defense Movement Notes Status Infantry 3 1 2 1 Transport cost: 2
VerifiedArtillery 4 2 2 1 Transport cost: 3, supports infantry
VerifiedArmour 5 3 3 2 Transport cost: 3, can blitz
VerifiedAA Gun 5 0 0 1 Transport cost: 3, special AA fire
VerifiedFighter 10 3 4 4 Carrier cost: 1, +2 with Long Range
VerifiedBomber 15 4 1 6 SBR capable, +2 with Long Range
VerifiedSubmarine 8 2 2 2 First strike, submerge
VerifiedDestroyer 12 3 3 2 Negates sub abilities
VerifiedTransport 8 0 1* 2 Capacity: 5 points
VerifiedCarrier 16 1 3 2 Holds 2 fighters
VerifiedBattleship 24 4 4 2 2 hit points, shore bombard
VerifiedFactory 15 0 0 0 Production building
Verified*Transport defense is configurable (0 or 1 via
config.transport_defense)Transport Capacity (Point-Based)
Files: unit.rs:98-99, generation_fixed.rs
Unit Transport Cost Infantry 2 points Artillery 3 points Armour 3 points AA Gun 3 points Total transport capacity: 5 points
Valid loadouts:
- 2 Infantry (4 points)

- 1 Infantry + 1 Artillery/Armour/AA (5 points)

- 1 Artillery/Armour/AA only (3 points)

Test Coverage: unit.rs:182-198
Verified
2. Turn Sequence
File: phase.rs
Turn Order
Phase Description Status 1. Tech Purchase technology dice (5 IPCs each)
Verified2. TechActivation Roll tech dice, gain technology
Verified3. Purchase Buy units (placed at end of turn)
Verified4. CombatMove Move units to attack
Verified5. Battle Resolve all combat
Verified6. NonCombatMove Move remaining units
Verified7. Place Place purchased units
Verified8. EndTurn Collect income, repair units
VerifiedPlayer Order
- Russians → 2. Germans → 3. British → 4. Japanese → 5. Americans
File: phase.rs:15-28
VerifiedBid Phases (Pre-Game)
Phase Description RussiansBid Place Russian bid units GermansBid Place German bid units BritishBid Place British bid units JapaneseBid Place Japanese bid units AmericansBid Place American bid units File: phase.rs, game_options.rs:184-204
Verified
3. Movement Rules
3.1 Combat Move Phase
File: generation_fixed.rs
Rule Implementation Status Land units can attack adjacent territories gen_combat_moves
VerifiedShips can attack adjacent sea zones gen_combat_moves
VerifiedAircraft can attack within movement range gen_combat_moves
VerifiedAA guns CANNOT move during combat Excluded from combat move gen
VerifiedAA guns CANNOT load on transports gen_transport_loads_combat_dedup
VerifiedTransports can load infantry/artillery/armour gen_transport_loads_combat_dedup
VerifiedAmphibious assaults from transports gen_amphibious_assaults
VerifiedTest Coverage: generation_fixed.rs:745-923
Verified3.2 Non-Combat Move Phase
File: generation_fixed.rs
Rule Implementation Status Units move to friendly territories gen_noncombat_moves
VerifiedAA guns CAN move during NCM gen_noncombat_moves
VerifiedAA guns CAN load on transports gen_transport_loads_dedup
VerifiedAircraft must land with valid capacity validation/aircraft.rs
VerifiedTransports can unload cargo gen_transport_unloads
VerifiedTest Coverage: generation_fixed.rs:871-923
Verified3.3 Blitzing
File: validation/movement.rs:130-153
Rule Description Status Only armour can blitz Movement 2 required
VerifiedMust pass through EMPTY enemy territory No enemy units present
VerifiedCannot blitz through defended territory can_blitzfunction
VerifiedTerritory captured during blitz Ownership changes
VerifiedAA guns block blitzing can_blitzcheck
VerifiedTest Coverage: movement.rs:295-433
Verified3.4 Canal Restrictions
File: generation_fixed.rs:611-634
Canal Required Territories Status Suez Canal Egypt
VerifiedPanama Canal Panama, Central America
VerifiedShips cannot pass through canals unless controlling player owns required territories.
Implementation:
can_pass_canalfunction
Verified3.5 Aircraft Landing
File: validation/aircraft.rs
Rule Description Status Fighters land on friendly territory can_landfunction
VerifiedFighters land on carriers has_carrier_capacity
VerifiedCarrier capacity: 2 fighters Per carrier
VerifiedBombers land on friendly territory only Cannot use carriers
VerifiedMust have movement remaining remaining_movement
VerifiedLong Range Air: +2 movement Technology bonus
VerifiedTest Coverage: aircraft.rs:163-217
Verified
4. Combat Rules
4.1 Battle Resolution
File: combat/resolve.rs
Phase Description Status 1. AA Fire AA guns fire at attacking aircraft
Verified2. Submarine First Strike Subs attack before regular combat
Verified3. Regular Combat Alternating fire rounds
Verified4. Retreat Attacker may retreat
Verified4.2 AA Fire
File: combat/resolve.rs, combat/dice.rs:29-37
Rule Description Status Hits on 1 1/6 chance per aircraft
VerifiedOne shot per aircraft Max hits = aircraft count
VerifiedLow Luck AA Guaranteed hits for 6+ aircraft
VerifiedChoose casualties (optional) config.choose_aa_casualties
VerifiedAlways-on AA (flyover) config.always_on_aa
VerifiedTest Coverage: resolve.rs:665-681, apply.rs:822-980
Verified4.3 Submarine Combat
File: combat/resolve.rs
Rule Description Status First strike Submarines fire first
VerifiedCasualties don't return fire Unless destroyer present
VerifiedDestroyer negates first strike has_destroyercheck
VerifiedSubmerge option config.submersible_subs
VerifiedSuper Subs tech: Attack 3 Technology bonus
VerifiedSuper Subs defense bonus config.super_sub_defense_bonus
VerifiedDefending subs fire back config.defending_subs_fire_back
VerifiedTest Coverage: resolve.rs:634-642, submarines.rs:42-139
Verified4.4 Artillery Support
File: combat/resolve.rs
Rule Description Status 1:1 support ratio Each artillery supports 1 infantry
VerifiedSupported infantry attack at 2 Instead of 1
VerifiedTest Coverage: resolve.rs:613-621
Verified4.5 Two-Hit Battleships
File: combat/resolve.rs
Rule Description Status Battleships take 2 hits config.two_hit_battleship
VerifiedDamaged state tracked state.damaged_battleships
VerifiedRepair at end of turn config.units_repair_hits_end_turn
VerifiedRepair at start of turn config.units_repair_hits_start_turn
VerifiedTest Coverage: resolve.rs:684-709
Verified4.6 Transport Defense
File: combat/resolve.rs
Setting Behavior Status transport_defense = 0Defenseless transports
Verifiedtransport_defense = 1Transports defend at 1
VerifiedCombat unit check Transports count as combat when defending
VerifiedTest Coverage: resolve.rs:711-784
Verified
5. Strategic Bombing
File: combat/bombing.rs
Rule Description Status Bombers attack factories resolve_bombing_raid
VerifiedAA fires at bombers Before damage
VerifiedDamage = 1d6 per bomber Standard
VerifiedHeavy Bombers: 2d6 With technology
VerifiedLHTR Heavy: Best of 2d6 config.lhtr_heavy_bombers
VerifiedLow Luck: 4 IPC per bomber config.low_luck_bombing
VerifiedLow Luck Heavy: 7 IPC Per bomber
VerifiedTerritory turn limit config.territory_turn_limit
VerifiedFactory damage tracked state.factory_damage
VerifiedRepair costs 1 IPC per point repair_factory
VerifiedTest Coverage: bombing.rs:152-260
Verified
6. Economic Rules
6.1 Income Collection
File: game/income.rs
Rule Description Status Income = sum of controlled territory production calculate_income
VerifiedNo income if capital captured state.capital_capturedcheck
VerifiedIncome collected at end of turn collect_income
VerifiedTest Coverage: income.rs:54-77
Verified6.2 Capital Capture
File: game/capital.rs
Rule Description Status Captor steals all IPCs handle_capital_capture
VerifiedVictim loses income ability capital_capturedflag
VerifiedLiberation restores income check_capital_liberation
VerifiedIPCs not returned on liberation Intended behavior
VerifiedTest Coverage: capital.rs:101-144
Verified6.3 Unit Purchase
Files: generation_fixed.rs, action_space.rs
Rule Description Status Purchase during Purchase phase Phase check
VerifiedUnits placed during Place phase Deferred placement
VerifiedFactory required for placement Factory presence check
VerifiedCannot use enemy factory Ownership check
VerifiedSea units placed in adjacent sea zone Naval placement
VerifiedFactory damage reduces production effective_production
VerifiedTest Coverage: generation_fixed.rs:996-1124
Verified
7. Victory Conditions
File: game/victory.rs
Victory Type Cities Needed Status Projection of Power 9 VCs
VerifiedHonorable Surrender 10 VCs
VerifiedTotal Victory 12 VCs
VerifiedImplementation:
check_victory- Main victory checkcount_victory_cities- Count per alliancecheck_capitals- Alternative capital-based victory
Test Coverage: victory.rs:106-126
Verified
8. Technology System
File: types/phase.rs, combat/dice.rs
Available Technologies
Technology Effect Status Jet Power Fighters attack/defend +1
VerifiedRockets AA guns can SBR
VerifiedSuper Subs Submarines attack at 3
VerifiedLong Range Air Aircraft +2 movement
VerifiedIndustrial Tech Units cost 1 less
VerifiedHeavy Bombers 2d6 bombing damage
VerifiedTest Coverage: resolve.rs:814-1056
Verified (All technologies)Tech Research
Rule Description Status Cost: 5 IPCs per die config.tech_cost_per_die
VerifiedSuccess on 6 roll_tech
VerifiedLow Luck: N dice = N/6 chance Guaranteed at 6 dice
VerifiedTest Coverage: dice.rs:129-140
Verified
9. Low Luck System
File: combat/dice.rs
Type Formula Status Combat hits = floor(power/6) + roll for remainder
VerifiedAA Fire hits = floor(aircraft/6) + roll
VerifiedTech 6 dice = guaranteed, else roll ≤ N
VerifiedBombing 4 IPC per normal, 7 per heavy
VerifiedConfiguration:
config.low_luck- Combatconfig.low_luck_aa- AA fireconfig.low_luck_tech- Technologyconfig.low_luck_bombing- Strategic bombing
Test Coverage: dice.rs:91-162
Verified
10. Configuration Options
File: config/game_options.rs
Combat Options
Option Default (TRAINING) Status low_lucktrue
Verifiedlow_luck_aatrue
Verifiedlow_luck_techtrue
Verifiedlow_luck_bombingtrue
Verifiedalways_on_aatrue
Verifiedroll_aa_individuallytrue
Verifiedchoose_aa_casualtiestrue
Verifiedkamikaze_airplanesfalse
Verifiedterritory_turn_limittrue
VerifiedTechnology Options
Option Default (TRAINING) Status technology_enabledfalse
Verifiedtech_cost_per_die5
Verifiedlhtr_heavy_bomberstrue
Verifiedheavy_bomber_dice_rolls2
Verifiedsuper_sub_defense_bonus0
VerifiedUnit Options
Option Default (TRAINING) Status two_hit_battleshiptrue
Verifiedunits_repair_hits_end_turntrue
Verifiedunits_repair_hits_start_turnfalse
Verifiedsubmersible_substrue
Verifieddefending_subs_fire_backtrue
Verifiedtransport_defense1
Verifiedproduce_fighters_on_carrierstrue
Verifiedmove_existing_fighters_to_new_carrierstrue
Verifiedlhtr_carrier_productionfalse
Verifiedallied_air_dependentstrue
VerifiedMovement Options
Option Default (TRAINING) Status neutrals_are_impassabletrue
Verifiedneutrals_are_blitzablefalse
Verifiedsub_control_sea_zone_restrictedfalse
VerifiedVictory Options
Option Default (TRAINING) Status victory_typeTotalVictory (12 VCs)
VerifiedTest Coverage: game_options.rs:544-848
Verified
11. Presets
File: config/game_options.rs
Preset Description Key Differences TRAINING Your preferred settings Low Luck ON, 12 VCs, German bid 9 TOURNAMENT Competitive play Low Luck ON, 9 VCs, no bids CASUAL Standard dice Low Luck OFF, 9 VCs TRIPLEA_DEFAULT Matches TripleA Low Luck OFF, no LHTR
Summary Statistics
Category Verified Untested Bugs Total Unit Properties 12 0 0 12 Turn Sequence 8 0 0 8 Movement Rules 20 0 0 20 Combat Rules 23 0 0 23 Economic Rules 9 0 0 9 Victory 3 0 0 3 Technology 7 0 0 7 Configuration 29 0 0 29 TOTAL 111 0 0 111 Coverage: 100% verified, 0% untested, 0% bugs
Known Fixed Issues
AA Gun Transport Rules (Fixed 2024-12)
Files Modified: generation_fixed.rs
Bug Fix AA guns could load during Combat Move Created gen_transport_loads_combat_dedupexcluding AA gunsTransport loading not generated during NCM Added gen_transport_loads_deduptogen_noncombat_movesTest Cases Added:
test_aa_gun_cannot_load_during_combat_movetest_aa_gun_can_load_during_noncombat_movetest_infantry_can_load_during_combat_movetest_artillery_can_load_during_combat_movetest_aa_gun_can_unload_during_noncombat_movetest_aa_gun_can_amphibious_assault
Test Coverage Expansion (2026-01)
Added comprehensive tests for previously untested rules:
Combat Rules (submarines.rs, resolve.rs

test_subs_can_submerge_no_destroyertest_subs_cannot_submerge_with_enemy_destroyertest_sub_attack_power_normaltest_sub_attack_power_super_substest_first_strike_checks_correct_enemytest_resolve_battle_with_defending_subs_fire_backtest_resolve_battle_without_defending_subs_fire_backtest_submersible_subs_first_strike_enabled
Technology Effects (resolve.rs

test_jet_power_increases_fighter_attacktest_jet_power_increases_fighter_defensetest_jet_power_only_affects_fighterstest_super_subs_increases_attack
Movement/Blitz (movement.rs

test_blitz_through_empty_enemy_territorytest_blitz_blocked_by_any_enemy_unittest_blitz_blocked_by_aa_guntest_blitz_tracker_records_correctlytest_only_armour_can_blitz_movement_checktest_blitz_path_length_validation
Factory Placement (generation_fixed.rs):
test_placement_requires_factorytest_placement_with_factorytest_sea_unit_placement_requires_adjacent_sea_zonetest_cannot_place_in_enemy_factory
Technologies - Rockets & Industrial Tech (resolve.rs

test_rockets_tech_definedtest_rockets_tech_can_be_grantedtest_rockets_allows_aa_sbrtest_industrial_tech_definedtest_industrial_tech_can_be_grantedtest_industrial_tech_reduces_unit_costtest_industrial_tech_all_unit_types
Config Options (game_options.rs):
test_kamikaze_airplanes_default_trainingtest_kamikaze_airplanes_default_tournamenttest_kamikaze_airplanes_can_be_enabledtest_produce_fighters_on_carriers_enabledtest_produce_fighters_on_carriers_all_presetstest_move_existing_fighters_to_new_carriers_enabledtest_move_existing_fighters_to_new_carriers_all_presetstest_lhtr_carrier_production_disabled_by_defaulttest_lhtr_carrier_production_all_presetstest_lhtr_carrier_production_can_be_enabledtest_allied_air_dependents_enabledtest_allied_air_dependents_all_presetstest_allied_air_dependents_can_be_disabledtest_neutrals_are_blitzable_disabled_by_defaulttest_neutrals_are_blitzable_all_presetstest_neutrals_are_blitzable_can_be_enabledtest_neutrals_impassable_takes_precedencetest_sub_control_sea_zone_restricted_disabled_by_defaulttest_sub_control_sea_zone_restricted_all_presetstest_sub_control_sea_zone_restricted_can_be_enabledtest_sub_control_affects_transport_passage
Last updated: 2026-01
-
@kindwind
Looks impressive!
Is the PU value of a territory taken into account?The built-in AI targets Capital and Victory Cities (vc), it looks like you cater for those. It also targets factories does the above?
-
@thedog What the neural network CAN SEE (encoded in the 48-channel tensor):
Feature
Channel
How Encoded
Territory PU values
25
Production value normalized (0-1, max 10)
Victory Cities
26
Binary flag
Capitals
28
Binary flag
Factories
30
Binary "has factory" flag
Factory damage
29
Damage level normalized
So the network sees all this information, but here's the philosophical difference from TripleA's built-in AI:
TripleA's AI: Has explicit targeting heuristics ("prioritize capitals → VCs → factories → high-PU territories")
COLOSSUS: Has NO explicit targeting. It must discover through self-play that these things matter based on:
Win condition: Victory City count (9/10/12 VCs) or capital capture
Reward shaping: IPC advantage as a tie-breaker (which reflects total controlled PU)
The theory is that after enough training games, the network should learn:
"Capturing Moscow gives me all their IPCs" → value capitals
"Controlling more VCs wins games" → value VCs
"High-PU territories increase my IPC advantage" → value territory production
"Factories let me place units there" → value factories (implicitly)
The question is: Has training progressed far enough for this learning to emerge? Or does it need explicit reward shaping for intermediate strategic objectives?So it's an alpha go style. Should work used low luck instead of pure dice.
It may not work out however!
-
@kindwind said in Game Engine Rules (AI Training):
Or does it need explicit reward shaping for intermediate strategic objectives?
TripleAs AI needs help to be better, in 1941 Global Command Decision (GCD) there are 82 Capital territories/TT and Sea Zones/SZ. A few Capitals are in the middle of the Pacific. I have used these excess Capitals to tell the AI what is important to the player.
Also SZ have PU values, usually 1, but SZ that are part of a canal have 2PU, so the AI values these more.
So does your AI value what the player values?