How to improve the AI in Deus Ex

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

How to improve the AI in Deus Ex

Postby Machina » Thu Jul 25, 13 7:03 am

Several mods have been made to improve the quality of Deus Ex. But what bothers me the most about Deus Ex is the bad quality of the AI during battles (and the limits of the animations that NPC's have, but that's a different story) During battles the AI just rushes straight forwards to you. There's no way for a mapbuilder to decide which NPC stays where during a battle. You can't even place a bunch of enemies behind a cover, they will run out from behind it and attack the player even if you want them to stay and defend. Furthermore if the player happens to be on a plateau and there's enemies below they will run straight under the plateau because that's nearest to the player. As a result the plateau is between the player and the enemies so they can't shoot at each other anymore. And then the enemies will just wait for the player to come down instead of running to somewhere from where they can shoot him. As a result the action in Deus Ex is very limited. I'd really like it if there was a way to improve the way the NPC's behave during a battle.

Just for hypothesis here's my ideas how the AI could be improved. It's a bit of a long post but I put a lot of thought in it and this would solve almost every issue with NPC behavior. Whether it's really possible I don't know but most of these things are already in Deus Ex and just need some modification of it.

There's already a state called "alarmed" for the NPC's. When they are in this state they search for the player. But they can also do some special things, for instance raisealarm_beforefleeing in the AI properties, which can also be set to raisealarm_beforeattacking. Now let's say there were three new navigationpoints: "combatnode" "defensepoint" and "assaultpoint" And when NPC's are alarmed they ignore the regular pathnodes and patrolpoints and only use these three new navigationpoints. This would greatly improve the behavior of NPC's during battles. The new navigationpoints are visible to the NPC when he's not alarmed so combatnodes can be placed as normal pathnodes too. That way there's no need to double place pathnodes (which would clog up the engine)

First the function of the combatnode. The combatnode needs to have a property called "combatgroup" And then there needs to be a new NPC class that also has the property "combatgroup". Assign the new NPC's to certain combatgroups and they will never use others. That way the NPC's will never leave a certain area during a battle but they run around randomly inside the area, only sticking to the combatnodes they are assigned to. Assign a NPC to a single combatnode and he will never leave that single spot. Assign a NPC to no combatnodes and he will treat all combatnodes like they are the same, even if the combatnode has a group. These "combatgroups" seem like the hardest to code since navigationgroups don't seem to be in Deus Ex at all. The rest should be easier to code since it's variations of what already exists in Deus Ex combined with this new function.

The combatnode is meant for random movement during battles. But the mapbuilder might want the NPC's to do something specific when they are alarmed. Let's say the NPC is at point A and the mapbuilder wants the NPC to run to point B and then point C when he becomes alarmed. This is what a defensepoint would be used for. It's sort of the same as the patrolpoint, except that when the NPC becomes alarmed he receives an ordertrigger to run to that point. For that reason the custom NPC has another new property under Orders called "defense/assaultpoint" to specify that point.

The defensepoint has the same properties as a normal patrolpoint, most notably Nextpatrol and pausetime. It's possible to link defensepoints together the same way as patrolpoints but instead of walking the NPC runs. Furthermore you can also use a normal ordertrigger (RunTo defensepointA) to make NPC's run around in a map without alarming them. With an ordertrigger they can only run to one spot but making them run to a defensepoint would make them run to the next one.

The assaultpoint works the same as the defensepoint with one big difference: it makes the NPC become unalarmed. With defensepoints the NPC still shoots back, so when confronted with the player they would still attack him instead of run to the defensepoint. Assaultpoints make the NPC become unalarmed even if the player is shooting at them while they are running. They completely ignore the player and any other threats. This way the mapmaker can make groups of NPC's split up and use tactics when they are attacked. NPC's would only become alarmed again once they reached a defensepoint, so the mapbuilder would always have to use a defensepoint as the last point.

Defensepoints and assaultpoints also have these properties: "combatgroup" and "nextcombatgroup" That way they can be used to switch combat groups, something that is needed to make an NPC run behind a cover and stay there. If nextcombatgroup is set to none the NPC will treat all combatnodes like they are the same again.

