New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quickstart AI Battle #1565
Quickstart AI Battle #1565
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, well done overall, just a few bits for polishing 👍
@Flamefire Tomorrow, I'll check if it is possible to save and load an ai battle. |
Starting an AI-Battle from a savegame seems to work. The provided AI players ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far, just a few minor improvements, especially making stuff const correct/const-where-possible,
Just a remark: Short-ish single-line statements after if
/for
/... don't need braces. Indentation (enforced via clang-format) already take care of potential bugs. No need to remove them as they don't hurt, just might save you some work.
There is still a bug though now that I'm thinking about it: aiBattlePlayers_
is never reset, this means after the first such quickstart every game will be considered an AI battle. I guess this reset (clear) can be best done in GameClient::Stop
Co-authored-by: Alexander Grund <Flamefire@users.noreply.github.com>
I did not see an existing UT for |
As that method is not critical I'm OK with missing coverage for that, as we have the review at least. If you can come up with a test then feel free. However I imagine that this would be very complicated due to the client, server, windowmanager and desktop being involved (so it's rather an integration test). Hence the idea to factor out the AI name parsing to have at least that tested, and skip the rest which "should work" after inspection ;-) |
This change allows to quick-start into an AI-only game.
Example:
./bin/s25client -m share/s25rttr/RTTR/MAPS/NEW/Bagel5.SWD --ai aijh --ai aijh --ai dummy
Will result in
Implementation:
This change adds a new program option (
--ai
) and extendsQuickStartGame()
.In order to have the requested AIs ready in
dskGameLobby
, the AI configuration is stored inGameClient
.In
GameClient::GameLoaded()
we callToggleHumanAIPlayer()
to turn the human player into an AI as well.Notes:
There are no further limitations. The user can still add buildings and roads.