OpenXcom Forum

OpenXcom => Suggestions => Topic started by: DoxaLogos (JG) on April 07, 2015, 06:39:17 am

Title: Smarter Civilian AI?
Post by: DoxaLogos (JG) on April 07, 2015, 06:39:17 am
Even though I'm thoroughly enjoying OpenXcom in so many wonderful ways, there is one thing that frustrates me: stupid civilians with no sense of self preservation :)

For one thing, it breaks the "immersiveness" of the game to the point you almost don't care that much about protecting them.  They're so unrealistically stupid or oblivious across the board that it annoys me partly because they're practically impossible to protect.  I could probably handle it better if a small percentage of the civilians in a terror site were clueless, but all them...ugh.  Maybe an algorithm as simple as look around and run away from any aliens they spot might be a good starting point :)

I think it would be cool if there was an option like "Sneaky AI" for civilians... maybe called "Smarter Civilian AI"?.

Until then, I'll do my best to keep them safe while I roll my eyes at them :)
Title: Re: Smarter Civilian AI?
Post by: volutar on April 07, 2015, 07:44:00 am
Civilians are panicking, they faced terror and unnatural aliens, they simply can't think "smart" (at least 85% of them). Obviously they act chaotic way.
The most they can do, is to run away from the danger. And I think that kind of behaviour is already there.
Title: Re: Smarter Civilian AI?
Post by: mrxian on April 07, 2015, 08:50:14 am
Oh, no no  no.
They don't run away from danger. They run into my damn line of fire and block my path.

Ideally, Xcom should get control of any civilian that is within line of sight of any trooper (that isn't wearing power armor). A close second would be if they used some kind of sneaky AI that made them hide from the aliens (and perhaps Xcom) more effectively.
At the very least, they shouldn't recover from being stunned (and count as alive) so I can safely stun them.
Title: Re: Smarter Civilian AI?
Post by: volutar on April 07, 2015, 09:42:42 am
Forget about controlling civilians without using MC. Thankfully they don't turn aliens, as in vanilla, after losing control (because it was a bug).
And surely, as living beings they are recovering from stun. Tho you can add some more stun.
You may want not to have civilians at terror missions at all, like, to make it easier to complete with positive score? You can make a MOD with no civilians.
But this kind of mission meant to cause almost 100% casualities.
Civilians can't control lines of fire. It's simply impossible. Why should they ease your life?
Title: Re: Smarter Civilian AI?
Post by: mrxian on April 07, 2015, 12:15:56 pm
Civilians can't control lines of fire. It's simply impossible. Why should they ease your life?
Civilians do a damn good job at making terror sites unique and terrifying. You hearing some plasma fire off in the distance, followed by a blood-curling scream really adds to the atmosphere of the mission.
They also do a damn good job of enticing different gameplay - you take a few more risks in order to save as many civilians as you can.
These two are very good effects of having civilians present.

But every once in a while, civilians just become a huge liability. They wander around, mess up your battle lines, get in the way of fighting and are just plain annoying. They don't break the game too much, they just add a random factor to the fight that really doesn't add anything - when a civilian is present, they may just mess up your plans and/or cause casualties.
This effect isn't good. I don't think that something that is little more than annoying has any place in a game, and as such I think this behavior is a prime candidate for some modification. Something like having spotted civilians run towards the skyranger (unless they panic, they are still civvies, after all) would be a great plan.

In short, they don't have to make my job easier. They just need to stop making my job more annoying.
(And honestly, there've been situations where I just shot a civilian because I didn't want to risk it messing up everything.)(That's bad.)
Title: Re: Smarter Civilian AI?
Post by: Ridаn on April 07, 2015, 12:22:53 pm
Civilians are hugging the aliens and block the doorways.
They make it damn impossible to save them.
They deny me liberate use of explosives to make sure terrain works in my favour.
First time I fired a OpenXcom and got a Terror Mission I tried to stun them - they all came up as killed by me in mission results.
The more civilians are shot - the less my operatives are shot.
Therefore a good civilian is a dead civilian.
Title: Re: Smarter Civilian AI?
Post by: Dioxine on April 07, 2015, 12:26:56 pm
Consider this: all the *smart* civilians are already long gone when you arrive :)
They do tend to escape from aliens, but then again, there is nowhere to run, as aliens are spawned everywhere (Hobbes' pack adds an extra thrill to it - like a Chryssalid spawned adjacent to 6 or 7 civilians :). And if the do escape from aliens, they're liable to run the only way there isn't any aliens - that is, right into your lines of fire. There is nowhere else for them to go.

All it really comes down if someone enjoys randomness and saving the helpless, or would prefer everything orderly, disciplined and predictable. Obviously, Terror Missions cannot cater to both crowds at the same time. That's my opinion.

Oh yeah and there is also this crowd who is using artillery to solve the Terror problem - the score should hit around 0 when everything and everyone is dead, which is much better than circa -250 for landing and fleeing, or flat -1000 for not showing up :) They probably don't care about civilian AI that much at all.

Oh and there is that notion of having armed civilians - just another great way to lose operatives :) (armed civilians must be affected by Morale, so inb4 a civilian with his beloved AR-15 berserking in the middle of your squad)
Title: Re: Smarter Civilian AI?
Post by: Hobbes on April 07, 2015, 05:13:26 pm
Something just popped into my mind. The safest place for the civilians to run to would be... into the Skyranger! The area around it should be clear of aliens, has nice walls for protection from shots and there's plenty of room to fit nearly all civilians that can be spawned in a map.

