Jump to content

Recommended Posts

After noticing that we now have a new AI programmer on the Xenonauts team, I'd like to give that individual a warm welcome.

I'd also like to talk about AI in Xenonauts and the sort of technologies that might be employed, provided this doesn't ruin anyone's enjoyment.

I admit that this topic is something I really like, and I've taken a plethora of modules related to academic AI (and a few books and materials on AI actually put in games). I admit to a complete absence of knowledge of the sort of AI used in previous UFO games and the AI that may be planned.

So I'm curious about two things:

- What sort of AI did the good ol' games employ?

- What might Xenonauts be looking at using? Threat maps, simple finite state machines, decision trees?

Link to comment
Share on other sites

Wow, thanks for responding directly Chris. I appreciate the effort and look forward to talking about it. Maybe if he has time, we'll even see our new coder pop by here ^^.

I admit that a quick googling might have helped with 1. A limited insight of UFO: EU's AI was visible from people 'patching' it: http://www.rpgcodex.net/forums/index.php?threads/ufo-ai-patch.58716/

Edited by Sunshard
Link to comment
Share on other sites

i do remember some aliens stayed at the alien ships hidden, others in buildings, others waiting for you at the ufo entrance.... very annoying..... many times lost good soldiers to reaction fire... some missions could take more than an hour to find the hidden ones

Link to comment
Share on other sites

others waiting for you at the ufo entrance.... very annoying..... many times lost good soldiers to reaction fire...

A realistic behavior. I'd do the same if I were them. And I do use that tactic with base defence. It's annoying because it's effective and therefore realistic.

I agree that in the long run, it became annoying combing the map for the last little alien hiding somewhere.

Link to comment
Share on other sites

It's getting so dark, so cold in here....

Jokes aside, a cursory glance at reverse engineered knowledge from UFOpaedia suggests a number of things about the data available to the original UFO AI:

- Aliens were given ranks, affecting loadouts and most critically a value labelled intelligence; the number of turns for which the alien would remember your troops' locations. It is unknown if the aliens had co-ordinated efforts.

- At the beginning of combat, aliens knew where everyone was and this last known information was preserved for as long as their intelligence allowed (Allow them to react appropriately to your general direction, I would assume). This is updated only when you come into vision range.

- Past turn 20, they were granted perfect knowledge of the map. This was probably to speed things up.

Link to comment
Share on other sites

One of the big issues is always pathing and I'm not talking about finding the door in a room. =)

If you want the aliens to do more than just do bajonet charges, they need a more complex idea of where they want to be.

One way to do this is a kind of heat map.

Danger zones spread out from... "events".

Each turn, the danger value of each segment is reduced a little while new events are added.

A human soldier being spotted, an alien getting shot at. Those would be the basic events.

pathing_1.jpg

The alien could now decide to flank the soldiers (or run away), simply because those areas look less dangerous.

pathing_2.jpg

If the alien is under fire while farther away, it has a lot more options, but as a combat unit, it would probably decide to "engage the enemy more closely". =)

It's a dynamic system which doesn't bog down the AI with specific rules like "go 3 tiles to your left if XYZ happens".

Aliens would also appear to work together and encircle Xenonauts, simply based on the layout of the heat map.

They would retreat from zones where they come under heavy fire and try to work around them instead of charging straight into MG positions.

Obviously this works best in open field battles because it's not so cut and dried within buildings. The basic principle can still apply although the range that such an event affects has to be considerable smaller within an enclosed space.

And no, I didn't just come up with that. It's one of the classic ways to design an AI when you don't have the benefit of static maps where you can place pathing nodes and pre-plotted maneuvers.

Often enough, "group behaviour" can be coded without taking any other group members into account.

I did that in a fighter AI in X3 (which has to run in realtime as well as in 3D so the available CPU time was... quite limited), so that a swarm of fighters could engage a single, stronger opponent. The current "target" of the prey would do it's utmost to run away while the other members of the pack attacked. As soon as the prey switches to another hunter, this one starts evading. The effect is that of a wolfpack, wounding the prey until it's dead.

