Has anyone made a mod where enemies take cover?

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Has anyone made a mod where enemies take cover?

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

by AFADoomer » Mon Nov 19, 2018 7: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.

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

by el armadillo2 » Mon Nov 19, 2018 1: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.

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

by Tormentor667 » Fri Nov 16, 2018 5: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 :)

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

by Kinsie » Thu Nov 15, 2018 8: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.

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

by Tormentor667 » Thu Nov 15, 2018 5:16 am

Blade of Agony

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

by Matt » Wed Nov 14, 2018 6: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!

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

by Caligari87 » Wed Nov 14, 2018 1: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-)

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

by Matt » Tue Nov 13, 2018 1: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?

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

by Rachael » Tue Nov 13, 2018 9: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.

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

by Caligari87 » Tue Nov 13, 2018 8: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-)

Has anyone made a mod where enemies take cover?

by el armadillo2 » Tue Nov 13, 2018 5:44 am

Not sure if this is possible, but i'm curious if anyone has attenpted this.

Top