However, if you needed to retreat from the mission, it would be funny to find all the spots inside the Skyranger occupied by civilians, preventing some of your soldiers from escaping. How's that for frustration?  ;D
Title: Re: Smarter Civilian AI?
Post by: DoxaLogos (JG) on April 07, 2015, 08:22:48 pm
Civilians are panicking, they faced terror and unnatural aliens, they simply can't think "smart" (at least 85% of them). Obviously they act chaotic way.
The most they can do, is to run away from the danger. And I think that kind of behaviour is already there.

If that behaviour is there, it doesn't "appear" to be there based on my observations.  It just looks like random walking around oblivious to everything going on around them and consistent across the population.  I don't know how many times, I've watched civilians almost walk up to aliens, and I don't recall seeing them run from aliens behind them.  Seems like some of them should just be hanging out inside of buildings instead of blissfully walking out into the danger. So if they are hardcoded to run from danger, it just doesn't look like it and isn't very believable to my eyes :)

Quote from: volutar
Civilians can't control lines of fire. It's simply impossible. Why should they ease your life?
I agree about the lines of fire.  It's not my interest for this suggestion, and I'm okay with it not completely easing my life on a terror mission.  It's more about "believability" and immersing yourself into the theme and environment of what is happening around you in this chaotic mission.


Quote from: Dioxine
Consider this: all the *smart* civilians are already long gone when you arrive :)

Okay, I might be able to swallow that, but it's really really stretching it.  The more you have to explain things away, the harder it is to swallow it.

Quote from: Dioxine
All it really comes down if someone enjoys randomness and saving the helpless, or would prefer everything orderly, disciplined and predictable. Obviously, Terror Missions cannot cater to both crowds at the same time. That's my opinion.


Nope. I politely disagree, at least in the sense that is not where I'm coming from and have no desire to please "both crowds".   I really have no problem with random and chaos of terror missions, because I think it enhances the theme of the game and adds variety.  It's the modeling of the civilian behavior that just makes it hard to believe the random and chaos that is happening.  Yes, the aliens aren't that smart compared to us, but at least their behavior is a tad more believable in comparison to civilians. For instance, aliens seem to target civilians more than they do my operatives in terror missions.  That makes perfect sense, because that is their top mission priority.  Civilian AI behavior just seems "pasted on" to add randomness with other things thrown in to try to make you care about them -> extreme point loss for not responding.  Would it be better to give a bigger point bonus for saved civilians (i.e. positive reinforcement instead)?  That's probably a work around though again, not changing their behavior.  I digress, I just think more thought could be put into it then it's current state of civilian behavior in the AI department (again, no arguments about vanilla please and I'm not advocating getting rid of vanilla).

Quote from: Dioxine
Oh yeah and there is also this crowd who is using artillery to solve the Terror problem - the score should hit around 0 when everything and everyone is dead, which is much better than circa -250 for landing and fleeing, or flat -1000 for not showing up :) They probably don't care about civilian AI that much at all.

Yeah, you always have those people.  However, I wonder if some of that crowd would treat it differently if the civilians were a little more "believable"?  Or maybe the scoring system was different to encourage them to save the civilians?