Here's three examples of how to use combatnodes, defensepoints and assaultpoints.

    Example 1: one NPC hiding behind cover
    To make an NPC seek cover and stay under this cover the mapmaker needs to set the custom NPC to defense/assaultpoint=defend_here. Then the mapmaker places a defensepoint somewhere and names it “defend_here” in the tag properties. Then he sets the path to the defensepoint with combatnodes. He sets the combatnodes to be “groupA” in their properties and in the NPC’s properties he sets the combatgroup to “groupA” too. However in the defensepoint he sets the nextgroup to be “groupB” while there is no group B. That way the NPC will never leave that spot and not attempt to run back to the combatnodes again. If the mapbuilder wants the NPC to ignore the player until the NPC has reached the defensepoint he should make the NPC start with an assaultpoint.

    Example 2: one or more NPC’s guarding an area
    To make one or multiple NPC’s guard an area simply use combatnodes and make them have combatgroups. Set the NPC’s to the same combatgroups. This way for instance a group of enemies will stop chasing the player once he leaves a certain area.

    Example 3: making the NPC's try to surround the player
    The player encounters a large group of NPC's. A firefight breaks out. Most of the NPC's are set to combatgroups and will stay to defend the area, they will not run towards the player. In this scenario both the player and the NPC's are hiding behind cover and shooting at each other. Some of the NPC's are set to assaultpoints so they ignore the firefight. The assaultpoints lead around the buildings and to the player's flank. If the player stays where he is he will be surrounded.


Now there's just one last little thing that's needed: a combattrigger. Usually the player has several ways to approach a group of NPC's. The combattrigger would work like this: it sends the commands for "defense/assaultpoint" and "combatgroup" to the NPC it is attached to. But the NPC will only respond to them when he becomes alarmed. The combattrigger works as "bWhileStandingByOnly" in a flagtrigger and their radius would typically be big. That way if the player encounters a scenario like in example 3 the NPC's will be able to respond with different counter attacks. Since there are usually different ways to approach enemies there should be different defensepoints or assaultpoints the NPC runs to when he is alarmed. For instance an NPC might have a long patrolpoint, so if the NPC is set to "defense/assaultpoint=assault_here" he might run away from the player while the mapmaker doesn't want that. For those reasons there needs to be a combattrigger to tell the NPC to go to a specific defense/assaultpoint and use a specific group of combatnodes when the player is in a certain location. The combattrigger should have up to eight "outevents" and "outtags" that can be set so that multiple NPC's can be attached to the same combattrigger, a bit like the dispatcher has eight outevents and outdelays. Combattriggers can also be attached to each other for even bigger groups of NPC's.

The radius of a combattrigger could be set smaller by the mapbuilder. That way NPC's react more precise to what the player is doing. If the player is hiding behind a wall they'd have a tactic for that, but if he switches to hiding behind a tree they'd have a tactic for that too. Still not exciting enough? Well, I suppose seeing the AI respond the same way gets kinda boring during replays. So let's include a "random combattrigger" This trigger is the same as the normal combattrigger except that instead of having eight outevents and outtags it only has eight "randomtags" and it can only be attached to one NPC. Once the NPC becomes alarmed he randomly picks one of the points in "randomtags" That way the NPC won't always use the same tactic and games don't become predictable. Just like the normal combattrigger randomcombattriggers can be attached to each other for bigger groups of NPC's.

Oh, and the new NPC's could really use a new property called "bCrouch" under Combat. Otherwise NPC's will attempt to crouch and fire while standing behind cover. And a property that could be added to the defensepoints and assaultpoints is "wait for" with a class and a "waitfor time" specified there. That way the NPC's would wait for a certain class to arrive before running to the next point and the NPC's will act more like a team. Since the mapbuilder doesn't want the NPC's to wait forever for dead NPC's there should be a waiting time which is the maximum time the NPC will wait before running to the next point. Add options to fill in up to eight class types to wait for and the mapbuilder can set up teams by creating separate classes for all the team members and make them spread out through a city and meet up again before spreading out again. Set the class type to the player's class to make them wait for the player.

Taa-daah! Now the NPC's can do almost everything the mapbuilder wants during a battle. So who's gonna code this and release it as a new mod?
Last edited by Machina on Thu Jul 25, 13 11:51 am, edited 13 times in total.
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Postby Machina » Thu Jul 25, 13 8:11 am

I think the biggest problem with this is that the enemy NPC's would still run towards the player when they see him and leave the combatgroups they are assigned to. If a map has no pathnodes NPC's still try to run to the player when they see him, they just have problems following him around corners. So there needs to be a way to force the NPC's to really stick to their groups and not try to find their own way beyond them. Like I already said this would be the hardest to code. I'm guessing the new custom NPC would need some new code that makes him not try to find his own way when there are no pathnodes.

Perhaps there's another way to do some of these things. Feel free to post ideas or (hypothetical) solutions. This thread is kind of meant for fun, although I'd love it if someone could actually make this.

Some more ideas:

Add a combatconversationtrigger that triggers conversations during battles. Normally NPC's can't talk while they are fighting, it's to avoid conversations continuing when they spot the player. However it can be cool to have an NPC say something specific during a battle. The conversation is set in conedit and the player would typically remain in first person during the conversation. The combatconversationtrigger triggers the conversation like a normal conversationtrigger, except that the message is placed on the screen without the NPC actually saying it so he won't turn around to face the player and instead keep doing what he's doing. Fun fact: this could already be faked by placing an invisible NPC somewhere and making him say whatever needs to be said by the NPC who's fighting. I haven't tried it but I'm pretty sure it would work, except that if you also had voice actors the player would probably hear the voice coming from somewhere else. So a combatconversationtrigger would still be very useful.

Add a "play conversation" in the defensepoints and assaultpoints properties, somewhere near their waitfor classes and waitfor times. When all the NPC's have gathered at the defensepoint a conversation is triggered before they move on. Since a conversation can only be bound to one person the NPC's should move on automatically if the conversation can not be played (in case the NPC carrying the conversation is dead or doesn't make it in time)
Last edited by Machina on Thu Jul 25, 13 11:55 am, edited 2 times in total.
"No I don't smoke meth. This is just a natural talent I have."
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Re: How to improve the AI in Deus Ex

Postby CyberP » Mon Aug 18, 14 12:11 am

"You can't even place a bunch of enemies behind a cover, they will run out from behind it and attack the player even if you want them to stay and defend."

False ;)
CyberP
Newbie
 
Posts: 43
Joined: Sat Dec 08, 12 3:31 am

Re: How to improve the AI in Deus Ex

Postby Machina » Mon Sep 22, 14 12:00 pm

CyberP wrote:"You can't even place a bunch of enemies behind a cover, they will run out from behind it and attack the player even if you want them to stay and defend."

False ;)


How so? It's one thing that this thread had zero replies but to reply with one word and no arguments is just being a dickhead.

So how do you make the AI cover behind a wall in vanilla dx?
"No I don't smoke meth. This is just a natural talent I have."
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Re: How to improve the AI in Deus Ex

Postby han » Mon Sep 22, 14 7:00 pm

Has anyone checked this bCanStrafe / StrafeFacing() stuff? Are there animations needed which are not in DeusEx? I guess this is one of the things which make the AI seem stupid compared to Unreal. Before adding more special pathnods i would suggest to try to make use of the AI stuff that unreal has used. Also maybe this Intelligence setting is more then just for uc checks but maybe even used in pathfinding c++ code.
han
Newbie
 
Posts: 15
Joined: Thu Nov 29, 12 10:47 pm

Re: How to improve the AI in Deus Ex

Postby Machina » Tue Sep 23, 14 11:28 am

han wrote:Has anyone checked this bCanStrafe / StrafeFacing() stuff? Are there animations needed which are not in DeusEx? I guess this is one of the things which make the AI seem stupid compared to Unreal. Before adding more special pathnods i would suggest to try to make use of the AI stuff that unreal has used. Also maybe this Intelligence setting is more then just for uc checks but maybe even used in pathfinding c++ code.


bCanStrafe is simply disabling the NPC to strafe. Normally the AI can go circles around you and keep facing you and shooting you(1). Without bStrafe they'd have to first run somewhere and then face you before they open fire. I think I've never tried it but that's what it would do.

I don't know C+ coding that's why I just posted it. It's just an idea, not necessarily a request. Although if such a mod would exist I'd probably use it of course.

I heard there's a DX multiplayer mod that really does improve the AI beyond the standard settings. But unfortunately I can't come up with the name right now because I very very rarely play MP. I heard this mod has an NPC which can perform several 'non-dx' tasks which include being able to stand still while sniping. Perhaps that's what CyberP was hinting at.

(1) actually the NPC's never do this, they typically just strafe left and right a little as they run towards you. But in theory they could circle around you like cowboys and indians in western movies.
"No I don't smoke meth. This is just a natural talent I have."
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Re: How to improve the AI in Deus Ex

Postby Machina » Tue Sep 23, 14 11:40 am

Machina wrote:(1) actually the NPC's never do this, they typically just strafe left and right a little as they run towards you. But in theory they could circle around you like cowboys and indians in western movies.


:shock: Let's include an endboss which during battle occasionally triples himself (so there's suddenly three endbosses) and starts running around the player while shooting at him. And then only the original endboss can be hurt, not his clones.

Well hey it's just an idea...
"No I don't smoke meth. This is just a natural talent I have."
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Re: How to improve the AI in Deus Ex

Postby Allan » Tue Sep 23, 14 4:08 pm

Machina wrote:
Machina wrote:(1) actually the NPC's never do this, they typically just strafe left and right a little as they run towards you. But in theory they could circle around you like cowboys and indians in western movies.


:shock: Let's include an endboss which during battle occasionally triples himself (so there's suddenly three endbosses) and starts running around the player while shooting at him. And then only the original endboss can be hurt, not his clones.

Well hey it's just an idea...

This actually reminds me of the end-game boss of one of the games I played a lot as a child:
https://www.youtube.com/watch?v=Cae9E41L8Mk

Whilst his clones were /kinda/ obvious if you took notice, he is still fun to play around with. ...until you get 8 bombs stuck on your head and 1/3 of your life bar goes flying out the window. :\
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Re: How to improve the AI in Deus Ex

Postby han » Wed Sep 24, 14 8:27 pm

Just stumbled about sth. which might be worth to check out. Fire up Engine\Src\UnPath.h:
Code: Select all
#define MAXCOMMONRADIUS 115 //max radius to consider in building paths
#define MAXCOMMONHEIGHT 79
#define MINCOMMONHEIGHT 10 //min typical height for non-human intelligent creatures
#define MINCOMMONRADIUS 12 //min typical radius for non-human intelligent creatures

#define COMMONRADIUS    52 //max typical radius of intelligent creatures
#define HUMANRADIUS     22 //normal player pawn radius
#define HUMANHEIGHT     51 //normal playerpawn height

And pawns just use Intelligence < BRAINS_HUMAN
So paths should *really* improve with settings Intelligence=BRAINS_HUMAN for scripted pawns.
han
Newbie
 
Posts: 15
Joined: Thu Nov 29, 12 10:47 pm

Re: How to improve the AI in Deus Ex

Postby CyberP » Sun Nov 30, 14 6:00 pm

Machina wrote:How so? It's one thing that this thread had zero replies but to reply with one word and no arguments is just being a dickhead.

So how do you make the AI cover behind a wall in vanilla dx?


HomeBase = x
HomeExtent = 16.000000
bDefendHomeBase = True

Very simple. No coding necessary. Of course, this doesn't come with animations and such, but with bCanCrouch= True and bCanStrafe=False they take cover reasonably well.

You can see this in action here: http://www.moddb.com/mods/gmdx/videos/d ... l#imagebox

Watch the UNATCO troops @00:42
CyberP
Newbie
 
Posts: 43
Joined: Sat Dec 08, 12 3:31 am

Re: How to improve the AI in Deus Ex

Postby CyberP » Sun Nov 30, 14 6:03 pm

I have done a lot for AI: http://genericname112.wix.com/gmdx#!art ... gence/c8ao

However, I am looking to do more. And I'm hoping there are some programmers, animators and such that can help with this.
CyberP
Newbie
 
Posts: 43
Joined: Sat Dec 08, 12 3:31 am

Re: How to improve the AI in Deus Ex

Postby Machina » Mon Dec 01, 14 10:59 am

CyberP wrote:
Machina wrote:How so? It's one thing that this thread had zero replies but to reply with one word and no arguments is just being a dickhead.

So how do you make the AI cover behind a wall in vanilla dx?


HomeBase = x
HomeExtent = 16.000000
bDefendHomeBase = True

Very simple. No coding necessary. Of course, this doesn't come with animations and such, but with bCanCrouch= True and bCanStrafe=False they take cover reasonably well.

You can see this in action here: http://www.moddb.com/mods/gmdx/videos/d ... l#imagebox

Watch the UNATCO troops @00:42


Thanks for the tip! I didn't try it out yet but judging from your video it looks like it works (I've tried a similar tactic in my early days as a mapper and set their movement speed to zero but that didn't get rid of the animations, your tactic is way better)
"No I don't smoke meth. This is just a natural talent I have."
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Re: How to improve the AI in Deus Ex

Postby han » Thu Jan 29, 15 12:59 am

Just another thing popped up which would be great for AI:
Exposing URenderBase::GlobalLightning() to unrealscript, which is trivial. However that function can be used to get the brightness of an actor with light effect applied. So this would be pretty much useful for deciding how visible an actor is. However it doesn't account for dynamic lights i guess.. but can be useful nevertheless, and its at least better then just checking ambientbrightness and stuff.

