Improved Monster AI Ideas

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Improved Monster AI Ideas

Postby Retraux Squid » Thu Feb 23, 2017 8:09 pm

This is a thread for ideas on making monsters smarter in a mod, discussing how it might be done, ways it would work, and other topical subjects. Since it's not really concerning the exact inner coding of such a thing (at least just yet), I put it in General.
Basically, post your ideas on making more intelligent (or at least apparently "intelligent") monsters here.

I'll start with a few ideas of my own (plus a few taken from browsing old threads):

- Intelligence scores. Depending on a monster's intelligence score it may do or not do certain things (i.e.: a zombieman might not blindly pursue you under a crusher, but a demon will).
- "Missions". Monsters would not just alternate between chasing and idling; they would have some sort of "mission" out of a few, such as searching for a target without knowing their current location, actively pursuing a target, breaking line of sight to reload or if afraid, fleeing, or executing special actions.
- Generally increased understanding of level geometry. Higher-IQ monsters might not pursue you into crusher sectors or over lava/nukage. They would try and go behind the nearest wall or obstruction to reload or if heavily wounded and/or afraid. They would only directly pursue you once they've spotted you, lose you after a period of time, and would then revert to simply searching for you, wandering around toward the last place they saw you. If they failed to spot you then, they'd go back to idling.
- Intelligent anti-infighting. You can still bait a Demon into running into the path of an Imp's fireball, but you can't just stand still and watch Zombiemen shoot each other in the back now. Monsters would make an effort to not hit friendlies when attacking, only doing so by mistake, whether it be allies running into their line of fire or simple weapon spread.
- Improved movement. Zombies and imps would strafe back and forth like slow-moving bots as they shot at you. Demons would headlong charge with quite a bit of momentum. Cacodemons would strafe away from rockets. Barons of Hell might pressure you, stomping toward you as they continually hurl fireballs. Generally attempt to avert the extremely mechanical "walk, stop, shoot" of Doom monsters.
- Varied reactions. More intelligent monsters might panic and run from an invulnerable player.

What do you guys think? Feel free to add and contribute.
User avatar
Retraux Squid
A_PosAttack
 
Joined: 13 Aug 2016
Location: E1M1

Re: Improved Monster AI Ideas

Postby Reactor » Thu Feb 23, 2017 8:19 pm

Previously it had been discussed that static monsters could have the "Ground Zero AI". In Quake 2 "Ground Zero", if you pop out from behind a wall and shoot at enemies, they'll usually keep your last known location under fire, knowing damn well that you will try to pop out every now and then to hit them. Turrets are especially fond of this tactic.

Airborne monsters strafing rockets would be a fine addition too - Duke Nukem 3D Sentry robots and those floating pigmobiles also made this kind of evasive maneuver, so it was not uncommon to waste 5-6 rockets just to bring those suckers down.
User avatar
Reactor
The militarist
 
Joined: 03 Feb 2011
Location: Island's Beauty, Hungary

Re: Improved Monster AI Ideas

Postby Retraux Squid » Thu Feb 23, 2017 9:31 pm

Reactor wrote:Previously it had been discussed that static monsters could have the "Ground Zero AI". In Quake 2 "Ground Zero", if you pop out from behind a wall and shoot at enemies, they'll usually keep your last known location under fire, knowing damn well that you will try to pop out every now and then to hit them. Turrets are especially fond of this tactic.

Airborne monsters strafing rockets would be a fine addition too - Duke Nukem 3D Sentry robots and those floating pigmobiles also made this kind of evasive maneuver, so it was not uncommon to waste 5-6 rockets just to bring those suckers down.


Suppressive fire would be great for zombie enemies, especially chaingunners, if you want to give them a more intelligent bent (i.e. understanding tactics beyond "walk and shoot"). It can be accomplished extremely easily actually- just have the monster go to a Suppress state in which it just shoots at the player's position continually for a period of time. While it's actually shooting at the player in that instance, to a player hiding behind a wall with the sound of gunfire and death just beyond them, it makes no difference (save actually seeing bullets ping on the walls near them).
User avatar
Retraux Squid
A_PosAttack
 
Joined: 13 Aug 2016
Location: E1M1

Re: Improved Monster AI Ideas

Postby NantoCodd » Fri Feb 24, 2017 6:36 am

- projectile firing enemies that induce splash damage, like Cyberdemon, shoots on the ground the player stand on. This is a trick often told and used by TF2 soldiers player
- hitscan enemies, like zombieman and chaingunners, use the tap-shoot (the first two shot of pistol and chaingun always accurate) when they shoot distant enemies
- shotgunner try to get closer, rather than uselessly shooting 1 km away from player
- pinky demons use themselves as a meatshield for other demon. They are huge, have a quite big health pool, and numerous.
- projectile enemies leading their target, so they will shoot to where player more likely move rather than where the player currently stand.
User avatar
NantoCodd
 