Quote from: Dioxine
Oh and there is that notion of having armed civilians - just another great way to lose operatives :) (armed civilians must be affected by Morale, so inb4 a civilian with his beloved AR-15 berserking in the middle of your squad)

Now, I could buy all of that as well.  I don't mind having civilians with weapons (just not all of them) with Morale effects and berserking into my squad :)

Quote from: Ridan
First time I fired a OpenXcom and got a Terror Mission I tried to stun them - they all came up as killed by me in mission results.
The more civilians are shot - the less my operatives are shot.
Therefore a good civilian is a dead civilian.

I think that's the crux of the issue.  Because the civilians are so whacked, you'd rather kill them rather than save them which almost defeats the purpose of the mission at least when it comes to "caring" about their lives. So, if their behavior was a little more realistic, would it make anyone care more about their lives instead of writing them off?

As far as stun goes, at least the game could give you negative points for stunning, but still say they're alive at the end:)

Quote from: Hobbes

Something just popped into my mind. The safest place for the civilians to run to would be... into the Skyranger! The area around it should be clear of aliens, has nice walls for protection from shots and there's plenty of room to fit nearly all civilians that can be spawned in a map.

However, if you needed to retreat from the mission, it would be funny to find all the spots inside the Skyranger occupied by civilians, preventing some of your soldiers from escaping. How's that for frustration?  ;D

Yep, I thought of that too.  How frustrating would it be if they also blocked your exit from the Skyranger to get to the aliens :)

I guess to summarize what I would like is not to sacrifice the randomness and chaos, just make civilian behavior a little more believable in the midst of the chaos. Maybe the answer is just to mix up the behavior (civilian AI behavior modes?) among the civilians. Besides, people handle panic differently.

Examples:

1. Have some civilians crouching in a closet or behind chairs and not budge, because they're too terrified to move.  Sure it probably gets them killed, but I could believe that.
2. Other civilians spot you and the aliens and choose to get your operatives between them and the aliens... and might get killed the process, but at least they tried to get behind the good guys in presumed safety.
3. Other civilians run for the Skyranger in sheer relief throwing all caution to the wind (Hobbes suggestion), and probably get zapped along the way.
4. Other civilians pick up a gun and start shooting anything they see not human (even operatives in power suits).
5. Some civilians actually come under your control when they spot you, and you can order them to safety.
6. Any civilians spawned outside a building, make it their priority to find a building to camp out inside.
7. Civilians that always try to maneuver terrain between them and the aliens.

I guess when I look back over this, these examples would make terror missions even more chaotic :)  However, I would personally be a little less frustrated and annoyed with them, because they would behave more realistically. 
Title: Re: Smarter Civilian AI?
Post by: yrizoud on April 07, 2015, 08:31:53 pm
The civilian "artificial stupidity" has never bothered me, but if it bothers someone, it justifies looking for a way around it.
For example a megaphone which lets you control the target civilian for a turn.
Title: Re: Smarter Civilian AI?
Post by: volutar on April 07, 2015, 09:16:03 pm
There will be no change for civilian AI.
[/thread]
Title: Re: Smarter Civilian AI?
Post by: Hobbes on April 08, 2015, 12:12:24 am
There will be no change for civilian AI.
[/thread]

A suggestion has posted on the appropriate subforum for analyzing its benefits and shortfalls.

We already know that you disagree with the idea but if people want to discuss it anymore just ignore the thread.

Personally, I agree with you that changes to the civilian AI aren't necessary at this point but I still like to read the views of others since this is also an exercise of creativity and you might get ideas to use elsewhere.
Title: Re: Smarter Civilian AI?
Post by: Dioxine on April 08, 2015, 02:26:01 am
@jgatkinsn:
Even though Volutar Locuti (locutes? darn my Latin is horrible), I just want to say that the 7 examples, or 'panic modes' you've given at the end is something I really like (ex. I didn't GENERALLY like the notion of controlling civilians directly - but if say, one in 20 is pre-determined to come under your complete control once he has any of your soldiers in his LOS - hell, that's really sweet. After all, good things should happen too, if very rarely!)  - an advanced solution of the problem which avoids all the shortfalls of half-solutions... but is also very complex :)

And I agree with Hobbes that the thread could be held open even if just as an academic discussion (since really, I understand that coding complex civilian AI would be a huge investment and it will go a long way apart from XCom... not even mentioning that gain-for-effort ratio would be low).

EDIT: This "enhanced civilian AI" goes nicely hand-in-hand with cool ideas such as "Save  the Pilot" or "Help Local Forces" or "Extract VIP" missions... And these kinds of missions were implemented in Aftermath/Aftershock games, to great effect.
Title: Re: Smarter Civilian AI?
Post by: DoxaLogos (JG) on April 08, 2015, 04:51:37 am
@Dioxine

Yes, I agree with what your thinking as well.  The modes should be random across the population and the ones with civilian control should be very rare. 

I expected my suggestion would be a very complex programming effort, but I don't think we should fear to discuss it even if it is complex.  It might inspire someone to attempt to pull it off and support it, and maybe something better might come out of it.  Heck, I'm considering doing it myself having never done AI programming, and I think it would be enjoyable to attempt even if it doesn't get officially accepted :)  I find the whole OpenXcom project very inspiring which is a testament to what has been accomplished, and we shouldn't fear new ideas in game development.  In my view, a healthy "open" source community, should also be about being "open" to new ideas.

Overall, I think you mentioned two terms I like better with what I'm trying to express: "panic modes" and "Enhanced Civilian AI" rather than "Smarter Civilian AI". 
Title: Re: Smarter Civilian AI?
Post by: Dioxine on April 08, 2015, 05:04:08 am
I might try to interest one of my friends with the idea... he's specialty is programming, or should I say, husbandry of neural networks. "Survive an alien attack being a civilian" would be a good problem for a neural network. Naturally, using neural networks (specifically, evolutional algorithms) in homegrown programming, instead of the sacred art of scripting, is high heresy. It is really unfair to call his AIs "unfriendly". They are quite friendly indeed. But only as long as you're showing good manners :)
Title: Re: Smarter Civilian AI?
Post by: Solarius Scorch on April 08, 2015, 12:53:46 pm
There will be no change for civilian AI.
[/thread]

Frankly, following this reasoning, there's no point in the OpenXCom at all.

Great and ingenious as it was, X-Com had its design flaws that were sticking out, like the psionics mechanic or civilian behaviour. These solutions are not "elegantly simple" nor "abstract", they are just crude. They're not "bugs" per se, but they're certainly shortcomings, not very well matching the rest of the game conceptually. I've felt like this back in 1997 and I still do now.

I can't certainly say that any of the solutions presented here would give good, balanced, exciting results. That would require actual work and testing. But I think that there's much room for improvement here.

Examples:

1. Have some civilians crouching in a closet or behind chairs and not budge, because they're too terrified to move.  Sure it probably gets them killed, but I could believe that.
2. Other civilians spot you and the aliens and choose to get your operatives between them and the aliens... and might get killed the process, but at least they tried to get behind the good guys in presumed safety.
3. Other civilians run for the Skyranger in sheer relief throwing all caution to the wind (Hobbes suggestion), and probably get zapped along the way.
4. Other civilians pick up a gun and start shooting anything they see not human (even operatives in power suits).
5. Some civilians actually come under your control when they spot you, and you can order them to safety.
6. Any civilians spawned outside a building, make it their priority to find a building to camp out inside.
7. Civilians that always try to maneuver terrain between them and the aliens.

I guess when I look back over this, these examples would make terror missions even more chaotic :)  However, I would personally be a little less frustrated and annoyed with them, because they would behave more realistically.

Most of these points sound very good. The only one I would strongly object to is number 4, as it would be unwieldy to implement and mod. It would make more sense if civilians shoot everyone (friend-or-foe recognition is poor in battle with no information), but that'd be too much; maybe only when they have bad morale (but not berzerking/panicking yet) or something.
Title: Re: Smarter Civilian AI?
Post by: volutar on April 08, 2015, 01:39:10 pm
Frankly, following this reasoning, there's no point in the OpenXCom at all.
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.

You may create your fork, and do whatever you want, or ask Yankes for his "extended" version to spend months of hardwork on this thing (but more changes of the first way).
Title: Re: Smarter Civilian AI?
Post by: Solarius Scorch on April 08, 2015, 01:56:51 pm
Who said anything about modifying vanilla? I think nobody wants to remove vanilla features. Even though there already is a number of changes that do not fall under bugfixing, like improved alien AI, which certainly have more impact on the game than civilian behaviour.

