(Working title). You are hunted by a group of elite black ops soldiers. Use your superhuman abilities to survive. Become invisible and ambush your enemies. Activate slow motion to dodge bullets and perform impossibly badass combat maneuvers.

Report RSS AI Goal system, stun animations

Rewritten goal system for enemy AI so they can assault, defend and patrol intelligently. Also stun/flinch animations for enemy soldiers, for better damage feedback.

Posted by on

You creep up to the enemy fortress stealthily, eliminating guards on the way with well placed silenced headshots. Just as the front gate comes into view, a sentry spots you and sounds the alarm. The entire fortress lights up and you run for a vantage point as hordes of enemy soldiers stream out and stand in the open, waiting for you. At first you gain the upperhand by skillfully headshotting dozens of them, but your ammo starts to dwindle as they quickly replace their casualties with even more soldiers rushing out of the fortress. You pull out your machine gun and charge for the gate while mowing down whatever gets in your way. During this massacre you stop to reload behind a pile of sandbags. Okay, good to go - you jump out to finish them off - but to your surprise every soldier has turned around, running back inside the fortress. What happened??

What's wrong with modern FPS AI??

In most shooters these days, enemy movement and spawning is completely controlled by triggers, so enemies are unable to take cover or maneouvre intelligently. They just spawn and move to a scripted position. If they live long enough, they move to the next scripted position when the player reaches the next trigger. The problem with this is that it cripples even the best AI and it's a an extremely tedious job for level designers to script and test every possible position enemies should move to in response to every possible position the player can take.


(Here's a youtube video illustrating that problem in Battlefield 4's campaign. The level designers didn't anticipate the player would rush with a shotgun, so they didn't script the soldiers to take cover or retreat properly - notice how awkwardly they move, and "take cover" behind objects the wrong way. This is a serious flaw with the way most games rely on scripting over AI. I don't mean to take cheap shots at BF4, I'm actually a huge fan of the series. )

Okay great, how will your game deal with this?

As a 1 man team doing both programming and level design, it would also be completely unfeasible for me to even attempt to script AI this way (for example, the player enters this room, these bad guys should flank here, these bad guys take cover here - it would take months to script each gunfight). So the solution is to create a very flexible and autonomous enemy AI that doesn't need hand holding and micromanagement, while responding to the player's actions in a believable way.


In this encounter, the enemies try to defend this "building" from the player - falling back, taking cover and flanking when appropriate. There is 0 scripting - I just set the zones for the AI to try to defend, and they'll do their best following a lot of AI decisions. This is actually very difficult for AI to do (since it's such an abstract task - usually game AI just has simple scripts like move to this position, look at this position etc) and outside of milsim games I've actually never seen a system like this before.

The truth is, even in the demo from last February, there was no scripting whatsoever (triggers were only used to spawn AI), so everything you saw there was purely AI. Even now there exists no system to force the AI to do anything, and I don't plan to implement one because it isn't necessary.

Here's a stress test, where a ton of AI assault/defend (right side defend, left side assault - the black spheres are defend zones, red spheres are assault zones). No scripting or triggers - the AI tries to assault/defend their zones, but retreat, take cover, flank etc when they deem necessary.


This is some cool tech, but what does this mean to me, the player?

There's three main benefits I can think of:

  1. Encounters are more open and dynamic, since AI will always react dynamically to whatever you do, and environments can be any size and your enemies will behave intelligently with it
  2. This game will be finished in a realistic time frame, not requiring months to script every battle
  3. No weird AI bugs/stupid behavior where enemies take cover facing the wrong way, charge your position in a straight line etc

Here's some examples of me just playing through the same test map with the same AI. Notice how the AI reacts against me - falling back when I'm aggressive, but trying to counterattack when I'm being passive.



Also... Stun animations!

Enemies have a chance of being "stunned" by damage, and with melee and explosions it's 100%. There was no animation for this before so enemies would just stupidly stand in place while they were "stunned". Now it's obvious with an animation, and playtesters are always happy to finish off stunned enemies :)


Coming up next...

As you probably know, "Trepang2" was a temporary placeholder name. A proper name and logo have been decided on and are in the works, so look out for the next time! Also perhaps some details on the story and setting ;)

Last but not least... funding

This project is totally funded by me, and it's not cheap! (I spent over $1000 USD last month on software!). I won't even think of doing crowdfunding or early access or anything like that, at least not until the game is mostly finished. Currently my only income is doing contract work for other game developers. I do programming but also 3d stuff, so if you'd like to hire me or know of someone who'd like to, my portfolio is here: Frosttree.ca

Comments
SPY-maps
SPY-maps

