project-navigation
Personal tools

Author Topic: Civilian AI Scripting  (Read 12633 times)

Offline PhilRoi

  • Rookie
  • ***
  • Posts: 50
  • EMT and Soldier
    • View Profile
Civilian AI Scripting
« on: June 17, 2009, 11:27:27 am »
In another post I posed a selection of AI behaviours for Civilians.

I put together an initial flowchart draft of this for a civilian behavior.

I figure most people can follow a flowchart even if they can't follow code.

I already have in mind about a half-dozen ways to simplify this,  keep in mind this is just a first draft.

http://members.toast.net/philroi/ufoai/AI.jpg


relies on determining which of 4 behaviors to perform.

Herd: stick close to other humans,  or alternately under dire threat phalanx soldiers
Hysteria:  run around aimlessly
Hide:  get low and stay out of sight, from phalanx and aliens depending on threats
Hero: On the off-hand chance we decide to arm the humans,  under dire threat they just might make a token attempt to fight back.  don't think they will do much since i can't see us giving them more then tiny pistols or knives to carry.  and if we never arm them it'll straight to hysteria.




[attachment deleted by admin]
« Last Edit: June 17, 2009, 04:45:25 pm by Mattn »

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Civilian AI Scripting
« Reply #1 on: June 17, 2009, 12:16:07 pm »
Actually civilians are expected to carry some weaponry on occasion, but they will never be able to inflict any serious damage on alien units.

Offline MXcom

  • Rookie
  • ***
  • Posts: 45
    • View Profile
Re: Civilian AI Scripting
« Reply #2 on: June 18, 2009, 12:24:39 am »
at one point in the lower left of your diagram it says "hide(phalanx)". Is that intended? Or is it a typo and it should mean herd(phalanx)?

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Civilian AI Scripting
« Reply #3 on: June 18, 2009, 07:33:18 am »
nice job - please make sure to add this to the wiki when you are done with it (maybe create an own ai coding section)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Civilian AI Scripting
« Reply #4 on: June 18, 2009, 07:34:31 am »
...oh, keep in mind that different alien races should act a little different, too. i suppose winter and btaxis can tell you more here (or look it up in the alien wiki articles)

Offline TrashMan

  • Captain
  • *****
  • Posts: 833
    • View Profile
Re: Civilian AI Scripting
« Reply #5 on: June 18, 2009, 01:29:20 pm »
Nice job. Makes sense and looks good.

But, given that everyone knows aliens are there and weapons can easily be bought - wouldn't most civilians arm themselves? With the best they could get? I see hunting rifles and shotguns in addition to pistols and knives.

Offline Tantalus

  • Rookie
  • ***
  • Posts: 28
    • View Profile
Re: Civilian AI Scripting
« Reply #6 on: June 19, 2009, 11:06:00 am »
Hi,

as far as I can see, there's not much of a difference between Civ injured or not. In my oppinion, an injured civ should never go hero, except he/she is traped somewhere without any way out (or is this ment by "danger close"?). The default for injured:yes and alien visible:yes should alway be hide (IMHO).

Regards
Tantalus

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Civilian AI Scripting
« Reply #7 on: June 19, 2009, 12:23:35 pm »
I'm not sure if injured civilians are relevant. Especially later on in the game it's unlikely a civilian will survive a shot from an alien weapon.

Offline Tantalus

  • Rookie
  • ***
  • Posts: 28
    • View Profile
Re: Civilian AI Scripting
« Reply #8 on: June 19, 2009, 01:19:07 pm »
Considering a direct hit - sure. But what about splash damage?

Regards
Tantalus

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Civilian AI Scripting
« Reply #9 on: June 19, 2009, 01:20:39 pm »
I'm not saying it's not possible, just that it's not going to happen often enough to warrant different behaviour. Especially since the player isn't going to be able to tell if the civilian is hurt or not.

Offline Tantalus

  • Rookie
  • ***
  • Posts: 28
    • View Profile
Re: Civilian AI Scripting
« Reply #10 on: June 19, 2009, 01:28:28 pm »
Well, in that case, you could drop the entire "injured:yes"-branch, or lets say reduce it to "hide" (injured civs always try to hide).

