Jump to content

UFO AI patch


kyrub

Recommended Posts

while moving/firing/etc.

 

Hehe, "more specific"... I wonder how concrete details look in your book, Hobbes.

 

 

Firing mode: AI has stupidly simple way of choosing the mode. It's based on distance to target ONLY. In the original, the burst was almost unused (only if distance <= 3). Obviously, I incresed it.

 

Moving 1 : I have no idea how AI moves in between nodes. Sorry, I know this is your area of interest. At the time, I had little apparatus (wiki info was bad). Also, this part of the code looks pretty complicated (should I say, sophisticated?). Good on authors side.

 

Moving 2 : On the other hand, I used debug info left in the file for locating the general strategical choices of AI when it locates an X-COM soldier. It seems to use three basic modes: Combat (advance + shoot), Snipe (wait in the cover to get a reaction shot), Escape (search for cover). I worked heavily on these, trying to improve the general indecision of Aliens. I increased the Combat factor heavily for Base retaliation missions. I got rid of stupid overuse of Excape mode for melee aliens. Etc.

 

Psi targetting formulas: I tried to increase the value of RND over the check for soldier psi-defense. Lately, I was playing with the idea of removing the psi-defense check entirely UNTIL the X-com builds a Psi-labs and get to know soldier stats.

 

Throwing grenades: the decision formula was d100 compared with (10 * Nr_target_seen). I found that comically low.

Link to comment
Share on other sites

Hehe, "more specific"... I wonder how concrete details look in your book, Hobbes.

 

 

Firing mode: AI has stupidly simple way of choosing the mode. It's based on distance to target ONLY. In the original, the burst was almost unused (only if distance <= 3). Obviously, I incresed it.

 

Moving 1 : I have no idea how AI moves in between nodes. Sorry, I know this is your area of interest. At the time, I had little apparatus (wiki info was bad). Also, this part of the code looks pretty complicated (should I say, sophisticated?). Good on authors side.

 

Moving 2 : On the other hand, I used debug info left in the file for locating the general strategical choices of AI when it locates an X-COM soldier. It seems to use three basic modes: Combat (advance + shoot), Snipe (wait in the cover to get a reaction shot), Escape (search for cover). I worked heavily on these, trying to improve the general indecision of Aliens. I increased the Combat factor heavily for Base retaliation missions. I got rid of stupid overuse of Excape mode for melee aliens. Etc.

 

Psi targetting formulas: I tried to increase the value of RND over the check for soldier psi-defense. Lately, I was playing with the idea of removing the psi-defense check entirely UNTIL the X-com builds a Psi-labs and get to know soldier stats.

 

Throwing grenades: the decision formula was d100 compared with (10 * Nr_target_seen). I found that comically low.

 

This is great, thanks. :clapping:

 

I wanted to know what decisions the AI can take, I'm guessing those actions will also depend on factors like alien stats (bravery, remember the position of XCOM units, Line Of Fire and so on) and yeah, I wasn't expecting you to explain completely the AI, just to know what you know. So much is unknown about that every little piece of information counts :P

Link to comment
Share on other sites

  • 2 weeks later...

You might already know about this (I can't even remember if I've gotten around to posting it), but on mentioning the EU beta to Volutar, within about five minutes he'd unlocked the debug mode in it.

 

In addition to the features from the full game, where the debug mode simply lets you watch the aliens move around the map and then gives you control of them, the beta version also shows a text display of what actions the aliens are trying to perform.

 

He reckons that there were more options available to the AI in the beta then in the full release, so it's debatable how useful you'll find this, but it's still quite interesting to watch. You enable it by changing 0x5D66E in UFO2EXE\UFO.EXE to 1.

 

Edit: Actually, I figured I might add a patcher to the beta download. If you grab the new copy you can run "debug.exe" to toggle the alien overview mode quickly.

Link to comment
Share on other sites

You might already know about this (I can't even remember if I've gotten around to posting it), but on mentioning the EU beta to Volutar, within about five minutes he'd unlocked the debug mode in it.

 

In addition to the features from the full game, where the debug mode simply lets you watch the aliens move around the map and then gives you control of them, the beta version also shows a text display of what actions the aliens are trying to perform.

 

He reckons that there were more options available to the AI in the beta then in the full release, so it's debatable how useful you'll find this, but it's still quite interesting to watch. You enable it by changing 0x5D66E in UFO2EXE\UFO.EXE to 1.

 

Edit: Actually, I figured I might add a patcher to the beta download. If you grab the new copy you can run "debug.exe" to toggle the alien overview mode quickly.

 

Yes, I saw that post about the debug function of the beta some weeks ago. Looked nice but since it was mentioned elsewhere that it had more options that were not implemented I figured it would be better to focus on the final game. Thanks for bringing it up though. :clapping:

Link to comment
Share on other sites