Hello Wilson, we already discussed some of this earlier in pm's. But great that you did write this article. Because most people probably don't even realise how big a role AI playes in games these days. We probably only notice it when it is done badly. Fear games are great with there AI, and it also amazes me that game devs these days can't come up with better AI. The last 10 years or so i have mapped a lot with HL2 and its episodes and the AI in HL2 is ok although it has it faults. I to did make use of a lot of triggers to get AI to better work. But as in your examples it can go wrong then. I made the last few years a lot of use of one particular entitie which made that the enemies knew AT ALL TIME were the player was. So i triggered them to do certain things but ones they had done so they still started to attack the player, even when they couldn't see him. This was a good was to overcome silly AI behavior.

Leon

Reply Good karma Bad karma+4 votes
wilsonC Author
wilsonC

Yeah I was guilty of using the all seeing enemy detector in my HL2 maps as well (I forgot what it's called sorry lol).

Can't do that here though, because the player can go invisible at any moment and the maps are more open ended, so it'd feel cheap if the player snuck around the enemy only for them to instantly detect you. So I actually had to write an intelligent searching and guessing system for them to think of where the player goes when he's out of sight, and can be foiled if the player is sneaky.

Reply Good karma+3 votes
Wolfofdoom3
Wolfofdoom3

Really impressive and I agree with SPY, I don't even know witch other other games DON'T use triggers and nodes for their npcs, if there are any I should look it up.I mean rain world,for example,has some impressive Ai for their type of game but of course it's a totally different genre and this article (https://waypoint.vice.com/en_us/article/9a7dpv/rain-world-is-like-stalker-but-a-platformer-and-youre-a-rodent) might explain some things better,feel free to take some cues if you want.

Reply Good karma Bad karma+3 votes
wilsonC Author
wilsonC

Hey that actually looks really cool and I totally agree with their philosophy. Enemies shouldn't exist as scripted obstacles, but should have their own goals and things to do instead of just waiting for the player. Kind of like how movie villains who have reasons/motives are just so much more memorable and interesting.

Reply Good karma+2 votes
Wolfofdoom3
Wolfofdoom3

Yeah and as the article says I think STALKER had something similar as well in the idea that the enemies are not just there to fight you,but they sure can be dangerous.I really agree about the villains,every time a villain has a very reasonable..umm reason.. for doing what they're doing I actually begin to root for them, not to say some villains that are "pure evil" are bad,they can be very good if executed right,but I really prefer a lot when villains are likable,though one problem I have is that villains are really hard to hate these days,if they're too evil you just don't take them seriously and if their well written you begin to like them.I don't even know what to think anymore,but yeah I'm kinda going off topic so I'm gonna stop here.Also If you ever decide to try out rain world you may notice a lot of interesting things about the ai behavior that I'm not gonna spoil, though I don't know if it's your kind of game.

Reply Good karma Bad karma+3 votes
justametalhead
justametalhead

I really like this game, but I feel like you should be focusing on the core gameplay. Especially things like lighting, that weird orange edge thing gets annoying quickly.

Reply Good karma Bad karma+1 vote
justametalhead
justametalhead

Nevermind I'm an idiot.

Reply Good karma Bad karma+1 vote
wilsonC Author
wilsonC

Haha, not sure exactly what you mean, but of course I'm focusing on the core gameplay. That's why things like lighting take a backseat for now, no point in lighting a level so early in development.

Reply Good karma+2 votes
justametalhead
justametalhead

I just read more of the articles and watched some of the videos, so I realized what I said didn't really make sense.

Game looks like it's gonna be pretty fun.

Reply Good karma Bad karma+1 vote
wilsonC Author
wilsonC

Oh I see haha. Thanks and look out for more updates soon!

Reply Good karma+2 votes
Dune_Jumper
Dune_Jumper

Looking good. I swear Half-Life 1 has better soldier AI than most AAA games nowadays.

Reply Good karma Bad karma+3 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Trepang2
Platforms
Windows
Creator
wilsonC
Contact
Send Message
Release date
Game watch
Follow
News
Browse
News
Report
Report
Share
Related Games
Trepang2
Trepang2 First Person Shooter
Related Engines
Unreal Development Kit
Unreal Development Kit Commercial
Unreal Engine 4
Unreal Engine 4 Commercial
Related Groups
Epic Games
Epic Games Developer & Publisher with 6 members
Indie Dev Exchange
Indie Dev Exchange Web & Community with 2 members
Indie Devs
Indie Devs Hobbies & Interests with 1,578 members
Indie Gamers
Indie Gamers Hobbies & Interests with 1,469 members
Unreal Engine 4 Devs, Modders and Players
Unreal Engine 4 Devs, Modders and Players Fans & Clans with 660 members