So then the first way to evaluate is to award favourable points to any place on the map as an end point.
1. Do I know of any enemy in view (of that alien or a teammate, to include some cooperation)?
2. Can I go somewhere that has views in other directions that I or my teammates currently have? (what places are not in line of sight?)
3. What places (within my TU range) have cover on many sides (NSEW)?
Last night I was having a discussion with arakis on irc about the AI and I realized that the AI actually cheats major-style in the visibility department. FighterBestAction checks for visibility on the target before considering to shoot him, which tricked me into thinking that it's all kosher. What I did forget though is that it sets the aliens ent->origin at the spot it's considering. This means that all the aliens get futuro-vision and know what they can see from any spot they can move to before actually going there. I previously assumed the autopsy reports are to blame for behaviour indicative of that (they all say they have perma-IR vision), but it may just turn out to be this one.
This little trick actually makes away with all the visibility considerations that the AI ever needed to ever make. Should we ever decide to drop this AI shortcut, we will need to make up for it with some heavy visibility calculations. This is definitely a way to improve the 'feeling' of the AI that adds a penalty to it's effectiveness lest we do vis checks much better. A pragmatist I am not, this is definitely something I'd like to try out, but when other areas are finished first (everything set @todo already in my posts, quite a few).
For the pragmatists that will definitely ask 'why should we nerf the AI and then augment it again instead of just keeping the cheat in place?', here's a couple of reasons why we should:
* Ever managed to sneak up on an alien? Me neither.
* You can actually employ tactics like distraction much more effectively. Your rabbit down there is getting the alien behind the window on the 1st floor to try and shoot at him rather than checking if someone is sneaking up on him. As it is right now (since I've tried this tactic), the minute your backstabbing guy gets anywhere close to the sniper, the sniper lets the rabbit go. Ofc your tactic still works when the sniper promptly gets stuck behind the corner.
* The aliens will look much more active. They will actively patrol areas (the vis maximization score) trying to find targets.
* I suspect that this will make them <3 their sniping positions. As it is right now, mappers place perched aliens to godly positions, only for the CLOSE_IN metric to kick in and leave their position in turn 1.
All your listed metrics sound quite proper for this task. Say, are you interested in some coding-fu?
Now if an enemy is in view, you get additional considerations:
4. What places are closer to visible enemies than my current position?
5. Where are the (three?) nearest visible enemies (average into a 'centre of gravity')
6. Where are the (three?) nearest friendlies (average into a 'centre of gravity')
7. What is the main line of fire (vector between centres of gravity), in what places could I get line of sight to an enemy from a different/cross angle? (more teamwork)
8. What places are available where the known enemies cannot see me?
9. What places are available where the known enemies have trouble hitting me?
Calculating clusters of enemies/friendlies! Excellent idea!
At least for the enemies, I can see this getting in asap is for the close_in metric. Try and approach the centroids of clusters (mmmm, clustering algo's here I come) instead of individual targets. I'll be doing the changes in the close_in right after the guete's and the wiki, so let's see what we can get here
As for clusters/centres of friendlies, hmmm. I don't think we could use this as a bonus metric since that would make aliens slowly pack in tight spots, but as a penalty metric (don't wander off X tiles away from your local group unless you have a good reason), it sounds really nice.
(7) is an interesting point. I was thinking something along this lines when trying to imagine how we could possibly define our&enemy lines. Cluster us, cluster them, sketch line between centroids, draw perpendicular line on either side (length varies with dispersion) and voila! A basic definition of a combat front for either side. Sweet part is that it can work the other way around, so if a chosen tactic requires moving your front, you can just add bonuses to spots that move centroid&dispersion accordingly (that goes to the decomposition to primitives mentioned in the theorycrafting of machine learning).
(
and (9) are already calculated, well it's more of a gradient of visibility.
Now all the places that are interesting to be are already known. Some are safe places and some are not at all safe (if you can see them, they can usually see you). But for attacking, some of the squares with LOS to an enemy need to be evaluated further.
10. What weapons do I have in my hand? Can it/these hit from there?
11. In case I go there and shoot, what is the safest place I can end up in?
12. What other weapons I have in my inventory? Can they hit from there?
13. In case I go there and change weapon and shoot, what is the safest place I can end up in?
Thinning out some more squares in this way comes the attack calculation
14. What damage can I expect from shooting with any of my weapons from that square?
10&11 is already properly evaluated. So is 12&14, I think, but there are some obvious shortcomings. 13 is implied because of the search tree and the fact that we count the remaining TU's.
In this system, each place could be evaluated essentially by five variables: VIEW (how much lookout do I have), SAFE (cover/hiding), HIT (can I attack), DAMAGE (how much can I inflict) and TIME (how long will I spend there). You would want to plot a route within the maximum total TIME from where the alien is now to somewhere with high SAFE, while stopping somewhere with high HIT and DAMAGE and shoot, as well as passing through as many places as possible with high VIEW.
Barring the VIEW metric (which is totally ignored because of god-o-vision), the rest are the basis of the current AI: SAFE is definitely in there and HIT&DAMAGE are merged into one multiplicative metric (named damage). The plotting of move-shoot-hide is exactly what the search tree is currently doing. With emphasis on the exact move-shoot-hide.
Excellent ideas all around