Regards
Tantalus

EDIT: What about limited ammo for armed civs? Do they count as "armed", when out of ammo? If no, I'd recommend to limit ammo very strictly.
« Last Edit: June 19, 2009, 01:54:41 pm by Tantalus »

Offline PhilRoi

  • Rookie
  • ***
  • Posts: 50
  • EMT and Soldier
    • View Profile
Re: Civilian AI Scripting
« Reply #11 on: June 20, 2009, 11:19:34 pm »
I was torn with the whole INJURED branch since it represents extra CPU cycles to process that extra conditional.  I can also re-arrange the priority of the conditionals so that being injured only makes a diffrence in a few specific cases.  reducing its impact on AI think time.

The Hide(Phalanx) behaviour is there to represent a very real human behaviour I have witnessed.  People with guns aka army types on the hunt make people very nervous.  They see Phalanx is rolling in and know that there is about to be a rumble and so they try and melt into the shadows in an attempt to avoid getting caught in the crossfire.  so no it isn't a typo.

And yes Danger Close means 2-3 spaces away.  Really awfully close.   I made the initial Script under the impression that Civ's would be rarely armed,  or at least that having them fight back was supposed to be rare.  now having armed neutrals is going to be more common then I thought.

really it sounds less and less like we are looking for an ALIEN AI and CIVILIAN AI as we are a HOSTILE AI that is coded to use aliens and a neutral ai that is coded to use civilians, police, non-phalanx military.  The Alien AI is a HIVE Mind so having a single AI that is flexible enough to recognize and exploit diffrences in alien type is perfect.   Now for the Neutral AI, those 3 groups that I mentioned are going to have very diffrent behaviours.

Civ's will be much like i described above, with some editing.
police forces are going to be focused on "rescuing" people and protecting Civilians.
Military types are going to group up and go hunting....
And not co-ordinating there actions between the 3 groups...

   Something for me to brain storm and work out.    Still very easy and do-able,  Just a case of working out how we want it to be.  Coding it is the easy part..


Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Civilian AI Scripting
« Reply #12 on: June 20, 2009, 11:27:26 pm »
And yes Danger Close means 2-3 spaces away.  Really awfully close.   I made the initial Script under the impression that Civ's would be rarely armed,  or at least that having them fight back was supposed to be rare.  now having armed neutrals is going to be more common then I thought.

What gave you that idea? Your original assessment was correct.

Quote
Civ's will be much like i described above, with some editing.
police forces are going to be focused on "rescuing" people and protecting Civilians.
Military types are going to group up and go hunting....
And not co-ordinating there actions between the 3 groups...

Mind you, police and military NPCs are NOT going to be a big part of any combat engagement. It's fine if you want to create an AI for that anyway, but you might want to give it a low priority.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: Civilian AI Scripting
« Reply #13 on: June 21, 2009, 09:20:26 am »
Mind you, police and military NPCs are NOT going to be a big part of any combat engagement. It's fine if you want to create an AI for that anyway, but you might want to give it a low priority.

yes - it should be a seperate ai script - not included in the civilian script. only very few maps needs this btw. (at least at the moment)

odie

  • Guest
Re: Civilian AI Scripting
« Reply #14 on: June 28, 2009, 09:13:08 pm »
In another post I posed a selection of AI behaviours for Civilians.

I put together an initial flowchart draft of this for a civilian behavior.

I figure most people can follow a flowchart even if they can't follow code.

I already have in mind about a half-dozen ways to simplify this,  keep in mind this is just a first draft.

http://members.toast.net/philroi/ufoai/AI.jpg


relies on determining which of 4 behaviors to perform.

Herd: stick close to other humans,  or alternately under dire threat phalanx soldiers
Hysteria:  run around aimlessly
Hide:  get low and stay out of sight, from phalanx and aliens depending on threats
Hero: On the off-hand chance we decide to arm the humans,  under dire threat they just might make a token attempt to fight back.  don't think they will do much since i can't see us giving them more then tiny pistols or knives to carry.  and if we never arm them it'll straight to hysteria.

Oooo, very logical and nice! Good work!

I thnk it might be a very good idea to get this scripted. :D