Fix and extend AI-Battle#1949
Conversation
Flamefire
left a comment
There was a problem hiding this comment.
<RTTR_X> path expansion - all path options (--map, --settings, --lua, --replay, --save) now run through RTTRCONFIG.ExpandPath(), enabling <RTTR_X> placeholders and leading ~. Previously --replay and --save passed paths through as-is.
This looks a bit overkill to me. What is your use case for that?
I don't exactly know if you're referring to the admittedly a bit excessive help text printout or to the use of ExpandPath() itself. |
…t to file-only in headless mode
Head branch was pushed to by a user without write access
|
@Flamefire Clang-tidy failed on one line so I had to push a commit which disabled your auto-merge. Please re-enable it. Thanks. |
|
Merge conflict to resolve |
Missed that. I've merged master. |
… into apexai Adopt MichalLabuda's upstream ai-battle harness + seafaring/pathfinding fixes (PR Return-To-The-Roots#1949) and drop our homegrown replay-sync work, which it supersedes. Discarded from apexai: the HeadlessGame SetupResources and team-pact fixes, the distinct-player-color change, the addon+2v2 and savegame-loading harness commits, and the headless replay-player/verify tool. Kept: the AIJH economy improvements, the ApexAI player (AI::Type::ApexAI), the LLM player (AI::Type::Llm) incl. its sidecar scripts, the AI RNG determinism fix, docs, EGL/QubesOS rendering, and submodule updates. Conflict resolution: ai-battle HeadlessGame.cpp/.h and main.cpp taken from PR Return-To-The-Roots#1949; ApexAI/Llm remain selectable via ParseAIOptions in QuickStartGame.cpp (apexai side). LuaInterfaceBase suppressStdout now comes from PR Return-To-The-Roots#1949. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… into apexai Adopt MichalLabuda's upstream ai-battle harness + seafaring/pathfinding fixes (PR Return-To-The-Roots#1949) and drop our homegrown replay-sync work, which it supersedes. Discarded from apexai: the HeadlessGame SetupResources and team-pact fixes, the distinct-player-color change, the addon+2v2 and savegame-loading harness commits, and the headless replay-player/verify tool. Kept: the AIJH economy improvements, the ApexAI player (AI::Type::ApexAI), the LLM player (AI::Type::Llm) incl. its sidecar scripts, the AI RNG determinism fix, docs, EGL/QubesOS rendering, and submodule updates. Conflict resolution: ai-battle HeadlessGame.cpp/.h and main.cpp taken from PR Return-To-The-Roots#1949; ApexAI/Llm remain selectable via ParseAIOptions in QuickStartGame.cpp (apexai side). LuaInterfaceBase suppressStdout now comes from PR Return-To-The-Roots#1949.
… into apexai Adopt MichalLabuda's upstream ai-battle harness + seafaring/pathfinding fixes (PR Return-To-The-Roots#1949) and drop our homegrown replay-sync work, which it supersedes. Discarded from apexai: the HeadlessGame SetupResources and team-pact fixes, the distinct-player-color change, the addon+2v2 and savegame-loading harness commits, and the headless replay-player/verify tool. Kept: the AIJH economy improvements, the ApexAI player (AI::Type::ApexAI), the LLM player (AI::Type::Llm) incl. its sidecar scripts, the AI RNG determinism fix, docs, EGL/QubesOS rendering, and submodule updates. Conflict resolution: ai-battle HeadlessGame.cpp/.h and main.cpp taken from PR Return-To-The-Roots#1949; ApexAI/Llm remain selectable via ParseAIOptions in QuickStartGame.cpp (apexai side). LuaInterfaceBase suppressStdout now comes from PR Return-To-The-Roots#1949.
Summary
Fixes several bugs in the
ai-battleheadless runner and extends it with new CLI options for wares, addons, and Lua scripting.Bug fixes
GeneratePlayerInfonever setpi.color, so all AI players used a default/zero color. Now assigns colors fromPLAYER_COLORSround-robin.MapLoader::SetupResources(world_)was missing afterLoad(), which could cause out-of-sync errors when playing back replays created using ai-battle.--objectiveflag was ignored -ggs.objectivewas hardcoded toTotalDominationregardless of the--objectiveCLI argument. The hardcoded line is removed so the parsed option takes effect.New features
--wares- controls starting wares for all players:vlow|low|normal(default) |alot.--settings- accepts an INI file with an[addons]section to configure addon settings. Section is the same as in CONFIG.INI file. Non-default selections are logged to stdout after loading. RequiresAddonList::getOptionName()added toAddonListto display human-readable option names.--lua- loads and runs a Lua script viaMapLoader::LoadLuaScript. The script is also embedded into the replay file when--replayis used. Requires a newHeadlessLocalStatestruct (implementsILocalGameState) to satisfy the interface;LuaSystemChatmessages are forwarded to stdout. Messages printed by Lua script are messing up the status table - future fix maybe)<RTTR_X>path expansion - all path options (--map,--settings,--lua,--replay,--save) now run throughRTTRCONFIG.ExpandPath(), enabling<RTTR_X>placeholders and leading~. Previously--replayand--savepassed paths through as-is.Help system
a compact one-line usage hint instead ofthe full option list.--help/-hprints full per-option descriptions plus a path expansion appendixdocumenting all<RTTR_X>placeholders, their per-platform default values, and an example invocation.Edit: