Author Topic: Smarter Civilian AI?  (Read 30181 times)

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #45 on: April 25, 2016, 08:14:20 pm »
Better than my usual "stun all civilians so they don't get themselves killed/in the way" procedure.
That also works even in my modification and still a better solution. Even with manual control they may panic and flee from a player because they anyway not bravery enough. And even better, you can abort mission with a pack of unconscious civilians in one tile on exit zone and the game will count them as saved. I want later to break that solution, so you will never stun a civilian without a special reason. Like stunning a civilian will be equivalent to bleeding to death, so after some turns he will die if not restored with medikit. Also I will provide a way to handle a panicked civilian without stun.
« Last Edit: April 25, 2016, 08:35:33 pm by Xtendo-com »

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #46 on: April 29, 2016, 05:34:48 pm »
If anyone interested, I tried to made some improvements in civilians.

What changed was from vanilla:
  •     You can save civilians when you abort missing
  •     Civilians sit quietly and tries to break line of sight instead of walking around except when they panic
  •     Civilians can lose a morale. They lose a morale after noticing an enemy at start of civilian's turn, lose a morale after every death of humans.
  •     You can control civilians manually when x-com operative is nearby (7 tile away)
  •     Civilians lose less morale under player control
  •     Civilians under player control never panic when x-com operative is alongside (2 tile away)
  •     Civilians lose a pulse in unconscious state, so never stun civilians without a special reason
  •     Changes turn priority to: Player, Civilians, Aliens. So in first turn civilians can break line of sight

I added this in my OXCHA as advanced option.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Smarter Civilian AI?
« Reply #47 on: April 29, 2016, 09:58:41 pm »
Looks cool, especially for Piratez where crafts often have more spaces than they carry soldiers.

What does "Civilians lose a pulse in unconscious state, so never stun civilians without a special reason" mean? They die if they are made unconscious?

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #48 on: May 02, 2016, 03:26:06 pm »
What does "Civilians lose a pulse in unconscious state, so never stun civilians without a special reason" mean? They die if they are made unconscious?
Yes. They get random damage from 1 to 9 every turn. Also I made a an another advanced options that applies that rules also for x-com operatives ("No pulse in unconscious state"), making a small launcher an another variant of deadly massive weapon in arms of aliens.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Smarter Civilian AI?
« Reply #49 on: May 02, 2016, 06:37:35 pm »
Interesting mechanic! If you beat them up, you risk hurting them (like all the taser "accidents"). 9 damage sounds like a lot, but I guess it doesn't happen all that often..

Leaves stunning as a good way of quickly getting a civilian off an alien's target list, but then you get the medic to come up, revive them and escort them to the skyranger. Sounds cool :)

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #50 on: May 02, 2016, 07:24:09 pm »
Interesting mechanic! If you beat them up, you risk hurting them (like all the taser "accidents"). 9 damage sounds like a lot, but I guess it doesn't happen all that often..
Yes, they dies after 4 turns with max HP and if you really unlucky with HP random damage. It's hardcoded to default openxcom behavior, so I didn't take into a consideration a rulesets with non default HP for civilians and non default stun recovery from medikit. Also civilian resets a stun level to current HP with random additions (1-3 stimulators needed, but hardcoded to default behavior), so you don't need to spend a crazy amount of stimulators like 10 and more if you too overstun him.

Leaves stunning as a good way of quickly getting a civilian off an alien's target list,
Mostly you don't need to stun civilian at all if they under your control. Notice that you will get a control of civilian if he 7 tiles away from you (you can't get a control by x-com operative that panic or in berserk state), but if he 2 tile away from x-com operative civilian will never panic even with 0 morale, so you can escort to safe place without stun.
« Last Edit: May 02, 2016, 07:26:33 pm by Xtendo-com »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Smarter Civilian AI?
« Reply #51 on: May 02, 2016, 09:09:09 pm »
Yeah, I'm just thinking of a few cases I've observed where a civilian is very close to an alien (especially chryssalids) and you know he will die (or worse become a zombie) in the next alien turn, without being able to kill the alien. It is then better to stun the civilian so it isn't a target for the alien, than trying to scramble to kill the alien without explosives (since that would kill the civilian).

I'll have to see how well the civilian control works too, of course! So many branches to fetch and integrate..! Already your scanner, now the improved vision (which thankfully was integrated be Meridian), and now this :)

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #52 on: May 03, 2016, 02:53:15 pm »
I'll have to see how well the civilian control works too, of course! So many branches to fetch and integrate..! Already your scanner, now the improved vision (which thankfully was integrated be Meridian), and now this :)
Yes, there are a lot of treasures to explore. Abandoned already implemented features with source codes. Interesting mods. A reason to train some programming skills.

