Home » PLAYER'S HQ 1.13 » v1.13 General Gameplay Talk » AI Vision Range
AI Vision Range[message #291152]
|
Mon, 26 September 2011 18:56
|
|
ctiberious |
|
Messages:605
Registered:March 2007 |
|
|
So imagine you've got a merc on the map. You know there are enemies out there somewhere but you can't currently see them. So you have your merc raise his weapon and look through the scope he's got attached. And there, X tiles away, an enemy appears. The scope increased the vision range enough that now, with your merc's weapon in a ready position, you can see the enemy. But maybe you decide that there isn't a good enough chance to hit at this range. Or maybe you just want to get into cover. Whatever the reason, you decide that rather then taking a shot, you want your merc to move closer to the target. As soon as you begin the move, your merc's weapon is moved out of the ready position meaning the target "greys out" to indicate the the target is no longer actually seen. But that's okay because you, the player, "remember" where the target was so you can direct your merc to move closer to the target.
The AI can do all of this, to a limited extent. The AI can (and does) ready it's weapons to take advantage of scopes. And the AI does decide whether a shot should be taken based on various factors (including whether the expected CTH is high enough). But unlike the player, as soon as the AI lowers the soldier's weapon, soldier no longer "remembers" where it's target was. Which means the AI can't simply move it's soliders into a better firing position. Litterally, the AI goes from "knowing" where a target is to not "knowing".
I think this gives players an unintended advantage. And I think there is a very simple way to resolve this. There is a function in the code called GetTotalVisionRangeBonus() which calculates all the vision range bonuses granted from all items. However, if a weapon is not in a ready position, scope bonuses don't get included. This is normally fine since we players can still remember what we see after we unready a weapon. I think if we add a condition specifically for AI controled soldier that causes this function to include scope bonuses for unready weapons, this would solve the problem of the AI not being able to "remember" what it "saw" and make decisions accordingly. The AI would still have to pay weapon ready ap costs in order to fire. It would simply get the advantage of always having it's scope bonuses for visibility checks.
Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: AI Vision Range[message #291302]
|
Thu, 29 September 2011 19:26
|
|
ctiberious |
|
Messages:605
Registered:March 2007 |
|
|
@Sandro: Hmm. That's not what I keep seeing in the games tha I play. Admittedly, I'm not really up to speed on the AI code so trying to step through the decision processes tends to leave me with a glazed look in my eye, but what I tend to notice is the AI rarely, if ever, raises it's weapons simply to "look around" using scope vision bonuses, while Players will do this quite often. And if an AI does have a weapon in a ready state, and spots a target but doesn't have a CTH high enough to take a shot, as soon as it starts to move, it no longer seems to react as though it "remembers" where the target was. Yes, it'll know there was a target, but it won't necessarily move towards the target for more then a tile or two. Then it seems to act as though it knows there's a target "somewhere" but has no clue where it should move next to get into a better firing position. My change would simply allow the AI to always get enhanced vision range from scopes, so if it spotted a target, it could move towards the target as expected.
@Sam_Hotte: Actually, after another look at the code, the tunnel vision thing wouldn't be an issue. It's a completely seperate check that is unrelated to the visionrangebonus functions. The result should be that an AI soldier with an unready weapon would get it's usual 360 vision PLUS any scope visionrangebonus modifications in the direction it's actually facing. This does lead to one side effect, though. If the AI is carrying a weapon with a 10x scope, but the weapon isn't ready, the AIs forward arc would get the 10x scopes VRB without any kind of tunnel vision. In other words, in bright light the AI would get a +90% vision range in it's entire front arc. It would only be when the AI actually readied the weapon to fire that it's front arc would tunnel. Now, this might not be a completely unreasonable side effect as it could simulate the AI "panning" it's weapon back and forth along it's forward arc while the AI is moving around. Something players tend to do now. The AI simply has the advantage that it doesn't have to constantly pay the readyAP cost every tile or two like a player would.
Report message to a moderator
|
|
|
|
|
|
|
Re: AI Vision Range[message #291331]
|
Fri, 30 September 2011 14:58
|
|
Sam Hotte |
|
Messages:1966
Registered:March 2009 Location: Middle of Germany |
|
|
ChrisL@Sam_Hotte: Actually, after another look at the code, the tunnel vision thing wouldn't be an issue. It's a completely seperate check that is unrelated to the visionrangebonus functions. The result should be that an AI soldier with an unready weapon would get it's usual 360 vision PLUS any scope visionrangebonus modifications in the direction it's actually facing. This does lead to one side effect, though. If the AI is carrying a weapon with a 10x scope, but the weapon isn't ready, the AIs forward arc would get the 10x scopes VRB without any kind of tunnel vision. In other words, in bright light the AI would get a +90% vision range in it's entire front arc. It would only be when the AI actually readied the weapon to fire that it's front arc would tunnel. Now, this might not be a completely unreasonable side effect as it could simulate the AI "panning" it's weapon back and forth along it's forward arc while the AI is moving around. Something players tend to do now. The AI simply has the advantage that it doesn't have to constantly pay the readyAP cost every tile or two like a player would.
OK, good to know this. Objection retreated.
Maybe it should just be tried out, if your suggested enhanced vision would infact have the intended effect on AI.
TBH, i doubt it: As Sandro said, it seems that AI already does remember where, when and whom they spotted. Despite they tend not to close in as consequently as you expected. To create your intended effect, current AI must differentiate between case A "i do see enemy" and case B "i saw enemy before (and do remeber where and when)". I do not know if that is the case atm.
So, probably trail end error is needed for us who don't know to much of the AIs coding ...
Report message to a moderator
|
Sergeant Major
|
|
|
|
Re: AI Vision Range[message #291361]
|
Sat, 01 October 2011 01:37
|
|
Sandro |
|
Messages:420
Registered:November 2008 Location: Mars |
|
|
I'll make the AI to regularily raise their scoped weapons and scan around. I'll adjust it to be based on if the enemy knows you are in their sector or not etc.
That's actually a few minutes of work. (I expect to make it tomorrow.)
Then we can see how it goes. Ok?
Btw: I have briefly checked the enemy soldier behaviour, if he's gonna pursue my merc he just saw or not (not through scope though)... And he advnaced to the spot or at least got closer in about 50% of cases.
Well, according to the AI code, it really depends on the individual soldier "personality", "orders", morale and wisdom.
To me, this looks ok. Smart guys do not berserk, as they want to survive. Some have been given orders to "hold position", some are simply too cowardly to go there.
The one guy I tested was a regular. I'll check it on elite next.
One thing I noticed, was that quite often a debug message of invalid action or invalid item handle occured. Dunno what impact does it have on the AI in the end.
Report message to a moderator
|
|
|
|
|
Re: AI Vision Range[message #291515]
|
Tue, 04 October 2011 19:08
|
|
Sam Hotte |
|
Messages:1966
Registered:March 2009 Location: Middle of Germany |
|
|
ChrisLMaybe what we need is simply to increase the "memory" across the board. Make it a bit more likely that a regular enemy is going to move closer to a target to get into a usable firing position. I'm not saying that every regular soldier should charge a player. And I agree that morale, personality and orders should still be factored. But if a soldier "can't" fire because the AI says there is not enough of a chance, but moving a couple tiles closer would change that, then the AI should move the soldier so it has a chance to shot.
I don't think that's something to do with "memory" but instead with those red shirt's attitude. I agree with you, that there should be some sort of higher bias to have mediocre red shirts more willing to investigate/attack.
Quote:I've encountered numerous occassions where 10+ enemy soldiers will waste pretty all their APs moving back and forth between a couple different tiles just outside of unenhanced vision range, never taking a shot.
That's because they don't know (exactly) where you are. Yes, that's my observation as well. Especially when they are in player's enhanced spotting range and are interrupted - it seems as if AI makes many soldiers retreat in their steps quite often when these soldiers get spotted and interrupted by player without being shot at (due to player's lack of APs or accurate range). That is, at least, if AI does not know player's exact position (e.g. if they heared just the shooting so far or the soldier that did spot the player was immediately killed/disabled after the spotting)
Quote:And after the battle I've come to find that many of these soldiers had scopes they should have been using. My assumption has always been that the AI couldn't "see" my mercs because the soldier never brought his weapon into a ready state to get the scopes vision range bonus and therefore the cth calculations the AI got all said there was no chance of hitting when, in fact, there should have been at least a modest chance.
I have seen enemies (mostly elites IIRC) that had their weapons raised and spotted around - even one who had no scope attached at all. Weird.
From my observation, red shirts do only raise their weapon if they are in a sniper role, black shirts do aim along the barrel more regularly (compared to red shirts; it's still quite seldom compared to players).
So my conclusion is, that indeed the AI should take more advantage of their scopes and should be more willing to take offensive action (instead of being slaughtered from afar) OR retreat and stay in cover handing the iniative over to player. If the player is forced to leave his tactically favourable (sniper's) position in order to drive the enemy out of cover - that should enhance gameplay as well, IMHO.
Report message to a moderator
|
Sergeant Major
|
|
|
Re: AI Vision Range[message #291538]
|
Wed, 05 October 2011 01:42
|
|
Sandro |
|
Messages:420
Registered:November 2008 Location: Mars |
|
|
ChrisLMaybe what we need is simply to increase the "memory" across the board. Make it a bit more likely that a regular enemy is going to move closer to a target to get into a usable firing position. I'm not saying that every regular soldier should charge a player. And I agree that morale, personality and orders should still be factored. But if a soldier "can't" fire because the AI says there is not enough of a chance, but moving a couple tiles closer would change that, then the AI should move the soldier so it has a chance to shot. I see, I'll check that and give the soldiers a possibility to raise their scoped guns to try to get the extra vision in these cases. (I may already coded that, but I am not sure at this moment, have to look.)
Sam_HotteI don't think that's something to do with "memory" but instead with those red shirt's attitude. I agree with you, that there should be some sort of higher bias to have mediocre red shirts more willing to investigate/attack. True. I'll check if I can do that.
Sam_Hotte... it seems as if AI makes many soldiers retreat in their steps quite often when these soldiers get spotted and interrupted by player without being shot at (due to player's lack of APs or accurate range). This is something I just stumbled on few days ago when coding the improved interrupt system. There was a small glitch in soldier path search when being interrupted (and not shot at,) where the soldier's planned path was erased for no reason. I fixed it in my code, so the fix may make it to main trunk when I finish the IIS.
Sam_HotteSo my conclusion is, that indeed the AI should take more advantage of their scopes and should be more willing to take offensive action (instead of being slaughtered from afar) OR retreat and stay in cover handing the iniative over to player. If the player is forced to leave his tactically favourable (sniper's) position in order to drive the enemy out of cover - that should enhance gameplay as well, IMHO.
The problem is how the AI recognizes if it's the one situation or the other - when retreat, and when charge.
Btw. I have coded that thing - added many chances for enemies to use their scoped weapons to scan around. I may send it to RoWa, but it should be tested first, which I don't have time for.
Anyway, anyway, I will first check if I can solve the specific issue ChrisL mentioned.
Report message to a moderator
|
|
|
|
Re: AI Vision Range[message #291541]
|
Wed, 05 October 2011 02:14
|
|
Sam Hotte |
|
Messages:1966
Registered:March 2009 Location: Middle of Germany |
|
|
SandroSam_HotteI don't think that's something to do with "memory" but instead with those red shirt's attitude. I agree with you, that there should be some sort of higher bias to have mediocre red shirts more willing to investigate/attack. True. I'll check if I can do that.
Cool! thumbs up.
SandroSam_Hotte... it seems as if AI makes many soldiers retreat in their steps quite often when these soldiers get spotted and interrupted by player without being shot at (due to player's lack of APs or accurate range). This is something I just stumbled on few days ago when coding the improved interrupt system. There was a small glitch in soldier path search when being interrupted (and not shot at,) where the soldier's planned path was erased for no reason. I fixed it in my code, so the fix may make it to main trunk when I finish the IIS.
I'd definitely vote for this addition (better: correction) even if your IIS should for whatever reasons not be realized. That alone would make AI more challenging/offensive in tactical IMO.
SandroSam_HotteSo my conclusion is, that indeed the AI should take more advantage of their scopes and should be more willing to take offensive action (instead of being slaughtered from afar) OR retreat and stay in cover handing the iniative over to player. If the player is forced to leave his tactically favourable (sniper's) position in order to drive the enemy out of cover - that should enhance gameplay as well, IMHO.
The problem is how the AI recognizes if it's the one situation or the other - when retreat, and when charge.
True. But i did not mean that AI should make such overall decisions. I meant: If AI decides that a specific soldier is not going to investigate/attack/flanking because of his attitude, lacking morale or whatever THEN it would be great if this specific soldier would not be awaiting certain death at his current place but be moved to cover or any defensivly favorable place if available. E.g. move into a building and stay inside, preferably spotting through door/windows or the like.
Unfortunately i do not have the slightest idea if and how that would be codable for you or somebody.
SandroBtw. I have coded that thing - added many chances for enemies to use their scoped weapons to scan around. I may send it to RoWa, but it should be tested first, which I don't have time for.
Anyway, anyway, I will first check if I can solve the specific issue ChrisL mentioned.
Great! Thanks a lot.
Report message to a moderator
|
Sergeant Major
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Wed Apr 10 23:57:51 GMT+3 2024
Total time taken to generate the page: 0.01524 seconds
|