-
Notifications
You must be signed in to change notification settings - Fork 47
Tutorial
This tutorial creates a profile and a small Human strategy, compiles them, and tests them in a map. It uses Reforged names, but the workflow is the same for TFT and ROC.
Install Perl and the Perl/Tk modules described in Strategy Manager#requirements-and-launch. Work from a clean AMAI checkout and test on a copy of a map.
perl .\AMAIStrategyManager.plSelect REFORGED and HUMAN.
- Open Profiles.
- Choose New, select the new entry, and choose Edit.
- Give it a unique name.
- Change a few values deliberately and retain the remaining defaults for the first test.
| Field | Effect |
|---|---|
| Race | Restricts the profile to one race or permits any race. |
| Aggression | Willingness to attack relative to estimated enemy strength. |
| Uncertainty | Error added to enemy-strength knowledge. |
| Minimum Attack Strength | Army strength required before normal attacks. |
| Build Farm at left food | Free-food threshold for another supply building. |
| Expansion times | Adjust the strategy's first and second expansion windows; they permit rather than force expansion. |
| Strategy persistence | Resistance to switching strategy. |
| Factory influence | Scales extra production buildings as income grows. |
| Taunt rate | Optional chat frequency. |
| Expansion/native target values | Biases attack-target selection. |
| Surrender value | Readiness to concede when losing. |
| Favorite heroes/units | Race-specific hero and strategy biases. |
| Rare profile | Makes selection less frequent. |
Choose OK. Profiles are stored in <VERSION>\Profiles.txt; the manager maintains the tab-separated row.
- Open Strategies, choose New, select the entry, and choose Edit.
- Give Strategy Function Name a short unique identifier without spaces, plus a player-facing name and report.
- Allow it as a beginning strategy and set its main tier to
2. - Choose
uBARRACKS,uBLACKSMITH, anduFOOTMANas representative key assets.
Strategy metadata controls selection:
| Group | Purpose |
|---|---|
| Key assets | Rewards continuity when the AI already owns assets used by this strategy. |
| Beginning/minimum time | Controls opening eligibility and earliest replacement. |
| Type/main tier | Helps allies diversify and favors the intended tech tier. |
| Base, mode, race, and ally bonuses | Establish selection priority for the match. |
| Anti-strength fields | Describe compositions the strategy counters well or poorly. |
| Expansion times | Earliest normal expansion windows, in five-second AI ticks. |
| Hero bonuses | Bias hero selection at each acquisition tier. |
| Enemy-race aggression | Adjust aggression by opponent race and tier. |
Do not make every rating positive. A focused anti-air strategy should gain anti-air priority and lose priority against counters; that contrast drives dynamic selection.
Leave initialization empty for this first strategy. Use these Tier 1 goals:
call BuildUnit(1, hero[1], 140)
call BuildUnit(8, uFOOTMAN, 65)
call BuildUnit(1, uKEEP, 60)Tier 2:
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
call BuildUnit(8, uFOOTMAN, 60)
call BuildUnit(5, uRIFLEMAN, 58)
call BuildUpgr(2, uUPG_MELEE, 45)
call BuildUpgr(2, uUPG_RANGED, 45)
call BuildUnit(1, uCASTLE, 55)Tier 3:
call BuildUnit(1, hero[1], 140)
call BuildUnit(1, hero[2], 130)
call BuildUnit(1, hero[3], 120)
call BuildUnit(6, uFOOTMAN, 55)
call BuildUnit(8, uRIFLEMAN, 60)
call BuildUpgr(3, uUPG_MELEE, 45)
call BuildUpgr(3, uUPG_RANGED, 45)These are desired totals, not a literal queue. AMAI adds prerequisites, workers, and supply. Repeat goals in later tiers when their totals should remain active. Higher priorities are considered first; earlier copies in a quantity receive additional priority using the race's prio_q_inc setting.
Choose OK.
Select the new strategy and choose Lock. Do the same for the profile. Locking removes random selection while debugging.
Choose Compile Version, or run:
.\MakeREFORGED.bat
.\MakeOptREFORGED.batInstall the rebuilt scripts into a test map. Verify the locked names, Tier 1 hero/Footmen, Keep progression, Tier 2 Riflemen/upgrades, and replacement of losses. Consult Troubleshooting#strategy-or-profile-changes-have-no-effect if it stalls. Choose Unlock after testing.
call SetBuildReact(20, 3, uFOOTMAN, 5, uRIFLEMAN, enemy_unarmored + enemy_air * 2 - enemy_normal * 2, 4, 25, 70)This keeps three Footmen and five Riflemen, then distributes 20 additional food between them. At or below strength 4 the pool favors the first unit; at or above 25 it favors the second; intermediate values interpolate.
Extract writes .ais strategies and .aip profiles. Insert imports them and avoids name collisions. Imported strategies contain code compiled into AMAI, so review them before repeating the lock, compile, install, and test cycle.