AIs: Ideas for how to fix this AI problem?
Moderator: Forum Moderators
AIs: Ideas for how to fix this AI problem?
It's starting to annoy me that the AI does not have a clue how to respond to units with Ambush or Nightstalk, or any other ability that makes units hide. I once fought the AI while playing Rebels, and it was Northerners; I retreated a Wose who had only 5HP left from its battle with a Goblin Knight, moving him three hexes away, into a single space of Forest surrounded on all sides by grassland.
Any human player would have realized that there was obviously a weak unit hidden in that Forest, since the Wose could clearly be seen going in. But since the AI apparently doesn't process the significance of animations, the Goblin Knight proceeded to leave the injured Wose and attack my fully-recovered, village-stationed Elvish Champion instead, and got killed for its trouble.
Is there an AI that recognizes hide-related stuff like this? If so, where could I download it? If not, does anyone have ideas for how to go about writing one?
Any human player would have realized that there was obviously a weak unit hidden in that Forest, since the Wose could clearly be seen going in. But since the AI apparently doesn't process the significance of animations, the Goblin Knight proceeded to leave the injured Wose and attack my fully-recovered, village-stationed Elvish Champion instead, and got killed for its trouble.
Is there an AI that recognizes hide-related stuff like this? If so, where could I download it? If not, does anyone have ideas for how to go about writing one?
"Don't you worry about cancer?"
"I AM cancer. I do not frighten myself."
"I AM cancer. I do not frighten myself."
Re: AIs: Ideas for how to fix this AI problem?
I don't code in wesnoth lingo, but if I'd do it my imaginary language I'd do it like this:Varthonai wrote:Is there an AI that recognizes hide-related stuff like this? If so, where could I download it? If not, does anyone have ideas for how to go about writing one?
At end of each turn the current players units will all memorize the position of all enemy units they actually do see. This is done by using variable arrays or whatever.
Your Turn 1: You stand within sight of the AI with your damaged Wose. AI:s units "memorizes" your Woses position.
Your Turn 2: You move a damaged Wose into a forest. This happens every single hex your unit moves -> Because your unit was within sight of the enemy it is on a checklist. The checklist tells the game to let the AI memorize your units new position if and only if it's within sight range of any of the AI:s units. That way, when you move the Wose 3 hexes, hex 1 will be "seen" by the AI, hex 2 also, but hex 3 won't since it will result in the Woses hiding in the forest. So, the last thing the AI will know about your position is that it was on hex 2.
The next step is to make that information useful for the AI and make it worthy its name

That's the basics done my way in wrapped up sloppy. = P You'd of course wan't to add a million other things as well to not make the AI fall for traps etc, but that's another story.