TheGameCreators / GameGuruRepo

The GameGuru Repository For Community Collaboration
http://www.game-guru.com
137 stars 56 forks source link

GGM - A number of AI improvement suggestions for Soldiers/"Character Attack" behavior. #4238

Open fearlesswee opened 1 year ago

fearlesswee commented 1 year ago

Some of these improvements could be done now via custom behaviors or editing the default soldier script, however not only would some require fundamental engine-level changes, but I feel that including these improvements as an out-of-the-box thing for all users would greatly improve the default AI in MAX (which are many peoples' first impression of what kind of games MAX can make, and “poor AI” is a very, VERY common complaint across TGC’s game makers.)

  1. More moving around. Much like GGC AI (especially from the early days), the MAX AI seem to have a bad habit of "turreting", where they just sorta stand in one spot shooting at the player like a stationary turret. They should instead choose to move around more often whilst in combat; taking a moment to fire a burst or two at the player, then reposition somewhere nearby to make them feel less stationary and simple-minded. They should also strafe/move around more whilst firing. (Which they seem capable of firing on-the-move right now, but they do it so rarely it almost doesn’t affect anything.)
  2. Seeking cover. To help give the AI a sense of self-preservation (in turn making them feel smart, and make them more challenging to take down) they should seek cover when a fight begins (if they are configured to do so; maybe there could be a dropdown to select their cover preferences; like "AlwaysTakeCover", "SometimesTakeCover", "TakeCoverWhenHurt", or "NeverTakeCover") Cover could be detected automatically (as IIRC Recast Detour has the ability to do so) or it could be manually marked with zones akin to Classic. The former has the benefit of requiring no user setup at the cost of being at the mercy of the auto-generated cover points (could lead to silly/nonsensical behavior like using an explosive barrel as cover), whereas the latter is the inverse.
  3. Detecting and fleeing from grenades. Typically in FPS games, grenades aren't really meant to outright kill your opponent, but rather can be tossed over cover to flush your foe out into the open where they are more vulnerable. With the addition of seeking cover as mentioned above, if the AI could detect nearby thrown grenades and react to them (have a voiceline screaming "grenade!" and they flee away from it, sometimes out into the open) it'd help grenades stand out more as a utility item instead of just being a very slow and unreliable way to deal damage as they are now.
  4. Using grenades themselves. Having the actual ability to use grenades themselves to flush the player out of cover helps make fights more interesting and discourages a "war of attrition" where both sides are hiding behind cover taking potshots at each other to slowly whittle each other's health down. (Grenade throwing seems planned as the soldiers have an unused grenade throwing animation; could be finished by implementing my earlier suggestion of #835 and using that new .Lua command to just create a grenade projectile on-the-fly!) Now if they just kinda lobbed a grenade in the player's general direction that wouldn't as good as if they were capable of using the projectile motion formula to throw it in an arc to reach over an object the player might be hiding behind, as well as the AI not requiring line-of-sight to be able to toss a grenade. (As long as they saw the player within the last 2-3 seconds, they should “know” the player’s location to be able to throw a grenade over cover accurately.)
  5. Being able to fire where they last saw their target. In a lot of shooters, when an NPC loses sight of the player/their target, they’ll keep firing on the last position they saw them for a bit, acting as “suppressing fire” which not only makes the fight feel more action-packed and still ongoing when the player ducks into cover for bit rather than every enemy suddenly falling silent, but also serves a gameplay purpose in that it prevents a player playing “peek-a-boo” around a single corner, and instead encourages them to mix up their strategy a bit to not appear from behind cover in the same location twice. At the moment the weapon/character system seems to be strictly hardcoded to only allow firing at a specified "target", and has annoying built-in checks for line of sight, angle, etc. These hardcoded checks should be entirely removed and implemented in the .Lua script itself (so we could do away with them if desired), and the FireWeapon() command should take a specified X,Y,Z position instead of using the "target" system (so we can make NPCs fire at any arbitrary location we want, be that the last-seen-position of their target, at an explosive barrel near their target, or even something like firing at a particular object for a scripted sequence/cutscene; like some soldiers shooting at targets on a shooting range in a level that takes place in an HQ or base for example.)
  6. More combat barks. In games like F.E.A.R. (an older game known for it’s incredible AI that’s often considered still better than AI in modern games…) many people note that a big factor in helping their AI feel intelligent is “combat barks”; basically the NPCs will scream out whatever action they are performing to help communicate to the player that they’re “thinking” and “making decisions”. For example, if an NPC just silently runs around a flank route to attack the player, one could be forgiven for not even noticing they made a decision to flank and thinking it was just a random fluke of their pathing. If instead they shouted to their squad “I’m gonna try flanking the bastard to draw him out!” and the squadmates respond with “Roger that!” they’d be astonished at how intelligent the AI seems, because it makes their “chosen actions” seem more premeditated, as if they were evaluating the situation and making decisions rather than acting on a whim (randomly and therefore unintelligently.) This would also help the player in gameplay purposes; for example if they shout “frag out!” or “take this!” before throwing a grenade, the player knows a grenade is on the way and can prepare. (And in F.EA.R. specifically, they go as far as to shout to their squad the player's precise location like "He's behind the table!" or "Behind the vending machine!" to alert the player that they've spotted them and are probably planning to flank/throw a grenade. Extremely impressive and makes the AI almost feel like human opponents in a multiplayer game, albeit a bit excessive for a pack-in feature for MAX. I wouldn't say no to going this in-depth with a combat bark system however!)
  7. Fix the stunlocking! You could add all these above features, and it wouldn't matter when anytime an NPC so much as took a sneeze's worth of damage they break out into this awkward shuffle dance "stumble" animation on loop as they do now, making it laughably easy to glue an NPC in place and finish them off without them having any chance to display any kind of interesting behavior. (Without the survivability for a fight to last long enough for NPCs to show off their AI, it doesn’t matter how smart/dumb they are when they are glorified practice dummies!) NPCs should absolutely have some kind of animation to give feedback that you're damaging them don't get me wrong, but instead this animation should be a more subtle/tame "flinch" reaction that gets blended over whatever animation they're currently playing (so they could flinch to give feedback while also still engaging in actions like reloading, walking, or even shooting back), with the current full-on stun animation only playing for high-damage attacks, or to have a small chance to play when damage is taken (sorta like the way pain-states work in the old DOOM games.)

I'd be very, very interested to hear a TGC developer's thoughts on each of these suggestions to know what they think of them from a gameplay standpoint, their thoughts/questions/concerns regarding implementation, possible technical hurdles, etc. I'd hate for this to just get slapped with the old "enhancement" sticker with no further elaboration of any kind and left to collect dust.

davetgc commented 1 year ago

The pseudo AI in F.E.A.R is very well handled, even today. I don't personally support all of these 100%, as we'd want to maintain user freedom, but many are good.

fearlesswee commented 1 year ago

The pseudo AI in F.E.A.R is very well handled, even today. I don't personally support all of these 100%, as we'd want to maintain user freedom, but many are good.

That's the thing, many of these are impossible to do without base engine-level additions, meaning there isn't user freedom here. If you added support for NPCs to throw grenades, for example, you could just have an option to switch it off. That way people who want them can have them, and those that don't, don't. But as it stands we're all forced to not have them, because the engine doesn't support it.

Tum1370 commented 1 year ago

i agree that the AI needs a big overhaul.

  1. Using doors
  2. Handling grenades
  3. Use cover whilst fighting if available
  4. They should not just be stupid and ignore the player if getting shot whilst player is out of AI visual range (they should move to cover if dont know where getting shot from.
  5. Loot guns off other dead AI (maybe have a chance of a better gun)

Also AI needs fixing as i have posted several time.

  1. Retreat does not work.
  2. Sounds are not working (not all the sounds work now, I only ever hear the sound when they see you)
  3. FIx the Sound variants (As above, most of the sound system does not work)
  4. Stand Ground does not always work (If an AI is placed in cover, say behind a sandbag) it should not push forward at all to shoot)

All the AI should be optional as well, like percentage chance etc. Example : If AI Health drops below 70% take cover. Example : If AI Health drops below 40% retreat. Example : AI has 0% chance to take cover. Example : AI has 70% chance to Stand Ground. Example : AI has 10% chance to Flank Target. Example : AI has 40% chance to Get Close to Target. Example : AI Accuracy is 75% Example : AI damage multiplier is 50 Example : AI Health Regen is 20 hp per 10 seconds.

A lot of these things are already in there, and just need more options, so the DEV can fine tune his AI how he likes it to be.

I cant see that a lot of this stuff would be hard to add, and it would make the AI so much more customisable.

Necrym59 commented 1 year ago

This has all been asked for before, add it to existing posts is much better than repeating everything over and over

davetgc commented 1 year ago

See also: #4161 #4026 #2513

I'm closing other threads on AI enhancements in favour of this one.

Necrym59 commented 1 year ago

Its no wonder things get lost or substandard changes get made arbitrary closing of threads achieves nothing as all ideas should be stored and investigated for merit not just decided upon by one person that always leads to bad outcomes.

davetgc commented 1 year ago

Nothing is getting missed, just combined so that the AI threads are in a single place. Closed threads will be linked here on this issue. As a reminder to everyone, please use the search function before posting as it helps to have similar requests in one place. You can always add to an existing past.

Kitakazi commented 6 months ago

AI do not ragdoll when killed by an explosion. If I blow up a barrell next to an enemy character they should ragdoll 20 feet in the air or w/e distance away from the explosion depending on what their weight is set too or what the initial explosion damage is set too. Obviously same thing for the enemy being killed by a grenade. Having the enemy play a death animation like they were shot in the stomach when they were killed by an explosion looks strange.

Doesn't seem to be a way to have enemies go to ragdoll and be affected by external things like explosions at the moment.