Already your scanner,
I'm planning to change that feature later because I don't like an idea that makes a display view useless.

Offline animal310

  • Captain
  • ***
  • Posts: 54
    • View Profile
Re: Smarter Civilian AI?
« Reply #53 on: October 11, 2017, 07:47:04 pm »
Is there a way to implement this with the latest nightly like a MOD? This looks great and would love to add it to my game.

Thanks

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: Smarter Civilian AI?
« Reply #54 on: October 31, 2017, 10:00:51 pm »
Has anybody adapted this patch to OXCE+ ?

Update: Looks like nobody did. I'll try then: https://github.com/tkzv/OpenXcom/commit/70122f48c343789a9f2dc4d75af89cb5077c24c9
I'm going to post updates to the other thread discussing this patch: https://openxcom.org/forum/index.php/topic,4533.msg89670.html#msg89670
« Last Edit: December 06, 2017, 10:48:53 pm by tkzv »

Offline NiceMicro

  • Sergeant
  • **
  • Posts: 34
    • View Profile
Re: Smarter Civilian AI?
« Reply #55 on: August 15, 2018, 07:20:06 am »
I have just read this discussion, and I'm very sad that it is over.

My 2 cents on this issue is that for me, civilians running towards the Skyranger once in sight, and even running in and using up space, or just generally obstructing the way of the X-Com would be annoying, but realistic, and therefore I'd deal with it better than the civilian, who runs out from below the Skyranger towards the aliens.

Did all effort cease for modelling a more complex civilian behavior for the vanilla game (with an advanced option switch of course)?

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: Smarter Civilian AI?
« Reply #56 on: August 15, 2018, 04:41:03 pm »
I have just read this discussion, and I'm very sad that it is over.
Xtendo-com's patches are usable. Unfortunately, he combined extended behaviour with extra bleeding, which does not combine well with improvements to stunning in OXCE+. I tried to separate those parts, I worked around API changes. The end result is usable, but the game hangs occasionally. (And I'm not sure if I got what Xtendo-com intended.) Also, I'd rather separate turn order and control over civilians. If you know C++ or can find someone else to do this work, you are welcome to fix my patches or start with Xtendo-com's patches once again.

Offline NiceMicro

  • Sergeant
  • **
  • Posts: 34
    • View Profile
Re: Smarter Civilian AI?
« Reply #57 on: August 17, 2018, 06:09:41 am »
Xtendo-com's patches are usable. Unfortunately, he combined extended behaviour with extra bleeding, which does not combine well with improvements to stunning in OXCE+. I tried to separate those parts, I worked around API changes. The end result is usable, but the game hangs occasionally. (And I'm not sure if I got what Xtendo-com intended.) Also, I'd rather separate turn order and control over civilians. If you know C++ or can find someone else to do this work, you are welcome to fix my patches or start with Xtendo-com's patches once again.

Thank you for the answer!

Yeah, my problem is that my programming skills are too low for such an endeavor. For Xtendo-com's modifications, I found it a little too much for me, i.e. controlling civilians, or the huge punishment for stunning.
And also, I'm playing with mods, especially Area 51 is my poison, and I am afraid that it'd be too much of an effort to try to integrate his patches with everything by myself :(

Are you saying though, that your versions of these patches are 99% compatible with the 2018 builds of the vanilla XCom?

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: Smarter Civilian AI?
« Reply #58 on: August 19, 2018, 01:29:58 am »
And also, I'm playing with mods, especially Area 51 is my poison, and I am afraid that it'd be too much of an effort to try to integrate his patches with everything by myself :(
Mods are not a problem. I played mostly X-COM Files.

The patch adds a switch to advanced options that would allow/disallow new behaviour. When off, the game behaves exactly as before (and does not crash). When on, civilians move before aliens and become controlled by X-COM, when they end their turn near an operative.

Are you saying though, that your versions of these patches are 99% compatible with the 2018 builds of the vanilla XCom?
No. I have no idea how will they work with vanilla version. I only combined them with OXCE+. I removed the code responsible for bleeding when stunned (I didn't like the idea — I prefer XCF's "lethal chance"), and something that looked like computing the distance depending on the lighting conditions (it required functions no longer present in OXCE+).