I downloaded and tried it today - from what I could see it didn't seem that much different from what the AI already does so I'm guessing the additional functions mentioned are not working. The logic behind the individual decision making trees for each mode (Sniper, Patrol) should be easy to figure out but what intrigues me the most is how the AI changes between the main modes (the flag mentioned on UNIREF or something?)

 

Thanks for the Debug patch :blush:

Link to comment
Share on other sites

@BombBloke

I wasn't aware of the debug patch. Nice thing to have, will look at it.

 

The logic behind the individual decision making trees for each mode (Sniper, Patrol) should be easy to figure out but what intrigues me the most is how the AI changes between the main modes (the flag mentioned on UNIREF or something?)

Huh? The x4A UNITREF flag = individual decision, as you call it.

 

x4A

- 0 means PATROL mode

- 1 means SNIPER mode

- 2 means COMBAT mode

- 3 means ESCAPE mode

 

As far as the decision (AI evaluation) goes, what info do you seek? I have this fully covered.

Link to comment
Share on other sites

@BombBloke

I wasn't aware of the debug patch. Nice thing to have, will look at it.

 

 

Huh? The x4A UNITREF flag = individual decision, as you call it.

 

x4A

- 0 means PATROL mode

- 1 means SNIPER mode

- 2 means COMBAT mode

- 3 means ESCAPE mode

 

As far as the decision (AI evaluation) goes, what info do you seek? I have this fully covered.

 

OK, my question is: what makes the AI switch between Patrol and Sniper modes. The other 2 modes are easy to figure out, if the alien starts its turn seeing enemy units it will switch to Combat or Escape, depending on morale (?), weapons carried, aggressiveness and intelligence stats and so on. But what are the conditions that the AI evaluates when choosing between Patrol and Sniper (or when it sees no enemy units)?

 

This is also related to offset 0x2B (43) of UNITREF, which is set for 1 in certain % of aliens at the start of the game and is discussed on the UFOPaedia article Talk page - is this how the game decides which aliens are set for Sniper (or Patrol) mode?

EDIT: offset 0x2B has nothing to do with this. Using the debug function I've seen aliens switching from Sniper to Patrol mode between rounds. I guess this flag is only used to identify the terrorist units while they are being placed.

 

I don't know if you have the answer but this question is probably the most relevant - I keep having the feeling that the route nodes are a factor (specially the 'flags' byte on ROUTES.DAT - check this page on record 21/15 for more details) in some way, which has implications for map design.

Link to comment
Share on other sites

OK, my question is: what makes the AI switch between Patrol and Sniper modes. The other 2 modes are easy to figure out, if the alien starts its turn seeing enemy units it will switch to Combat or Escape, depending on morale (?), weapons carried, aggressiveness and intelligence stats and so on. But what are the conditions that the AI evaluates when choosing between Patrol and Sniper (or when it sees no enemy units)?

 

You mean, when the Alien starts to sniff around, going after soldiers, instead of following routes? I am afraid I have no information on this (and I tried hard to get it). It's another part of the code, and as I said, quite complicated. Maybe I'll retry with routes knoledge you posted.

 

As for switching the combat modes, the problem is, that it happens more times during a turn (not only at the beginning). Big factor is the health of the alien in question. So if you wound it, it may start to seek cover etc. The multi-decision has strange side-effects, the aliens are quite indecisive, they change their movement and sometimes don't shoot from good positions. Melee aliens in particular tend to "dance" around their victim ("should I kill him...? No, not yet"). The dancing is one of the particular features of UFO games which I like (not in the melee unit's case), AI is unpredictable, it thinks in "alien" way.

Link to comment
Share on other sites

  • 2 weeks later...
You mean, when the Alien starts to sniff around, going after soldiers, instead of following routes? I am afraid I have no information on this (and I tried hard to get it). It's another part of the code, and as I said, quite complicated. Maybe I'll retry with routes knoledge you posted.

 

If you see the article where I placed the 'flags' byte value for every route node on UFO maps you can see that the game must use it - i want to try changing more those values on the beta's maps and see if the debug function shows anything.

 

As for switching the combat modes, the problem is, that it happens more times during a turn (not only at the beginning). Big factor is the health of the alien in question. So if you wound it, it may start to seek cover etc. The multi-decision has strange side-effects, the aliens are quite indecisive, they change their movement and sometimes don't shoot from good positions. Melee aliens in particular tend to "dance" around their victim ("should I kill him...? No, not yet"). The dancing is one of the particular features of UFO games which I like (not in the melee unit's case), AI is unpredictable, it thinks in "alien" way.

 

Which is also kinda of the fun of playing - the AI's erratic behaviour was mentioned by its developer, IIRC, to be have been designed on propose.

 

Btw, I'm starting to get mad at that increased grenade throwing behaviour displayed by the aliens. :blush:

Link to comment
Share on other sites

Which is also kinda of the fun of playing - the AI's erratic behaviour was mentioned by its developer, IIRC, to be have been designed on propose.

