Improved AI Ally Control

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Improved AI Ally Control

Post by beetlenaut »

Losing because the AI allied leader commits suicide is terribly frustrating. The mainline AI control macros don't prevent this in most cases, which is why I created my own menu items. I originally included them in The Founding of Borstep years ago, but these are newly refactored and now have icons and visual indicators. They only require a one-line macro call. Please use this macro if you include an AI side that isn't allowed to die!
AI control image.png
This demo (based on WML Guide) allows you to try it.
AI_Control_Demo.zip
(241.37 KiB) Downloaded 89 times

These are the only files you actually need. The .cfg file has a usage note. The icons can be moved to a subfolder as long as the paths are changed in the .cfg file.
AI_Control.zip
(4.42 KiB) Downloaded 90 times

Notes: There is assumed to be only one human controller, but that wouldn't be too hard to change for multiplayer. Each AI side is also assumed to have only one controllable leader. This is also possible to change, but the macros would have to get much longer.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2364
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Improved AI Ally Control

Post by Lord-Knightmare »

WOAH. Thank you so much for this!
these will be wonderful additions to mainline, but for the time being, I am shoving them into my campaign(s).
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: Improved AI Ally Control

Post by Adamant14 »

Especially now that the AI controller option has been removed from the core, a very useful tool.
I'll use it in my campaign, thank you for sharing.

Are there any plans to add it to the Wesnoth core?
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Improved AI Ally Control

Post by beetlenaut »

I didn't realize that the original one had been removed from the core, but I can see why it wasn't very popular: the AI's behavior seemed to be changed only in very subtle ways. I can't add it to the core myself (I've been out of the loop too long), and I'm not sure it's even possible at this point. The way it is currently written involves some new strings.

Edit: However, adding the icons to the core to make this much easier to implement should be possible at any point. If you think that would be helpful, you could contact a developer. It would mean more coming from several UMC authors.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
egallager
Posts: 583
Joined: November 19th, 2020, 7:27 pm
Location: Concord, New Hampshire
Contact:

Re: Improved AI Ally Control

Post by egallager »

Adamant14 wrote: June 27th, 2021, 11:57 am Especially now that the AI controller option has been removed from the core, a very useful tool.
I'll use it in my campaign, thank you for sharing.

Are there any plans to add it to the Wesnoth core?
I thought it was just deprecated, and not actually removed yet?
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: Improved AI Ally Control

Post by Adamant14 »

egallager wrote: June 28th, 2021, 5:23 am I thought it was just deprecated, and not actually removed yet?
Yes you are right. I thought it will be removed with BfW 1.16.
But they removed the AI Controller from all mainline campaigns with BfW 1.15 , right?
changelog wrote: Version 1.15.0
Campaigns
Deprecate AI Controller and remove it from mainline campaign scenarios
changelog


mattsc wrote: The AI controller is used in roughly 2 dozen mainline scenarios. It certainly has its uses, but it has a whole bunch of issues too.
discussion about the AI controller

If what Mattsc said is true, that the AI controller has been used in so many scenarios, I think it would be wrong to remove it without a replace. If one plays scenarios in which you are dependent on AI-controlled allies, then it can be quite useful if you as a player have the opportunity to at least protect the AI side leader from suicidal actions. Otherwise there is often nothing left but to play the scenario again from the start, which is annoying. Especially when this can easily be avoided with the help of this simple and self-explanatory tool from Beetlenaut.
It is simple, and not as complicated, and as inscrutable for the simple gamer as the old AI controller. And this simplicity is what defines it. Most of the time it doesn't take more than that. Very simple commands:
1. DO NOT commit suicide!
2. Go here!
3. Do what ever you want!

I am in favor of not removing the AI controller without replacement, but replacing it with the Beetlenaut tool.
Who else?
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2364
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Improved AI Ally Control

Post by Lord-Knightmare »

I am in favor of not removing the AI controller without replacement, but replacing it with the Beetlenaut tool.
Who else?
File a FR request at the wesnoth github repo. I can give a thumbs up. however, it can be for the 1.17/master one though.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: Improved AI Ally Control

Post by Adamant14 »

Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2364
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Improved AI Ally Control

Post by Lord-Knightmare »

Adamant14 wrote: June 29th, 2021, 9:01 pm Done

https://github.com/wesnoth/wesnoth/pull/5911
You may want to make a fresher one, as upon checking it, I see something went wrong...horribly. :shock:
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
Celtic_Minstrel
Developer
Posts: 2230
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Improved AI Ally Control

Post by Celtic_Minstrel »

The old AI controller was not removed in 1.16. The plan was to remove it in 1.17. But yes, any uses of it in mainline have been removed as far as I know.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: Improved AI Ally Control

Post by Adamant14 »

Lord-Knightmare wrote: June 30th, 2021, 9:42 am You may want to make a fresher one, as upon checking it, I see something went wrong...horribly. :shock:
Sorry for that. :doh:
Is at Github no moderator who can fix that?
I think I will not make a fresher one, I better keep my hands off it before I cause any more mischief. :augh:
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2364
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Improved AI Ally Control

Post by Lord-Knightmare »

I am currently testing this in a scenario of mine, and I have to say, it's quite nice. However, compared to the previous (now deprecated one), it lacks some things. These things are the modification of the AI aspects of aggression and caution and assigning protection and targeting details. Perhaps, they can be added in?
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: Improved AI Ally Control

Post by vghetto »

This is a well written mod, but as LK has said, it can't act as a drop in replacement for now.
I really hope beetlenaut expands it further. I love the target_x/y approach.

Personally I've already included beetlenaut's freezer/thaw code in my mod. In my case I had to complement it with a bunch of micro_ais to make it apply to all ally units instead of just the leader.
https://github.com/virtualghetto/Wild_F ... .cfg#L2286

Thank you for writing this :)
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: Improved AI Ally Control

Post by Adamant14 »

The big advantage of Beetlenaut's AI controller is that it is not complicated. If I understood it correctly, the old AI controller was removed from the mainline campaigns because it was too complicated and not intuitive enough. If you make Beetlenaut's AI controller just as complicated, what have we gained? Couldn't we have kept the old Ai controller right away? The AI controller actually has everything it takes, the only concession I would add is to assign a goal to the AI.
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2364
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: Improved AI Ally Control

Post by Lord-Knightmare »

If I understood it correctly, the old AI controller was removed from the mainline campaigns because it was too complicated and not intuitive enough. If you make Beetlenaut's AI controller just as complicated, what have we gained? Couldn't we have kept the old Ai controller right away? The AI controller actually has everything it takes, the only concession I would add is to assign a goal to the AI.
Complicated Code is not the issue. It's the results from the code. If the improved one is doing way better than the predecessor, then yes. Everyone will enjoy it. Right now, the starting impression is very positive so addition of working functionality for modifiable aggression, caution, targeting and protecting will be even more appreicated.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Post Reply