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

Offline mrxian

  • Colonel
  • ****
  • Posts: 109
    • View Profile
Re: Smarter Civilian AI?
« Reply #30 on: April 08, 2015, 09:51:42 pm »
So leave it.
OpenXcom doesn't want to please all your ideas. It meant to give non bugged and scalable REPLICA of the vanilla. Vanilla gameplay modifying "enhancements" are not really welcome.
Yet there are a ton of enhancements in the advanced options menu, amazing mod support and even changes (call them bug fixes if you must) to the vanilla gameplay.
For not wanting any enhancements, you surely enable an awful lot of them.

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: Smarter Civilian AI?
« Reply #31 on: April 08, 2015, 10:37:53 pm »
For not wanting any enhancements, you surely enable an awful lot of them.
They are optional. And they've been made during xcom1 replication. And now it's another story, when no features aside of tftd in mind are added. And the AI thing is too complicated to be "fixed" or modified the way you might expect. AI is easier to re-implement, than to figure out current and refactor. But it's like 6 months of hard work, without any distractions. Really poor chances of that to be done. So better to forget it.

Offline DoxaLogos (JG)

  • Colonel
  • ****
  • Posts: 358
  • Squaddie cautiously peering through the breach
    • View Profile
Re: Smarter Civilian AI?
« Reply #32 on: April 09, 2015, 03:52:19 am »
They are optional. And they've been made during xcom1 replication. And now it's another story, when no features aside of tftd in mind are added.

So here's a few questions, what do you guys plan to do when TFTD features are complete in OpenXcom?  Have y'all (yes, I'm southern) been thinking beyond that?  Is the work mostly done and OXC goes into "maintenance" mode?  I'm genuinely curious :)

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Smarter Civilian AI?
« Reply #33 on: April 09, 2015, 04:20:11 am »
Here's a build of today's nightly with redv's suggestion added.
At beginining of turn, XCOM automatically controls civilians who are in a 5x5 square around soldiers (I find square somehow more player-friendly to determine the range), and same level or one above/below, and within line of sight - so no controlling civilians through walls. The civilian AI itself is untouched.
You can toy with it and make your own mind.
It's built with Mingw, so you may need the standard DLLs, you can find them for example in this other post.

Known issue : Units block line of sight, so if you align a soldier and 2 civilians, the edge civilian will get his freedom back.
« Last Edit: April 09, 2015, 03:48:31 pm by yrizoud »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Smarter Civilian AI?
« Reply #34 on: April 09, 2015, 11:00:08 pm »
Known issue : Units block line of sight, so if you align a soldier and 2 civilians, the edge civilian will get his freedom back.

What if this isn't an issue? The civilian loses sight of your soldier momentarily so it makes sense that it'd lose control over the civ.

Offline pilot00

  • Colonel
  • ****
  • Posts: 487
  • Back in the day it was gameplay not a feature....
    • View Profile
Re: Smarter Civilian AI?
« Reply #35 on: April 09, 2015, 11:12:11 pm »
Honestly I find it a bit too much to directly control them.

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #36 on: April 22, 2016, 08:58:15 am »
I agree that in terror missions you just don't care about civilians. They are dump. They technically don't even panic. They always have 100% morale. No panic messages at all. No panic screams. Doing something to civilian AI will require a lot of time.

At beginining of turn, XCOM automatically controls civilians who are in a 5x5 square around soldiers (I find square somehow more player-friendly to determine the range), and same level or one above/below, and within line of sight - so no controlling civilians through walls. The civilian AI itself is untouched.
Interesting workaround without doing something to civilian AI. Makes some sense since x-com was send to terror mission to save civilians. If civilian is enough near why x-com operative can't coordinate them in order to help to survive? Also civilian can do a little help to x-com operatives like heal with medikit or drop something from transporter. (correctly works in buggy way with latest nightly)

But current implementation also need some fixes like energy recovery, no morale lost at all, you can open inventory and put a lot of stuff without penalty and etc. I will try to fix them later using your code.
« Last Edit: April 22, 2016, 11:02:47 am by Xtendo-com »

Offline Bloax

  • Colonel
  • ****
  • Posts: 322
  • do you want to be any of those things
    • View Profile
Re: Smarter Civilian AI?
« Reply #37 on: April 22, 2016, 06:14:06 pm »
Just make them path to where your soldiers spawn on turn 1 and be done with it.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Smarter Civilian AI?
« Reply #38 on: April 22, 2016, 07:07:14 pm »
Just make them path to where your soldiers spawn on turn 1 and be done with it.
And when you want escape bad terror site you craft entrance will be blocked by wall of civilians :)

Offline Bloax

  • Colonel
  • ****
  • Posts: 322
  • do you want to be any of those things
    • View Profile
Re: Smarter Civilian AI?
« Reply #39 on: April 22, 2016, 07:51:09 pm »
Too bad! :-)

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #40 on: April 22, 2016, 09:31:01 pm »
Currently AI of civilians have two states:
1) Patrol mode. Walk around the map if alien not noticed.
2) Escape mode. Tries to break line of sight if alien noticed.

When I changed mode to always escape, civilians don't move and sit quietly until they meet alien. When alien noticed a civilian, civilian tries to break line of sight, but don't know how to choose a better cover. Anyway civilian that sit quietly and tries to break line of sights has more chances to survive than wandering civilian. I also planning to add a morale rules to civilians, so they will panic and flee around a map only when morale is low. I also noticed that civilian has... 80 brave stats by default ruleset.

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #41 on: April 25, 2016, 06:14:27 pm »
I tried to make civilians less useless and force you to care about civilians. What was done:
1) Applied yrizoud's code that implements a manual way of controlling civilian when x-com operative is nearby.
2) Civilians always hides from aliens by breaking line of sight by default and don't do brainless stuff like walking around just for fun except for panic state.
3) Civilians can lose morale.
4) Civilians can panic like your soldier when morale is low. In panic state they always flee.
5) The death of civilian affects a morale of every side.
6) You can't open inventory of civilian anymore.
7) Civilian can be saved from exit zone when you abort mission.
8) Civilian lose less morale when x-com operative is nearby.

If interested, you can try OXCHA with enabled "Extend civilians behaviour" in advanced options.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Smarter Civilian AI?
« Reply #42 on: April 25, 2016, 06:22:47 pm »
What does 4 mean? A dead civilian reduces xcom and alien morale too?

Offline Xtendo-com

  • Colonel
  • ****
  • Posts: 118
    • View Profile
Re: Smarter Civilian AI?
« Reply #43 on: April 25, 2016, 06:39:06 pm »
What does 4 mean?
Civilians technically don't ever panic since they always has 100% morale. They just walk around and takes a decide to escape if noticed an alien. I forced to use escape mode in any situation, so only in panic state they will flee around the map.

A dead civilian reduces xcom and alien morale too?
For x-com operative - like you lose own soldier
For alien - like they kill x-com operative
For civilian - significantly decreases a morale when x-com operative is not nearby (technically when not under the player control).
« Last Edit: April 25, 2016, 06:44:10 pm by Xtendo-com »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: Smarter Civilian AI?
« Reply #44 on: April 25, 2016, 07:15:15 pm »
Eh, I meant to type 5, not 4 ;) But your explanation is good. That looks like an interesting change. Better than my usual "stun all civilians so they don't get themselves killed/in the way" procedure.