Has anyone made a mod where enemies take cover?

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

Has anyone made a mod where enemies take cover?

Postby el armadillo2 » Tue Nov 13, 2018 6:44 am

Not sure if this is possible, but i'm curious if anyone has attenpted this.
el armadillo2
Anyone that has a custom title is gay.
 
Joined: 11 Nov 2016
Location: Somewhere over the rainbow.

Re: Has anyone made a mod where enemies take cover?

Postby Caligari87 » Tue Nov 13, 2018 9:45 am

Hideous Destructor does, in a fashion. Monsters will sometimes try to move toward your flanks, or will retreat when they are hurt or need to reload, for example. Someone else posted an AI experiment a while ago with a shotgunner that could run out of shells, and wouldn't reload until he'd safely broken line-of-sight with the player. It's certainly possible, with clever scripting.

8-)
User avatar
Caligari87
I'm just here for the community
User Accounts Assistant
 
Joined: 26 Feb 2004
Location: Salt Lake City, Utah, USA
Discord: Caligari87#3089

Re: Has anyone made a mod where enemies take cover?

Postby Rachael » Tue Nov 13, 2018 10:21 am

Caligari87 wrote: Someone else posted an AI experiment a while ago with a shotgunner that could run out of shells, and wouldn't reload until he'd safely broken line-of-sight with the player. It's certainly possible, with clever scripting.

I believe that's what Kinsie did in JPF.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: Has anyone made a mod where enemies take cover?

Postby Matt » Tue Nov 13, 2018 2:38 pm

Caligari87 wrote:Hideous Destructor does, in a fashion. Monsters will sometimes try to move toward your flanks, or will retreat when they are hurt or need to reload, for example. Someone else posted an AI experiment a while ago with a shotgunner that could run out of shells, and wouldn't reload until he'd safely broken line-of-sight with the player. It's certainly possible, with clever scripting.

8-)
To clarify, HD monsters don't look for cover, they just move randomly to try to get out of your line of fire.

The reloading-only-out-of-sight thing can be done relatively easily, but I see too many maps where at least one of the following apply:
1. the shotgunner is in a spot where it can't do anything to break LOS (pillar, cage, big open arena, etc.)
2. there's at least one other monster that can shoot at the player and create a distraction, during which the shotgunner's time is better spent reloading so it can eventually return the favour when that monster eventually has to reload (or die and wait for the healer imp)

Was it you or Josh who had that thing where the monster will check line of fire/sight with its target at 8 points around it, then move towards one where there is no line?
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: Has anyone made a mod where enemies take cover?

Postby Caligari87 » Wed Nov 14, 2018 2:55 pm

The initial implementation was mine, where enemies would simply path toward the last point the player was seen instead of the player's current pos (and clear their target if they're out of LoS too long). Josh then expanded on it to create a "searching" system where the initial node spawns several more for the monster to try and investigate in sequence. That's in UaS currently.

Alternatively maybe you're referring to my AI proposal to have monsters set goals for cover or other goals by shooting traces or spawning "imaginary" wandering copies of themselves. I never put down any code for that.

8-)
User avatar
Caligari87
I'm just here for the community
User Accounts Assistant
 
Joined: 26 Feb 2004
Location: Salt Lake City, Utah, USA
Discord: Caligari87#3089

Re: Has anyone made a mod where enemies take cover?

Postby Matt » Wed Nov 14, 2018 7:17 pm

Caligari87 wrote:Alternatively maybe you're referring to my AI proposal to have monsters set goals for cover or other goals by shooting traces or spawning "imaginary" wandering copies of themselves. I never put down any code for that.

8-)
That was it. Not ruling out the possibility of stealing that idea in the unforeseen future!
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: Has anyone made a mod where enemies take cover?

Postby Tormentor667 » Thu Nov 15, 2018 6:16 am

Blade of Agony
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Has anyone made a mod where enemies take cover?

Postby Kinsie » Thu Nov 15, 2018 9:05 pm

Rachael wrote:
Caligari87 wrote: Someone else posted an AI experiment a while ago with a shotgunner that could run out of shells, and wouldn't reload until he'd safely broken line-of-sight with the player. It's certainly possible, with clever scripting.

I believe that's what Kinsie did in JPF.
Effectively! Basically, Shotgun Guys spawn with a "magazine" variable initialized to a random number between 0 and, say, 8, that goes down every time they shoot. If they try to shoot with their magazine at 0, they make a comical "CLICK" sound, freak out, turn on the FRIGHTENED flag, and enter a new state where they don't attack and are constantly checking that they're out of the LOS of any players. Once they're out of sight, they start very loudly reloading, resetting their magazine variable, and returning to normal behavior.

There are probably cleaner/better ways to implement it, code-wise, as it still uses a lot of DECORATE-style logic, but it's pretty readable and works fine in-game, which are the two most important things.

Tormentor667 wrote:Blade of Agony
I feel like this thread is more for discussing how mods have implemented such functionality, rather than just hurling out a name and running.
User avatar
Kinsie
A Concept Utterly Obsolete
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: Has anyone made a mod where enemies take cover?

Postby Tormentor667 » Fri Nov 16, 2018 6:18 am

Kinsie wrote:I feel like this thread is more for discussing how mods have implemented such functionality, rather than just hurling out a name and running.

Well, I thought it was exactly that :)
User avatar
Tormentor667
needs more detail
 
Joined: 16 Jul 2003
Location: Germany

Re: Has anyone made a mod where enemies take cover?

Postby el armadillo2 » Mon Nov 19, 2018 2:12 pm

Tormentor667 wrote:
Kinsie wrote:I feel like this thread is more for discussing how mods have implemented such functionality, rather than just hurling out a name and running.

Well, I thought it was exactly that :)

Both.
el armadillo2
Anyone that has a custom title is gay.
 
Joined: 11 Nov 2016
Location: Somewhere over the rainbow.

Re: Has anyone made a mod where enemies take cover?

Postby AFADoomer » Mon Nov 19, 2018 8:01 pm

In Blade of Agony the standard Nazi-type actors have rudimentary handling for something like this...

They don't really intelligently take cover, they just dodge left or right. The dodging is initiated during the See state when certain conditions are met (a timer countdown between dodges, an optional cap on the total number of dodges allowed, and a random number check). When the conditions are met, an internal function checks to see which side (the actor's left or right) has a farther valid movement distance available, then the actor changes to a state that looks like they are rolling sideways and moves in that direction. They're also invulnerable during the "roll" sequence, so that they actually can get away from you (plus then we don't have to make rolling death sprites...).

A second feature that I recently implemented (it's not in the Chapter 2 release version) is that enemies will actively run away from thrown grenades. Every 10-15 ticks (it's randomized so they don't all check at once), the actor checks to see if it's in range of any grenade actors (for performance reasons, the base grenade actor that is inherited from by every grenade in game is set up with a specific STATNUM). If so, the actor turns frightened and increases its move speed by 1-2 (and the custom chase function makes them run away without firing if they're running from a grenade). Once the grenade explodes, the actor's behavior returns to normal.

You can see all of the code for this here. There's a lot of other code there, too, though (stealth/visibility handling, medic corpse finding and healing, goal seeking, etc.). *I* think the code is relatively logical, but I wrote most of it, so... Feel free to ask if you have questions.
User avatar
AFADoomer
 
Joined: 15 Jul 2003


Return to General

Who is online

Users browsing this forum: Yandex [Bot] and 1 guest