Jump to content

AI Improvements


Recommended Posts

Posted

Hi, here are some changes that I've made to AI:

  • AI with weaker weapons will sometimes pick up nearby weapons from the ground or racks which are stronger (example: Imperial Worker picks up dropped flechette, or Stormtrooper picks up repeater from nearby gun rack...)

Sniper AI improvements

  • Any enemy which picks up a Tenloss will now properly act as a Sniper AI type and use the alt fire mode correctly
  • Sniper AIs will almost always pick up close-ranged weapons (assuming the player is close) if it's an option
  • Fixed an issue where sometimes snipers wouldn't switch into primary fire correctly
  • When the AI's enemy moves into the threshold to use Primary fire, they will stop charging their weapon (aka, will fire immediately). This makes the Sniper AI act much more aggressive at close range.
  • Sniper AIs will switch sniping posts every 3-4 shots (if possible)
  • When the player gets too close to a sniper AI, they will run away from the player while firing their primary (unless no Flee point_combat is found, in which case they will run with their backs turned)
  • Sniper AI no longer stays ducked constantly, they only duck at point_combats which are designated to do so (should make it MUCH easier to hit them at long range)
  • Sniper AIs will announce when they're changing positions or are fleeing from the player using vocal cues (but not always)

some more changes will come

Posted

I know that seeking cover and such would probably require waypoints, but is there any way to have the AIs "regroup" or "dodge" or any sort of evasion that doesn't evolve standing out in the open?

Posted

I am not much of a coder, by some aspects of the game do allow to make the AI be more complex. For instance, scripts allowed me to make the enemy attack me, if I took away his weapon by Force. It's a bit tricky, but a way bette, than seeing an NPC running from you until he picks a new weapon somewhere. Also in some cases scripts allow them to use the nearby turrets or speeders. Though NPCs are still very unpredictable...

 

As for regrouping, I might be mistaken, but there are several commands in the scripts, which allow the NPC be part of a group. I am not sure about the meaning of this command, but it might be close.

Asgarath83 likes this
Posted

Some AI Improvements that I would like to see are: (1) better squad tactics, (2) Seek and shoot from cover (rather than stand out in the open)

 

Define "better" more precisely. What specifically would you want to see Stormtroopers do that they don't do already?

Cover requires new waypoints.

I know that seeking cover and such would probably require waypoints, but is there any way to have the AIs "regroup" or "dodge" or any sort of evasion that doesn't evolve standing out in the open?

They're actually pretty agile as it is. JK2 NPCs are way different from JKA, mind you. The only thing I can think of atm that I need to change is to make them recognize when the player is circle strafing around them, or when the player is rushing them with a saber. For NPCs with a higher evasion level (such as Imperial Workers and rodians) I was also thinking about making them roll out of the way when a saber throw gets executed.

I am not much of a coder, by some aspects of the game do allow to make the AI be more complex. For instance, scripts allowed me to make the enemy attack me, if I took away his weapon by Force. It's a bit tricky, but a way bette, than seeing an NPC running from you until he picks a new weapon somewhere. Also in some cases scripts allow them to use the nearby turrets or speeders. Though NPCs are still very unpredictable...

 

As for regrouping, I might be mistaken, but there are several commands in the scripts, which allow the NPC be part of a group. I am not sure about the meaning of this command, but it might be close.

Yes, something like that might be possible. I'd say it'd have to depend on their aggression level. Imperial Workers and Imperials might only try and run away, but Stormtroopers might punch you, for instance.

NPCs do have regrouping, they just don't use it very often, and the behavior is specific to Stormtroopers.

 

I was thinking of other ways the NPCs could be more dangerous, such as sniper rodians and gran pulling out sidearms when the player gets close and then attempting to flee a little bit while firing. Also, I was thinking of making NPCs switch to alt fire mode when it's appropriate.

Posted

Better Squad tactics: Did you ever play Rebellion's Sniper Elite or Sniper Elite V2? The AI was really, really good... the AI squads would use real military tactics-- some would hold your attention directly in front of you (they'd seek cover when you shoot at them-- run crouched down minimizing their bounding box, crawl, lay prone, etc. And when they found cover that would shoot back at you: either prone, crouched behind rubble, or standing behind broken walls... then-- they'd try and hold your attention while other members of the squad would stealthily move to flank you. Some would throw grenades from cover. They would provide cover fire while their team moved to flank you. And the AI snipers were really tough... moving positions after taking a shot.

Asgarath83 likes this
Posted

That would definitely be cool. Most, if not all modern games have great AI like that. It would probably require a lot of work to do though.

Posted

Most of the stuff you mention requires new point_combats to be placed, but I definitely don't have any issues in implementing some of the stuff you mention. I need to see about getting some map source first.

Asgarath83 likes this
Posted

Uniqueone's stuff was pretty cool in JKG, if a bit messy and inperfect, still cool.

also ported from another mod on another game, and questionable whether he actually coded it

also has all kinds of badness including using fopen/fread/fclose directly in the VMs, which is all kinds of fucked up

also had no prediction whatsoever

also was rather sloppily integrated into the code and made everything a mess

...

 

In short, I feel as though slightly tweaking the original AI is probably better. The maps just need more nodes and they'll be fine, tbh.

Maksman likes this
Posted

In short, I feel as though slightly tweaking the original AI is probably better. The maps just need more nodes and they'll be fine, tbh.

Yes, but an example of how cool npc behavior, at least from a black box perspective, could work.  As far as actual internal design goes, yeah I'm with you.

JKG Developer

Posted

Yes, but an example of how cool npc behavior, at least from a black box perspective, could work.  As far as actual internal design goes, yeah I'm with you.

?

