Development > Newbie Coding

Artificial Intelligence

<< < (8/11) > >>

Leviathan:
Perhaps I am oversimplifying, due to a lack of familiarity with the code, but I think the hiding behind soldiers problem could effectively be eliminated by coding for Targets of Opportunity.  By that I mean the "and attack when in range" part of an alien's simple turn. 

For a simple scheme, an alien could attack a soldier when they first come into range, again at some randomized point in movement (some species could get a different # of these, or it could even be modified as part of the individual personality), and again at the end of their movement if a valid target is in LOS.  I would assume this code would be very similar to what already exists for calculating the alien's reaction fire during player movement.

The key, in my opinion, is to hard code for at least one attack at the end of the alien's movement if there is a valid target in LOS and to switch to a melee weapon if range is zero.  Then the effect of the simple AI interpreting a soldier as a place to hide would become, from the players perspective, an alien attempting to charge forward shooting from the hip and then, if successful in closing to melee, gutting them with a kerrblade or sticking them with a plasma blade.  This would make letting the alien get that close a lethal mistake, rather than a comical and exploitable eccentricity in the AI.   

H-Hour:

--- Quote from: Leviathan on April 29, 2014, 06:58:50 am ---  Then the effect of the simple AI interpreting a soldier as a place to hide would become, from the players perspective, an alien attempting to charge forward shooting from the hip and then, if successful in closing to melee, gutting them with a kerrblade or sticking them with a plasma blade.  This would make letting the alien get that close a lethal mistake, rather than a comical and exploitable eccentricity in the AI.

--- End quote ---

If an alien moves, then fires, then moves, then fires, they'll be spending an enormous amount of TU in view of the player's units. This would expose them to a lot of reaction fire. For all the complaints about the AI, they actually seemed reasonably savvy about RF the last time I played.

DarkRain:
@Leviathan
You might be interested in this: http://ufoai.org/wiki/Combat_AI, it's a bit outdated, but things haven't really changed much.

Leviathan:
H-hour:  That is a consideration to take into account.  However, them taking more reaction fire would be at least partially balanced by them delivering more.  My observation of the AI so far is that the way I move my soldiers I take many more shots at they enemy then they return and one of my key disappointments was the item Duke brought up of an enemy that moves to melee and hides behind him instead of finishing off the soldier.  Personally, I do not mind the aliens having more TUs, not only are they alien beings in game context, but I also assume an AI is going to need such an advantage to make it competitive with a human players brain.  An alternative that would be less of a deviation, both in TU and RF, would be to simply add a check at the very end of action:  Am I standing behind a valid target?  If yes, then melee attack.  This would amount to 6 or 7 bonus TUs and a single extra exposure to RF, balanced by all but eliminating the occurrence of an alien hiding in the shadow of a man with a flame thrower and calmly waiting to be invited to the BBQ. :)

DarkRain:  Thank you, the wiki is helpful in understanding your decision tree algorithm.  After reading it, I believe many of my suggested options for enhancing the AI could be coded by giving each alien a set of "personality weights" that alter leaf weights that already exist.  This would allow for both more variation in alien behavior, and the ability of map editors to place squads of aliens that give the appearance of coordination into their maps.  Alternately, the personality choices could be added as what the wiki refers to as "mission targets", but I think the former would be an easier code change.

Duke:  Another item to consider is a set of guidelines for map designers to help them work with instead of against the AI.  For example, earlier this evening I encountered a map with a crashed Harvester that included a hole torn in the side of the hull as a part of the map layout.  The aliens that would normally get stuck in the Harvester waiting for me to flush them out, this time came spilling out the side of the wreck with some of them leaping down from the top floor to suddenly engage as I approached.  The AI was the same, but the ship layout funneled them together and then out instead of keeping them trapped which gave the illusion of an organized push toward my forces.

Duke:
Leviathan: if you come up with a 1st draft of such guidelines, we could easily add it to our wiki.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version