Joined: 18 Jul 2013
Location: The Ultimate DOOUMB

Re: Improved Monster AI Ideas

Postby sonic_HD87 » Fri Feb 24, 2017 10:08 am

A player constantly spawning a HateTarget when some monster(s) see him. Utility? When the player hides (when is no longer at the sight of any monsters), the monsters will attack the last place where the player was seen, which is where the HateTarget is located.

Other idea could be that the monsters move to specific areas where the player can't attack them,but that would be material for custom maps.
User avatar
sonic_HD87
Intel GM45 Master Race
 
Joined: 23 Mar 2013
Location: Venezuela

Re: Improved Monster AI Ideas

Postby Reactor » Fri Feb 24, 2017 11:39 am

I enjoyed the combat tactics the Z-Sectors did in Doom 3. Namely, they could step in and out of cover, especially the Machinegun Z-Sectors. Human enemies could also use "whack-a-mole" tactics - popping out of air ventillation shafts in the ground or on the ceiling. Currently this can be done by designing a duplicate of said enemy with its legs removed and making him static & retract to the air duct when he spent his shots.
User avatar
Reactor
The militarist
 
Joined: 03 Feb 2011
Location: Island's Beauty, Hungary

Re: Improved Monster AI Ideas

Postby Matt » Fri Feb 24, 2017 4:07 pm

Just thinking aloud...
Code: Select allExpand view
if(checksight(actualtarget)){
 target=actualtarget;
 lastpostarget.pos=actualtarget.pos;
}
else target=lastpostarget;
User avatar
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Improved Monster AI Ideas

Postby Kinsie » Sat Feb 25, 2017 9:55 am

I had an idea a while back for a simple system where monsters of the same species that are within sight/hearing range of each other share target info. So if an Imp hears you, and there are some Imps standing around nearby, they also wake up and target you. Or alternatively, if one Shotgun Guy in a group fires at you, misses and hits a troupe of Imps, a riot ensures...

This would probably need a special case for a monster hitting a monster of the same type...
User avatar
Kinsie
Dog Days
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: Improved Monster AI Ideas

Postby Gutawer » Sat Feb 25, 2017 10:38 am

I suppose I should post this here, then:
https://streamable.com/bh3ig
Been working on some ZScript AI stuff myself (not because of this thread) and I suppose this is as good a time as ever to share it. Currently the code only works on Imps, but every enemy would/will (if I finish it) inherit from the SmartActor class so they can use the jumping-out-of-the-way functions. They currently jump out of the way under a few conditions - they will jump if they are in sight of the target, even more so if the target is looking directly at them and even more so if the target is firing. Also, they will jump out of the way of anything with the MISSILE flag. If you want to do anything with it (pk3 is attached) then be my guest, though I'd like credit. It's also not in an entirely finished state, and I do plan to add the other enemies, which is a just matter of figuring out how they should behave.
You do not have the required permissions to view the files attached to this post.
User avatar
Gutawer
User Accounts Assistant
 
Joined: 16 Apr 2016
Discord: Gutawer#3431

Re: Improved Monster AI Ideas

Postby Kaminsky » Sat Feb 25, 2017 11:27 pm

I would like to add that monsters should be able to predict a target's movement effectively so that they can fire projectiles at a direction where it's expected to hit the target in some time rather than fire at the direction where the target currently is relative to the monster. Knowing the speed and direction of its target as well as the speed of the monster's own projectile, it could perceptually aim itself to fire ahead of the target and potentially hit them at the right moment.

I tried to design a smarter monster AI system using ACS and DECORATE in the past, which was intended to be a resource that could work universally for any monster that would inherit its base class. Some ideas I had in mind were:

  • Improved map geometry perception and navigation (monsters exploring maps more accurately based on obstructions, elevation, brightness and more).
  • Improved combat/dodge techniques that would provide a more unpredictable and challenging experience for players.
  • Monsters capable of pressing/using switches, doors and lifts.
  • Monsters capable of crouching, jumping, swimming and climbing up/down ladders.
  • Monsters with different specialties, when grouped together, working together to take down their target(s).
  • Friendly monsters that would be useful companions for the player(s) in coop/survival gamemodes, and even follow them between levels until they die.

There were more things I planned to work on as well, but these were some of the bigger tasks.

I never got around to perfecting the system due to the limitations of ACS and DECORATE, but with ZScript's more advanced features, I might be able to code something that's as ambitious as this. Maybe some of the points I mentioned above can be an inspiration for any ZDoom AI system that others could be working on.
Kaminsky
 
Joined: 12 Dec 2016

Re: Improved Monster AI Ideas

Postby Ravick » Sun Feb 26, 2017 12:10 am

I'd be happy if only monsters could not just fire at each other. Let's say, if a group of shotgunguys is chasing you, the ones in the end of the mobwill avoid firing until there is no more shotgunguys in front of them.