Black box perspective? The AI didn't even have stealth or detection behavior. All it did was use cover and choke points in the map. It was quite simplistic tbh, not sure why everyone was freaking out like it was the neatest thing since sliced bread, it was really awful in several aspects.

Maksman likes this
Posted

?

Black box perspective? The AI didn't even have stealth or detection behavior. All it did was use cover and choke points in the map. It was quite simplistic tbh, not sure why everyone was freaking out like it was the neatest thing since sliced bread, it was really awful in several aspects.

Probably because it was such a big improvement over the default ai and were actually kind of hard to kill.

 

But I'm sure you'll blow us away with more awesomeness that we won't even remember ye olden days of uniqueone ai.

JKG Developer

Posted

The first part of that ai was really good on til uni fucked it up. It was unfinished work I had to get working
To even make it playable over all it became a shitty ai in the end. So ofc eez can pull something better out of the default
Code and make something more awesome:-)

  • 4 weeks later...
Posted

Any chance JK2 AI strengths could be ported to JA? I always felt NPCs were more static in JA, whereas in JK2 they were more in motion and didn't sit still so much.

Maksman likes this
Posted

Biggest problem is the maps. They're much more waypointed in depth than in JA. It wouldn't really be possible, I think, without changing the maps.

Maksman likes this
  • 2 months later...
Posted

A few suggestions that I had wanted to implement in my mod, any thoughts?:

 

  • Saberists being knocked down by jumping on them, maybe they should be more resistant/immune to this

  • Reborn masters shouldn’t be able to throw their saber multiple times without cooldown while using 2-handed force lightning

  • Saberists too willy-nilly about throwing their saber

- Have them only throw if a certain distance away?

- Go into evasion mode if saber throw knocked to ground (AI for evading is already used when you try to use a special attack on them that can’t be blocked)

- OR have NPCs cheat and always pick their saber super fast?

  • Tweak considerations (for altered saber combat mechanics in my mod)

- NPCs go into evasion mode when their stagger counter is high?

- Walk just before an anticipated block to do parries? (if changed so parries can only be done while walking)

  • Jedi shouldn't attack surrendered enemies I think
Posted

Too bad most NPCs do nothing, but only attack you, standing sometimes in front of you, not trying to hide somewhere. This does rarely happen, if point_combat are placed at wise places, but the Plater can find NPCs there and they won't run away. Scripting makes their behaviour a bit more diverse.

Asgarath83 and Maksman like this
  • 2 months later...
Posted

I have also a suggest: only with scripting is possible for NPCfor use altfire. i ask that NPC with higher rank can use Altfire of his weapons and switch hit to main fire in random mode. that can be done by ltjg for 10% altfire shoot

lt 20% ltcomm 30% commander 40% and captain 50% of altfiring. :)

that's allow to NPC with shooting gun to be really more dangeorus :)

 

so, if player encounter >Lt  NPC ranked they can use some harsh attack against you. a captain NPC with a concussion is really deadly becase can shot the explsive primary shot or the alt fire burst ray at 50% of possibility. a rocketrooper can alternate fast forward rocket to seeker rocket, like bobafett, AI, a trooper with repeater can shoot the explosive bolt attack. a tropp with flechette the explosive alt fire flechette atk and so Away.

the way for making that is the same of the Sniper code, but applied to all weapons based on rank of NPC. 

it's possible to make also that? maybe in future?

 

@@eezstreet

Posted (edited)

^Interesting idea. I think the only NPC in either game that actually actively and strategically will use both modes of a weapon is Boba fett. Whereas the alt-fire map script forces an NPC to use only alt-fire, perhaps the altFire field in .npc files could allow them to use alt fire mode as they see fit like you're saying? Just an idea.

 

Some suggestions I have:

 

1. Better multiple weapon support for NPCs -

- giving NPCs multiple weapons has very little use currently

- have them start with the first weapon in the file equipped, or the "highest" weapon (some weapons are considered "better" by the game aren't they?)

- they then switch to the next weapon when they are disarmed by Force Pull or in certain special situations (like has a sniper rifle, switches to E11/sword when you're close)

- have Melee/Lightsaber/Sword be the "lowest" weapon only because at that point they can't be disarmed

 

2. Better Melee AI

- enemies with Melee just rush at you in a straight B-line, seems a bit unsmart considering you have a lightsaber and many other weapons...

- perhaps they would only try to punch you if you're already somewhat close to them? Or else they just run away? Perhaps this could depend on certain factors like whether they had a weapon and were disarmed, their aggression, etc.

 

3.Better Surrender AI

- more of an issue in JA than JK2

- guys that do decide to surrender should stay surrendered until the player is out of sight/far away instead of running around in front of you trying to grab weapons and then getting scared and stopping, that way they seem more sneaky and more intelligent

- maybe surrender AI could check for: intelligence vs. aggression - how likely the NPC is to surrender, or just keep trying to attack you (with melee if they have it, or by running to gun racks/picking up nearby weapons), how many weapons nearby - if none or weapons are very far away more likely to surrender

Edited by dusty22
Posted

i agree with your idea, dusty. i think and NPC with Weapon melee, not rancor, wampa, interrogator or howler or droid class, can be so smart to find some weapon to shoot you if yoiu have a lightsaber , they EVER make this. if you use a shooting weapons, attacking only if you are close.

 

switching weapons and use alt fire like Bobafett AI is a wonderful idea! i fully agree!! :D

  • 8 months later...
Posted

Any chance of a squad system being implemented for NPCs in the vein of Half-Life's? I.E. If a stormtrooper sees you he'll call his buddies over, higher-ranking stormtroopers and mercs can tell their squads to cover them or flank the player, etc.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...