Yeah, it looks a lot better in realtime than in a dry explanation. =)

My point is that I did not create any group behaviour. It just happens because of the way the individual units act.

pathing_1.jpg

pathing_2.jpg

pathing_1.jpg.8301d808cec456d7cc8361ca78

pathing_2.jpg.79e2362d990b03dd7645420be2

Link to comment
Share on other sites

Heya Gazz. That sounds a little like the concept of steering; did this inspire your design in any fashion?

Threat maps and finite state machines are still the bread & butter of the industry, but it's always interesting when it comes to making emergent AI; the hope is that the AI does things that you wouldn't expect, even if the rules are easy for both designer and player to discern.

Admittedly, you want 'good' unexpected rather than the often apparently 'idiotic' unexpected.

Link to comment
Share on other sites

Well, my design was more influenced by the fact that I couldn't realistically use as much CPU power as I wanted with a high enough decision frequency and still have the game run at managable FPS.

I cut soooo many corners. =P

The result is not smart at all - it just gives the impression. And games are all about the illusion.

So if it's required for the Xeno AI to cheat to provide a noticable challenge, that's what it'll have to be. As long as it doesn't have perfect and constant X-Ray vision of the entire battlefield...

Link to comment
Share on other sites

I would have said 'cheat' ;)

Cheating is something like bending the rules of the game to the point where the aliens can shoot you from places you couldn't shoot them, or getting boni to hit or damage past whatever weapon characteristics they have.

'Cheating' to get them in good positions, or to move 'intelligently' can be waved away pretty easily as a hive mind or whatever.

My opinion (for what it's worth) is that aliens should have two main AI modes. Hunter, or Hunted. But they should never really just run away and hide (because that leads to tedious and dull missions).

In Hunter mode they actively try to advance, flank, charge, whatever to 'hunt' the humans. In Hunted mode they find a defensible position (or they just start in one) and wait for you to come to them. Of course if an alien lacks a ranged attack then hunted doesn't work quite as well.

Anyway, sounds pretty promising to me, can't wait to see what the final version is going to be :)

Link to comment
Share on other sites

If the responses to stimuli are good enough then they will switch between offensive and defensive behaviour as they need to.

If they outnumber the enemy then they are more likely to advance, outnumbered (or taking a lot of fire) they will be more likely to find cover for example.

Some races of alien might actively hunt enemies while others will concentrate on completing their own objectives.

They may prefer to find friendlies and stay in groups or to separate to find individual glory.

That would be their default setting at the start of the mission, until other stimuli made them react differently.

The aliens aren't cheating either.

They just have a lot of ships in orbit pointing sensors at the battlefield.

That's why they know where you are when you are technically out of LoS.

Honestly, would they lie about that.

Link to comment
Share on other sites

Based on what info/data would you set the Hunter or Hunted mode at the beginning of the 1st round?

A good question. I'm not really up to speed with everything Xenonauts so I'll try to be general, and if it doesn't fit for some reason, then you'll understand why :)

It could be as simple as a coin flip to start the mission. It could have to do with the map generated. It could have to do with 'knowledge' of whether the aliens are outnumbered or not, or 'out powered'.

If the later two, then the behavior could change (should change?) during the combat such that if the Aliens find themselves in 'Hunted' mode, but shift the balance by giving enough casualties to the humans they change to 'Hunter'. And vice versa if they started on the offensive, but took many casualties. The trouble here is how do the Aliens 'know' what the numbers (or power) are? Personally I'm fine with them simply knowing this all the time, I think the sudden shift from offense to defense or vice versa would be interesting for game play and am not concerned about how realistic it is. Though I'm also not concerned if they use some simple metric along the lines of once they lose 50% of their force or take out 1,2,3,... (some reasonable number) of the humans they shift gears.

But I'm no AI coder (or regular coder for that matter). I'm just spilling my brains :)

Link to comment
Share on other sites

Having the Hunted/Hunter switch be based partly on the species would be interesting, as it would mean that different alien types would result in a significantly different mission.