I think if OpenXCom was meant to be only a 100% faithful recreation of the original, half of this forum would be pointless. And I don't mean mods.
Title: Re: Smarter Civilian AI?
Post by: hellrazor on April 08, 2015, 02:08:06 pm
Warboy will be going nuts again if he reads this.

But even so a little bit more realistic behaviour of the civilian AI, would be nice.
Even thou this is at the curretn state not the priority of the developers of OpenXcom, as volutar already stated.

Main goal is to rebuild the Original game with all it's features and without bugs. (And we have even more then that.)
Title: Re: Smarter Civilian AI?
Post by: volutar on April 08, 2015, 02:43:55 pm
Even though there already is a number of changes that do not fall under bugfixing, like improved alien AI, which certainly have more impact on the game than civilian behaviour.
There is no "AI enhancement" in OpenXcom. Since there's no way to replicate vanilla by 100% it's just went into something SIMILAR to vanilla. In some respect it might seem "smarter" in other respect - dumb. But it's what it is. Until there are some obvious bugs like stuck, crash, hang,etc, nobody will touch that beast. It's a rabbit hole __noone__ wants to dive into.

Quote
I think if OpenXCom was meant to be only a 100% faithful recreation of the original, half of this forum would be pointless. And I don't mean mods.
Frankly, quite a bit of forum messages are pointless indeed (as always  :-\).
Bad thing about that - they are often going over the "trolling" line. Not just trolling each other, but devs as well. Like this turn3 thing, which became a huge raw spot. And by constant annoying about this can simply cause project stop.
Title: Re: Smarter Civilian AI?
Post by: Solarius Scorch on April 08, 2015, 04:55:43 pm
Obviously nobody wants to annoy the devs (I hope), I'm forever grateful to them like I should be. However, it doesn't mean we can't do some creative talking, at least academically. Because that's what happens on the forums, period, and I personally think it's great, because sometimes it turns into marvellous stuff.

(And that 3rd turn thing is an actual problem. I understand the reasoning behind it, but it's still a problem. And that's a fact. We call it feedback.)
Title: Re: Smarter Civilian AI?
Post by: Hythlodaeus on April 08, 2015, 06:38:01 pm
I do not think civilan AI should be improved, but one could add an option or mod to rescue civilans like on XCOM 2012. It would add a motivation to walk directly to civilans and allow the player to score a little extra points at the end of the mission.
Title: Re: Smarter Civilian AI?
Post by: pilot00 on April 08, 2015, 07:16:45 pm
Why is it I am seeing a few creative ideas again been treated as heresy I would never understand.

Anyways. The civilian AI in the game is purely stupid. There is no (apparent and what one can see from the game itself, I have no idea of the code) logic in the civilian movements. At times you will see them running towards your men and relative safety and at another you will see them moving right next to aliens or worse still crysalids to be slaughtered. Their movements seem tottaly random and I cant believe that this simulates panic.

I can understand that a person who was just enjoying his dayly routine simply cannot find the mental capacity to understand what the hell is going on, who are these monesters, why the city is on fire and who the hell are those guys totting strange guns, and make sound decisions on the spot. But there must be 1 in 10 civilians who can at least understand that the human blasting at the monsters is at least a human and it MIGHT be a good choice to run to him (forget about lines of fire and things like that).

I agree with Solarius that there are a lot of things wich were made haphazzardly and without real consideration or for whatever other reason, but soddy work should be fixed weather intentional or not.

Should it be in the OpenX-com? Well, since the stated purpose is to recreate the original let them beeing dumb. Should it be done mod wise? Definetly.
Title: Re: Smarter Civilian AI?
Post by: yrizoud on April 08, 2015, 08:07:54 pm
In TFTD, I remember some cramped places with civilians (cargo ship corridors, tunnels under island hills). A trolling civilian can block them off indefinitely... no amount of AI will prevent that. So the player had better have an option, at least a stun rod.
Title: Re: Smarter Civilian AI?
Post by: redv on April 08, 2015, 08:45:35 pm
Option for example:
If civilian nearby at Xcom soldier (i.e. 2 tiles distance) then player can control this civilian during 1 turn. Almost the same as psi control.
Title: Re: Smarter Civilian AI?
Post by: Hobbes on April 08, 2015, 08:47:45 pm
Option for example:
If civilian nearby at Xcom soldier (i.e. 2 tiles distance) then player can control this civilian during 1 turn. Almost the same as psi control.