As for some realistic lightingning, though probably expensive one might try to abuse GLightManager out of Render package:
Code: Select all
class RENDER_API FLightManagerBase
{
public:
   virtual void Init()=0;
   virtual void Exit()=0;
   virtual DWORD SetupForActor( FSceneNode* Frame, AActor* Actor, struct FVolActorLink* LeafLights, FActorLink* Volumetrics )=0;
   virtual void SetupForSurf( FSceneNode* Frame, FCoords& FacetCoords, FBspDrawList* Draw, FTextureInfo*& LightMap, FTextureInfo*& FogMap, UBOOL Merged )=0;
   virtual void FinishSurf()=0;
   virtual void FinishActor()=0;
   virtual FPlane Light( FTransSample& Point, DWORD ExtraFlags )=0;
   virtual FPlane Fog( FTransSample& Point, DWORD ExtraFlags )=0;
};
RENDER_API extern FLightManagerBase* GLightManager;

But i guess that might not be that easy, as you would probably need to set everything up before calculating it's lightning. Which would be fucking expensive, but maybe with just a the next few actors which emit light..
Another kludge might be using a render interator and try to get some use out of that, as when dealing with it at least some part of the lightning are set up.

/edit:
DXThievery has uc code calculation the visibility.
han
Newbie
 
Posts: 15
Joined: Thu Nov 29, 12 10:47 pm

Re: How to improve the AI in Deus Ex

Postby han » Fri Jan 30, 15 5:24 pm

Another thing which just came to my mind.. as it's rather settled that i'll rewrite AI from scratch for for revision framework, to actually seperate the "AI" from everything else, like animation handling... or conversation quirks.

Basically i thought of having a bare skeleton ScriptedPawn class which just handles animation and conversation or other low level shit. and having the descission part seperated in the RevisionArtificialIntelligence actor.

So bascially there should a variable like
Code: Select all
var class<RevisionArtificialIntelligence> ArtificialIntelligenceClass;
which would get spawned and hooked at *BeginPlay() phase. The benefit is to have the AI seperated and not mixed in with other stuff, and the really big deal is that you could just change that variable by mutator or gameinfo to make all scriptedpawns use a custom AI you made up. I guess this would enable real improvement and diversity on AI and you get right to the stuff and not worry about all the other shitty stuff in old ScriptedPawn.
han
Newbie
 
Posts: 15
Joined: Thu Nov 29, 12 10:47 pm

Re: How to improve the AI in Deus Ex

Postby Machina » Sat Feb 07, 15 12:12 am

han wrote:Just another thing popped up which would be great for AI:
Exposing URenderBase::GlobalLightning() to unrealscript, which is trivial. However that function can be used to get the brightness of an actor with light effect applied. So this would be pretty much useful for deciding how visible an actor is. However it doesn't account for dynamic lights i guess.. but can be useful nevertheless, and its at least better then just checking ambientbrightness and stuff.

As for some realistic lightingning, though probably expensive one might try to abuse GLightManager out of Render package:
Code: Select all
class RENDER_API FLightManagerBase
{
public:
   virtual void Init()=0;
   virtual void Exit()=0;
   virtual DWORD SetupForActor( FSceneNode* Frame, AActor* Actor, struct FVolActorLink* LeafLights, FActorLink* Volumetrics )=0;
   virtual void SetupForSurf( FSceneNode* Frame, FCoords& FacetCoords, FBspDrawList* Draw, FTextureInfo*& LightMap, FTextureInfo*& FogMap, UBOOL Merged )=0;
   virtual void FinishSurf()=0;
   virtual void FinishActor()=0;
   virtual FPlane Light( FTransSample& Point, DWORD ExtraFlags )=0;
   virtual FPlane Fog( FTransSample& Point, DWORD ExtraFlags )=0;
};
RENDER_API extern FLightManagerBase* GLightManager;

But i guess that might not be that easy, as you would probably need to set everything up before calculating it's lightning. Which would be fucking expensive, but maybe with just a the next few actors which emit light..
Another kludge might be using a render interator and try to get some use out of that, as when dealing with it at least some part of the lightning are set up.

/edit:
DXThievery has uc code calculation the visibility.


Properties - Display - ScaleGlow sets decoration or NPC's brighter or darker.
"No I don't smoke meth. This is just a natural talent I have."
Machina
Newbie
 
Posts: 54
Joined: Sun Feb 14, 10 1:49 am

Re: How to improve the AI in Deus Ex

Postby han » Mon Feb 09, 15 5:56 pm

Machina wrote:ScaleGlow sets decoration or NPC's brighter or darker.

ScaleGlow property is just a minor bit how bright or dark an Actor is rendered.
han
Newbie
 
Posts: 15
Joined: Thu Nov 29, 12 10:47 pm


Return to Editing issues

Who is online

Users browsing this forum: Google [Bot] and 19 guests
cron