Really? Genious if true. (Although it undermines my theory that the best computer games' features are a matter of unwanted errors.)

 

Btw, I'm starting to get mad at that increased grenade throwing behaviour displayed by the aliens. :blush:

Hehe. Alien grenades early are a pest. I learned to split my squad into groups of max 2 men, no other way. Which - in the less open Dawn city terrain - makes them all the more vulnerable, so sometimes I must use bigger groups, inviting grenades...

Hard choice = good game.

Link to comment
Share on other sites

Really? Genious if true. (Although it undermines my theory that the best computer games' features are a matter of unwanted errors.)

 

I managed to find the original article, relevant section below:

 

At its core, though, the game remained true to the turn-based strategy wargame roots of Laser Squad and the Rebelstar games. The AI system was based on that used in the earlier titles, the Gollops having developed and refined their own unique algorithms for pathfinding and behaviours. “We made sure that there was an element of unpredictability in the AI which often made it seem more intelligent than it actually was.”

 

May part of that element is how the AI changes each alien's mode.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
Huh? The x4A UNITREF flag = individual decision, as you call it.

 

x4A

- 0 means PATROL mode

- 1 means SNIPER mode

- 2 means COMBAT mode

- 3 means ESCAPE mode

So 255 i.e. -1 would be an intermediate mode. [saving a file with a Floater that had been wounded before it was killed, had 255 in this field.]
Link to comment
Share on other sites

So 255 i.e. -1 would be an intermediate mode. [saving a file with a Floater that had been wounded before it was killed, had 255 in this field.]

If I remember, FF value triggers a subroutinw with alien's analysis of situation and attributing of a new value to x4A. I am bit surprised that it occured at the end of the turn, but it's probably well possible, x4A is being reset in various routines / moments of the alien move. x4A being set to FF repeatedly is probably the root of stupid movement of melee aliens, they become extremely undecisive and, due to a bug, they may even "freeze" when they see > 3 x-com soldiers at once. I even think this feature has been spotted in various LPs (Chryssalid skipping its turn when close to many soldiers - correct me if I am wrong).

Link to comment
Share on other sites

If I remember, FF value triggers a subroutinw with alien's analysis of situation and attributing of a new value to x4A. I am bit surprised that it occured at the end of the turn, but it's probably well possible, x4A is being reset in various routines / moments of the alien move.
It did not happen at the end of the turn. The Floater took two hits in one autofire burst before dying, so the FF actually reached the savefile. (I assume being hit triggered the AI recalculate, but since the Floater died that was skipped)
Link to comment
Share on other sites

  • 2 weeks later...

Kyrub, If you don't mind, I'll see if I can incorporate your AI enhancements into UFOextender.

Oh, certainly not. Go on, great idea. Although Extender is a bit too rich on options already, half of them are useless IMO.

 

When you are at it, it would be nice if you could externalize the AI shooting decision. These are only 3 one-byte changes, where AI checks for distance. Vanilla has something like:

- cmp ax, 5 => if not bigger, AI autofires

- cmp ax, 0f => if not bigger, AI snap shoots

- else AI uses aimed shot

 

I increased it substancially (I believe I used cmp ax, 0f for autofire, for instance). But with so many weapon mods flying around, it would be nice to have an externalized version. I am sorry for not being of any help, I have a computer fasting period.

Link to comment
Share on other sites

Oh, certainly not. Go on, great idea. Although Extender is a bit too rich on options already, half of them are useless IMO.

Yeah the .inf file can be daunting for a new person and, I agree, there are some options that I, personally, would never use.

 

I have tried to rearrange the file to make the important options appear first in the ini and ReadME file and the more complicated or intrusive changes appear at the end (Mods appear first after clarifying the executable, then bug fixes, etc.) I've enabled some options default but only those which have no direct impact on game balance: autoequip, grenade state, saved reserve mode, etc. I've enabled a lot of the bug fixes by default (If I questioned whether or not it changed something that might have been as intended, I left it disabled.) I am reluctant to just apply fixes without giving the player a chance to "opt out" but it does make the ini file long.

 

When you are at it, it would be nice if you could externalize the AI shooting decision. These are only 3 one-byte changes, where AI checks for distance. Vanilla has something like:

- cmp ax, 5 => if not bigger, AI autofires

- cmp ax, 0f => if not bigger, AI snap shoots

- else AI uses aimed shot

 

I increased it substancially (I believe I used cmp ax, 0f for autofire, for instance). But with so many weapon mods flying around, it would be nice to have an externalized version. I am sorry for not being of any help, I have a computer fasting period.

 

Make it external, in the sense like Seb did with Ranged Based Accuray: The player can specify the ranges in the INI?

Link to comment
Share on other sites

  • 4 years later...
Hey kyrub, I'm a relatively new user so you don't know me. But I wanted to ask why you didn't upload this mod in the download/files section of this site? It's a little hard to find in its current state. Also, the executables for the DOS version are swapped/in the incorrect folders. This might cause confusion to people who merge their folders as it wont give them any message for replacing the files.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...