So far I've usually done AI for 4x-games where you and your opponents start at an even footing and that are about at least somewhat fair competition. In these scenarios having an AI that plays as good as possible was kinda desiarable.
But for X-Com I'm already questioning the sensibleness of what I've done in the past two weeks.
I'm a big fan of your work on Pandora: First Contact.
But it's indeed a thorny path, since current AI means a lot of mods are overtuned against the player and would be pretty near genuinely impossible if the playing field was relatively level. You might easily get a repeat of TDTD 'fixing' the difficulty.
Extended accuracy
penalty (usually 50% loss) in accuracy unless you have personally line of sight.
Yeah, these seem to be pretty much standard in most mods now.
getTurnsSinceSpotted()
You might also want to check 'turnsLeftSpottedForSnipers'. I mean, you're basically writing an AI for an all-sniper, all-spotter team, which is fine and desirable for the base game or mods that don't deviate much from it. But sometimes a modder wants some weaker enemies, or enemies the player can combat by killing their spotters or avoiding their snipers. Llike brainwashed policemen, or farmers with dogs, or gangbangers and their leader, or
Meridian a Predator with spotting drones, etc.
What I did with that was that everyone will be a sniper if there is something to snipe.
What I meant is that I (and I imagine a whole bunch of modders) would prefer if only units with the 'sniper' tag did that. And only 'spotter'-tagged enemies comminicate their vision back to others. I imagine every alien in OG UFO can be considered both a sniper and a spotter, but not every modded enemy is the same.
Taking damage and/or dying from fire of a unit also makes it considered spotted.
Yeah, that's the biggest 'problem' with the current sniper/spotter mechanic. You can't have a marksman who shoots at what their spotter points out, it's either alien death snipers who know exactly where you are if you ever hit someone on their team, possibly for quite a while afterwards, or no snipers at all. Reasonable enough for OG-style aliens who might have psychic sensors in their UFO they can sic on spotted enemies, or something like a giant turret with a crazy auspex. Not so much for when a mod pits the player against a bunch of football hooligans with baseball bats and handguns.
I guess I need something that works similar to turnsSinceLastSpotted but without the part where shooting at someone makes a unit spotted by default.
Well, couldn't you just disable the 'spot offender when hit/killed' part? At worst, make some sort of phantom 'soldier' in the rough direction of where the shot came from?
...smoke-grenades don't help because they only protect in 2D, as you say.
Smoke grenades can also be made 3D with an option, like any other grenade. They do thin out towards the top, but you can always throw some more.
I also have added an anti-smoke-grenade behavior for the aliens. Basically when it thinks it should see someone but doesn't it will move closer until it does.
There are also built-in modding tools to help: heatvision and psi-vision.
Oh right, proximity-grenades. ... I need to know what proximity will trigger them and then add code for the aliens to avoid them.
Being right next to them, i.e. in one of the eight adjacent tiles or the tile it's located in. Right above/below seem fine.
Make sure not to completely invalidate them, or smokes for that matter. Players will not be happy if you make their toys totally useless.
However, this does not apply to certain (sniper) weapons and grenades.
But it does? I recall Starving Poet being extra salty when this was implemented in the middle of his XCF stream, and he ended up modding this back to a much lighter penalty than the default 50%.
Of course a modder can
make their grenades no-LoS, but that's a deliberate choice.
Also interesting that using instant-grenades isn't a good solution because it makes it easier due to not allowing for reaction-fire of the naded alien.
An insta-naded alien can definitely return fire. A smoked alien might not, and there are also mods that use TU-sapping weapons like flashbangs that might also rob them of the ability without removing LoS.
I always play with instant grenades, but ones with limited range (12 for ones with weight 3, something like 4 for demo packs that aren't really all that throwable IRL). 12 might even be too generous. I also tend to make them less accurate and explode in inventory when the time is up. Grenade range is one of my biggest pet peeves with the game. One that virtually no-one else seems to share, though.
These are game mechanic issues and I don't see how it could be addressed in AI code.
The 'brutal' AI can (try) to learn to use them?
Finally, while Vakrug's point about UFOs being fortified castles is rather hyperbolic (and you might
not have a UFO at all, nor a player craft for that matter), one of the things I very much liked about Xenonauts was how their AI camped the hell out of UFOs. They were a bit cheaty, as in knew
exactly when your troopers had run out of TU for reactions and opened doors (and fire) just at that moment, then gladly waited until you tried opening the door yourself and blasted you at point-blank range when you did. Not to mention UFO bridges full of valuable equipment (which tended to suffer in the firefight) and the deadliest aliens on the map, lurking behind consoles and along the walls, catching you in an almost unavoidable crossfire. I killed many a UFO door to kill/suppress the ETs lurking just behind.
Well, that and their Reapers' habit of sneaking up behind soldiers and giving you heart attacks.
My approach was more like: I wait until someone shows interest (e.g. tells me they'd like to start streaming it) and then release the newest I have up until that point.
That might be a long wait.