Another factor might be the type of mission they are on; terror missions could be all-out offensive, while exploration missions would be more likely to have them take up a defensive pose (hoping to launch the UFO again before having to engage).

Not sure how it would go for crew of a crashed UFO; you could have it go either way really. They could take a defensive posture either because they are anticipating pickup, or are simply still recovering from the landing; likewise they could be aggressive as they are not anticipating rescue and so their only hope of escape is to break out.

Link to comment
Share on other sites

By the way, will there ever be a possibility for aliens to surrender? MrPyros statement about a breakout-last-stand as the aliens' last hope got me thinking.

Surrender is an option that gets overlooked all too often in war and action games, and I personally like it when games incorporate it, but I'm not so sure whether it'd be appropriate in an Alien Invasion! context.

Link to comment
Share on other sites

I don't know how I feel about this hunter/hunted idea. Doesn't it mean that the aliens go into hunted mode every mission? Sounds like it will be annoying if the programmer has to accomondate that kind of thinking and make 2 modes for (nearly) every type of alien. I think it would be in the way of more interesting and useful concepts to be honest. I can't really give any reason to why I dislike it beyond that I think it would be annoying for aliens to (allways) go extra defensive when there's only a few left to round up.

Feels like it is trying to do 2 things: 1) attach some (in my opinion unfitting) idea of reality to cornered aliens 2) replace the morale stat.

Link to comment
Share on other sites

The aliens don't have to change mode at all, that was just a suggestion that it would be interesting if they occasionally did. Though you're right, it is about 'realism' to a degree, it's also about challenge.

If you set up a kill zone do you just want the Aliens to keep on pouring into it and getting shot to hell? Or do you want them to group on the outside of it and exchange fire? I don't know, there are a lot of variables to worry about anyway. I'm more interested in making the setting based nearly entirely on mission, and not change, other than go from hunted to hunter. Missions where you have to storm a position vs. missions where you have to defend a position (and base defense is rarely this, base defense is usually just hunt the aliens hiding in your base, maybe Xeno has a better way to do those though) vs. missions where there is lots of open terrain and it's just pretty chaotic.

Link to comment
Share on other sites

Why not take the concept of the "last annoying alien" and turn it into something awesome?

Create a new psych-status called "cornered". Factor in things like remaining allies and spotting hostiles outside of current cover. This would obviously only work for certain aliens intelligent enough to comprehend that they are in a losing situation.

Somewhat randomly, and somewhat based on the alien's bravery (or whatever morale will be based upon), they will perform any of the following actions when cornered.

In order of increasing bravery:

1. Surrender - This is the worst result for the aliens, the best for the Xenonauts. They basically just drop their weapon and walk away from it. They count as "neutralized" for the purposes of ending the mission. You gain a live alien for research.

2. Suicide - Self-inflicted plasma blast to the head (if suitably armed for this action). Alien knows it will be interrogated if captured.

3. Blaze of Glory - Similar to suicide, but it tries to take out as many humans as possible as it comes out guns-blazing with no regard for its own safety. It will use the most damaging weapon it possesses (e.g. grenades) even if in close quarters.

A good reason to base this random result on bravery is that alien leaders would be more likely to kill themselves than be captured, assuming they have a higher bravery than their troops. On the other hand, I imagine when storming a UFO, the engineers and navigators might more easily surrender.

I think this would make the climax of battles a lot more exciting, or at least a lot less tedious. Obviously you'd have to take care that "cornered" triggers properly, or else hilarity might ensue.

EDIT: Xenonauts should be able to get cornered as well!

Edited by JonVanCaneghem
Link to comment
Share on other sites

You should probably still have to deal with the alien that gives up imo. Don't just automaticly give him a neutralized status.

I'm not sure how I feel about the suicide option. it feels somewhat dissapointing and would be REALLY annoying if your xenonauts can get cornered as well. What about makeing him faint for one or 2 rounds (giving you a chance to take advantage of the situation but if you dont he wakes up in guns blazing mode)? or have him take the alien version of the suicide pill (which turns him into a chryzalid zombie)?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...