I vaguely remember seeing a DECORATE function in the wiki that could be used to achieve that, but I lost it (¬¬)
User avatar
Ravick
Do what thou wilt, since you don't bug the hell out of me!
 
Joined: 22 Aug 2010
Location: Tubarão, Brasil

Re: Improved Monster AI Ideas

Postby Nash » Sun Feb 26, 2017 12:13 am

Kaminsky wrote:ideas


The line array isn't available in ZScript yet, but once that is - and combined with trace hit results (also not in yet but planned, according to Graf Zahl) - you'd be able to iterate through the line array just like how you can with the sector array right now to query the map geometry, and code some more complicated navigation and decision-making AI.

Let's say, if a group of shotgunguys is chasing you, the ones in the end of the mobwill avoid firing until there is no more shotgunguys in front of them


ZScript can already do this; what you'd do is fire a small cone of LineAttack or AimLineAttack (use a for loop) and for each trace, make sure the received LineTarget isn't of its own kind (using the "is" operator). If a trace hits its own kind, it's considered a fail. If even 1 trace fails, consider the attack has failed and abort the attack. If all traces do not fail, proceed with the attack. It's actually much shorter in code than it is to type this, haha.
User avatar
Nash
Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: Improved Monster AI Ideas

Postby Kaminsky » Sun Feb 26, 2017 9:38 am

Nash wrote:The line array isn't available in ZScript yet, but once that is - and combined with trace hit results (also not in yet but planned, according to Graf Zahl) - you'd be able to iterate through the line array just like how you can with the sector array right now to query the map geometry, and code some more complicated navigation and decision-making AI.


Originally I had my monsters use LineAttack() to fire hitscans in several directions that would eventually hit a wall, where I can measure the distance between the monster and the puff. I also spawned a special "floor hugging" actor that circled around the monster from some distance (depending on its radius) where I could also determine the z-value of the sector's floor/ceiling. These checks would be performed for at least every tic, and given the information of its surroundings, the monster could make better decisions on how to navigate its environment without getting lost/stuck.

But now that you mention using the Line and Sector arrays in ZScript, I'm sure these checks can be handled more efficiently than before, and with more potential. Thanks for the advice!
Kaminsky
 
Joined: 12 Dec 2016

Re: Improved Monster AI Ideas

Postby Retraux Squid » Sun Feb 26, 2017 12:37 pm

On the subject of monsters intelligently using the environment, I think it could be possible to get hitscanners to try and take cover a la Doom 3's Z-SECs.

You could, for example, have a combat scenario like this:
> Step through a doorway. Encounter a zombieman armed with an assault rifle.
> Zombieman backpedals while facing you and shooting. They scan their environment and find a pillar nearby, which they hide behind.
> A far off shotgun guy hears the zombie and enters a "suspicious" state. It starts walking toward the noise but isn't totally alerted yet.
> Zombieman scans environment and chooses a direction to strafe toward, shoot a burst or two, and then strafe back into cover.
> You hide behind a wall. The zombieman strafes out of cover, and pins you down with bursts.
> Zombieman has to reload, so it finds cover to do so.
> You shoot the zombieman as it strafes out of cover. The zombieman immediately hides.
> The shotgun guy reaches you and immediately is alerted. It goes through the same routine as the zombieman, though it tries to rush you if you hide.
> The zombieman gets wounded again and hides in cover. This triggers the shotgun guy, who was in cover, to strafe out and start shooting.
> You kill the zombieman and manage to flank the shotgun guy. He is now exposed, so he shoots you and backpedals around his cover.

Sounds pretty complex, but I'm sure it could be done with the use of special "scanning attacks" (the previous posts' mention of strategically using LineAttacks and such to give monsters info on their environment), perhaps placing "cover node" actors in a map, and other code wizardry.

Other monsters could have less complex but equally difficult behavior. For example:
> Encounter a Baron of Hell near a few explosive barrels.
> Baron of Hell picks up the barrel, Brutal Doom style, and flings it at you.
> You take out the BFG-9000 and shoot.
> Baron of Hell recognizes the BFG shot (possibly through a cone of tracers) and leaps out of the way.
> You close in with a super shotgun.
> Baron of Hell charges toward you and melees you.
User avatar
Retraux Squid
A_PosAttack
 
Joined: 13 Aug 2016
Location: E1M1

Re: Improved Monster AI Ideas

Postby Reactor » Sun Feb 26, 2017 12:44 pm

It is possible to program a human enemy to shoot from cover? It wouldn't move from its original position, so no moving frames would be needeed, it'd step out of its cover, shoot a little and quickly get back there in a "replay" style. Doom 3 had many such occassions, where pistol and shotgun Z-Sectors did the same, and sometimes even the Chaingun Commandos did it.
User avatar
Reactor
The militarist
 
Joined: 03 Feb 2011
Location: Island's Beauty, Hungary

Next

Return to General

Who is online

Users browsing this forum: Vphurple Izumi and 4 guests