This would be pure evil... an army of my pet civilian zombies... I love this idea :D
Title: Re: Smarter Civilian AI?
Post by: Ridаn on April 08, 2015, 09:20:07 pm
I`d love to see civilians not dying from stun damage (at least score wise), and if stunned civilians counted as rescued if you drag them to escape zone and abort mission.
Title: Re: Smarter Civilian AI?
Post by: yrizoud on April 08, 2015, 09:28:30 pm
Option for example:
If civilian nearby at Xcom soldier (i.e. 2 tiles distance) then player can control this civilian during 1 turn. Almost the same as psi control.
I like it a lot ! It gives some additional choices to the player without requiring more items or menus. You can keep control of the civilian over several turns, by making him run from one of your soldiers to the next, or actually follow him back.
Title: Re: Smarter Civilian AI?
Post by: ivandogovich on April 08, 2015, 09:28:47 pm
Option for example:
If civilian nearby at Xcom soldier (i.e. 2 tiles distance) then player can control this civilian during 1 turn. Almost the same as psi control.

And.. if any civilian dies while under XCOM control, they count at 3X or more negative points.   (#SaveTheZombies) ;)
Title: Re: Smarter Civilian AI?
Post by: Solarius Scorch on April 08, 2015, 09:35:58 pm
At first I was like "arrrgh! I don't want the player to control civilians, that's silly!" like usual, but then thought, "hey, this might actually work". If it only applies to the ones that start their turn right next to an X-Com unit, this would make it a bit more believable. Furthermore, think of the role-playing/drama potential: a wounded soldier stay behind to protect a little girl they found. :)

Not to mention, most of these civilians will die anyway. And take some of your agents with them.
Title: Re: Smarter Civilian AI?
Post by: mrxian 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.
Title: Re: Smarter Civilian AI?
Post by: volutar 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.
Title: Re: Smarter Civilian AI?
Post by: DoxaLogos (JG) 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 :)
Title: Re: Smarter Civilian AI?
Post by: yrizoud 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 (https://openxcom.org/forum/index.php/topic,2254.msg22415.html#msg22415).

Known issue : Units block line of sight, so if you align a soldier and 2 civilians, the edge civilian will get his freedom back.
Title: Re: Smarter Civilian AI?
Post by: Hobbes 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.
Title: Re: Smarter Civilian AI?
Post by: pilot00 on April 09, 2015, 11:12:11 pm
Honestly I find it a bit too much to directly control them.
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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.
Title: Re: Smarter Civilian AI?
Post by: Bloax 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.
Title: Re: Smarter Civilian AI?
Post by: Yankes 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 :)
Title: Re: Smarter Civilian AI?
Post by: Bloax on April 22, 2016, 07:51:09 pm
Too bad! :-)
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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.
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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 (https://openxcom.org/forum/index.php/topic,4533.0.html) with enabled "Extend civilians behaviour" in advanced options.
Title: Re: Smarter Civilian AI?
Post by: Arthanor on April 25, 2016, 06:22:47 pm
What does 4 mean? A dead civilian reduces xcom and alien morale too?
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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).
Title: Re: Smarter Civilian AI?
Post by: Arthanor 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.
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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.
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com on April 29, 2016, 05:34:48 pm
If anyone interested, I tried to made some improvements in civilians.

What changed was from vanilla:

I added this in my OXCHA (https://openxcom.org/forum/index.php/topic,4533.0.html) as advanced option.
Title: Re: Smarter Civilian AI?
Post by: Arthanor 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?
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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.
Title: Re: Smarter Civilian AI?
Post by: Arthanor 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 :)
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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.
Title: Re: Smarter Civilian AI?
Post by: Arthanor 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 :)
Title: Re: Smarter Civilian AI?
Post by: Xtendo-com 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.
Title: Re: Smarter Civilian AI?
Post by: animal310 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
Title: Re: Smarter Civilian AI?
Post by: tkzv 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
Title: Re: Smarter Civilian AI?
Post by: NiceMicro 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)?
Title: Re: Smarter Civilian AI?
Post by: tkzv 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.
Title: Re: Smarter Civilian AI?
Post by: NiceMicro 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?
Title: Re: Smarter Civilian AI?
Post by: tkzv 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+).