Implementing invisibility in AI
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:
Implementing invisibility in AI
I find it a little frustrating that the AI always knows *precisely* where all of my "invisible" units are. I was thinking about easy kludges to make this at least a little believable... (A real solution to the invisibility problem is, admittedly, quite difficult.)
What if the AI assumes that each invisible unit that was visible in the previous turn is somewhere within 2-3 hexes of its actual position (if we're talking about a unit that is only invisible in certain terrains, then limit this to the hexes in this radius that have the appropriate terrain) -- when it sends a unit to attack, it goes for that spot. If it is not "ambushed", then it makes another guess.
If the unit was not visible in the previous turn, then it should be a complete unknown to the AI, so that the AI does not consider it at all in its attack and defense calculations.
I think this would at least make it seem plausible that the AI doesn't really know where my units are, but at the same time not make it totally stupid -- "Hmm... that Elvish Ranger just disappeared... couldn't possibly be hiding in this little copse right next to my castle..."
Anyway, this a rough idea, but maybe it inspires someone. If I ever get a lot of extra time, I might try to actually look at the code and see if I can hack out an example, but I wouldn't count on that happening soon...
What if the AI assumes that each invisible unit that was visible in the previous turn is somewhere within 2-3 hexes of its actual position (if we're talking about a unit that is only invisible in certain terrains, then limit this to the hexes in this radius that have the appropriate terrain) -- when it sends a unit to attack, it goes for that spot. If it is not "ambushed", then it makes another guess.
If the unit was not visible in the previous turn, then it should be a complete unknown to the AI, so that the AI does not consider it at all in its attack and defense calculations.
I think this would at least make it seem plausible that the AI doesn't really know where my units are, but at the same time not make it totally stupid -- "Hmm... that Elvish Ranger just disappeared... couldn't possibly be hiding in this little copse right next to my castle..."
Anyway, this a rough idea, but maybe it inspires someone. If I ever get a lot of extra time, I might try to actually look at the code and see if I can hack out an example, but I wouldn't count on that happening soon...
Re: Implementing invisibility in AI
I was under the impression that the AI only knows the location of your leader even if it's hidden, not your regular units (which it seems to forget/ignore entirely if they're hidden).mpolo wrote:I find it a little frustrating that the AI always knows *precisely* where all of my "invisible" units are. I was thinking about easy kludges to make this at least a little believable... (A real solution to the invisibility problem is, admittedly, quite difficult.)
Otherwise your idea sounds pretty good.
Maybe he just got lucky then -- it just looked a couple of times like he went straight for the invisible troop, even ignoring the convenient target I had put to distract him... In any case, I think the idea is sound as a way to make it more like the AI is dealing with invisibility "fairly" (for both sides...)
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
I'm actually pretty sure that AI doesn't have a clue where your hidden units are. Of course, the map can make it look like they find them all the time.
I specifically remember playing Battle World in 1.1.x where I hid a bunch of Elvish Avengers in the forest to the west, within one turn's reach of the Orcs just east of there. I waited for the Orcs to recruit one big set and then send them north after which I waited a couple rounds and then pounced on the leader. It was really clear that the AI wasn't expecting it, and sent all of its units to backtrack.
Do you have any counter examples? I'm not saying your proposal isn't a good either either, I'm just not sure the AI works like you think it does. Someone should do some tests to get a definitive answer.
I specifically remember playing Battle World in 1.1.x where I hid a bunch of Elvish Avengers in the forest to the west, within one turn's reach of the Orcs just east of there. I waited for the Orcs to recruit one big set and then send them north after which I waited a couple rounds and then pounced on the leader. It was really clear that the AI wasn't expecting it, and sent all of its units to backtrack.
Do you have any counter examples? I'm not saying your proposal isn't a good either either, I'm just not sure the AI works like you think it does. Someone should do some tests to get a definitive answer.
Re: Implementing invisibility in AI
Well, that is all nice and soundly in theory but it is very hard to teach a computer such kind of things.mpolo wrote:I think this would at least make it seem plausible that the AI doesn't really know where my units are, but at the same time not make it totally stupid -- "Hmm... that Elvish Ranger just disappeared... couldn't possibly be hiding in this little copse right next to my castle..."
I was working on the proof of one of my poems all the morning, and took out a comma. In the afternoon I put it back again. -- Oscar Wilde
Re: Implementing invisibility in AI
That's why I provided a pseudo-algorithm: the computer AI "guesses" where the unit is and gets it right within 2-3 hexes. That gives enough error that he can't just home in, but doesn't have him totally ignoring units that sneak up on him. Of course, no human could keep track of where the invisible unit might be for more than 1-2 turns, so I proposed that the computer be made oblivious to the unit on the second turn in a row that it was invisible.Baufo wrote: Well, that is all nice and soundly in theory but it is very hard to teach a computer such kind of things.
It's not a perfect algorithm -- you could use an invisible unit just out of range to draw off the enemy, then move it to another spot where it's invisible, yet closer, and still snipe him. But I think it's better than nothing...
IIRC the AI ignores fog-of-war and shroud. So that couldn't be the explanation of why it didn't attack you...
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
And I hate stupid people.
The World of Orbivm