[engine] AI/micro_ai idea - would anyone else find this useful?
Moderator: Forum Moderators
Forum rules
Before posting a new idea, you must read the following:
Before posting a new idea, you must read the following:
- Spannerbag
- Posts: 759
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
[engine] AI/micro_ai idea - would anyone else find this useful?
Hi,
Just curious if anyone would find this idea useful, plus any suggestions as to if it can be done with the existing AI tools.
What I'd like is to have a
In one scenario I'm testing this would have been handy but I've got the scenario working well enough with existing
I was thinking of having a MAD micro_ai (Mutual Alliance Disabled).
Any comments very welcome.
Cheers!
-- Spannerbag
Just curious if anyone would find this idea useful, plus any suggestions as to if it can be done with the existing AI tools.
What I'd like is to have a
side
whose units are mutually antagonistic, i.e. as well as attacking units on other sides they also attack each other (but possibly with a lower targeting value than units on other sides so given a choice they attack units on other sides).In one scenario I'm testing this would have been handy but I've got the scenario working well enough with existing
side
s, just thought I'd ask here to see if anyone else would find this idea useful.I was thinking of having a MAD micro_ai (Mutual Alliance Disabled).
Any comments very welcome.
Cheers!
-- Spannerbag
- Lord-Knightmare
- Discord Moderator
- Posts: 2475
- 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: [engine] AI/micro_ai idea - would anyone else find this useful?
Call it maybe
ai_type=frenzy
? (Like in Skyrim?)Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
I think instead of having this applied to a side, you'd have it applied to a unit (you could then, of course, apply it to all units on a side if you wanted). And it would be contagious. And probably be called 'rabid'.
Speak softly, and carry Doombringer.
- Spannerbag
- Posts: 759
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
Yep, but the only way I can see of having awhite_haired_uncle wrote: ↑July 15th, 2024, 9:29 pm I think instead of having this applied to a side, you'd have it applied to a unit (you could then, of course, apply it to all units on a side if you wanted). And it would be contagious. And probably be called 'rabid'.
side
with "regular" units plus some lunatics who attack everything including their own was via a micro_ai
?I don't think there's any way a
unit
can override it's side
's team_name
?Your contagious idea could be huge fun in some situations - but I've no idea how to implement any of this or even if it's possible...

Cheers!
-- Spannerbag
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
I can see how this might fit with a campaign storyline in some situations, but...
- It seems like it would violate the KISS principle pretty bad.
- It would require changes to more than just the AI, wouldn't it? I don't think it is even possible right now for a unit to attack its own side?
- It would lead to some weird/pathological situations. For example, suppose a side has some units with leadership. If a unit with leadership were attacked by another unit from its own side, would the attacker gain the benefit of the leadership (while attacking its own leader)?!
- Spannerbag
- Posts: 759
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
Re. your points, all good.gnombat wrote: ↑July 16th, 2024, 11:41 am I can see how this might fit with a campaign storyline in some situations, but...
An alternative approach might be to have some code which generates a new side for each and every unit, and assigns the unit to that side. I'm not sure this is possible, but it seems like it might work (using wesnoth.sides.create).
- It seems like it would violate the KISS principle pretty bad.
- It would require changes to more than just the AI, wouldn't it? I don't think it is even possible right now for a unit to attack its own side?
- It would lead to some weird/pathological situations. For example, suppose a side has some units with leadership. If a unit with leadership were attacked by another unit from its own side, would the attacker gain the benefit of the leadership (while attacking its own leader)?!
Leadership (and other abilties/specials that involve interactions between units on the same side such as healing or distract) are irrelevant; these units are all enemies so none of these would be appropriate.
Also, it should be impossible to ally with such a side - which is something I didn't think of until after I posted my idea/query.
My understanding is that a
side
's team_name
(s) determines friends and enemies, i.e. who is "attackable".I wondered if it might be possible to craft a special
team_name
(something unlikely to be used such as "UniversalEnmity") that might allow this behaviour to be possible but as I say, no idea how to do this or even if it's possible.Maybe a more secure way to do this would be to have a key within a
[side]
or maybe even a new side definition tag for this situation.Yeah, did think of spawning a new side for each and every unit... but it seemed overkill and I've no idea if there is a limit to the number of concurrently active sides a scenario can accommodate (there are potentially a lot of these maniac units in my scenario).
But yes, that's an approach that could work if you can have ~50 sides in a scenario (maybe less because I could re-use an existing side once their only unit is killed).
Would need to set a few elements for the newly created side, I'm guessing wesnoth.sides.get could do that?
Might try this when I get chance.
Thanks for taking the trouble to reply, much appreciated.
Cheers!
-- Spannerbag
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
Hmm, you think leadership and healing are restricted to the same side? Not so much. Anyway, it's still a problem based on your original specification. If unit A on side S attacks unit B on side S and unit B has leadership (applied to same team), does A benefit from it? Technically, they're both on the same side, even though they are fighting each other. And that's just one example of weird stuff.Spannerbag wrote: ↑July 17th, 2024, 11:03 am Leadership (and other abilties/specials that involve interactions between units on the same side such as healing or distract) are irrelevant; these units are all enemies so none of these would be appropriate.
...
My understanding is that aside
'steam_name
(s) determines friends and enemies, i.e. who is "attackable".
Not that it matters, I can't imagine you can make a unit attack another on the same side during that side's turn. While team does control friends and enemies, they are on the same team. And there's a lot of places that I've seen in code/docs that assume same side = friend, IIRC.
You might be able to force combat using something like [do_command][attack]. Might. Maybe.
What you could do pretty easily is to have a manic unit do damage to adjacent allies when fighting an enemy, though I think I'm veering off from ideas to UMC here.
Speak softly, and carry Doombringer.
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
The SideWML documentation says, "There is no hard limit on the number of sides a single scenario can have."Spannerbag wrote: ↑July 17th, 2024, 11:03 am Yeah, did think of spawning a new side for each and every unit... but it seemed overkill and I've no idea if there is a limit to the number of concurrently active sides a scenario can accommodate (there are potentially a lot of these maniac units in my scenario).
But yes, that's an approach that could work if you can have ~50 sides in a scenario (maybe less because I could re-use an existing side once their only unit is killed).
That having been said, I don't know how well ~50 sides would work in practice. Possibly there might be other issues (e.g., the AI might start getting confused when there are that many sides).
- Spannerbag
- Posts: 759
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: [engine] AI/micro_ai idea - would anyone else find this useful?
Thanks for all the thoughts and comments, much appreciated.
I think for now I'll stick with what I have as it works but might revisit this once I have everything else done (if I'm not completely sick of the damn thing by then).
Thanks again.
Cheers!
-- Spannerbag
I think for now I'll stick with what I have as it works but might revisit this once I have everything else done (if I'm not completely sick of the damn thing by then).
Thanks again.
Cheers!
-- Spannerbag