Home » PLAYER'S HQ 1.13 » v1.13 General Gameplay Talk » Enemies Moronic Ai iQ, why?
Enemies Moronic Ai iQ, why?[message #311463] Tue, 23 October 2012 22:54 Go to next message
eugene20072008 is currently offline eugene20072008
Messages:4
Registered:May 2008
Latest patch 1.13 4870 + bugfix 4870
Enemies are so stupid...
What did I do wrong?
http://www.youtube.com/watch?v=z9y3oKiGx9Y[/video]

Report message to a moderator

Civilian
Re: Enemies Moronic Ai iQ, why?[message #311465] Tue, 23 October 2012 23:12 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
With NCTH they always have that problem with low-range guns on an open field. Basically, the AI is reluctant to move forward, because of your massed mercs. At the same time, they won't fire, because the CTH tells them they are too unlikely too hit.

Report message to a moderator

Captain

Re: Enemies Moronic Ai iQ, why?[message #311470] Wed, 24 October 2012 03:46 Go to previous messageGo to next message
eugene20072008 is currently offline eugene20072008
Messages:4
Registered:May 2008
but what should I do?
I am not enjoying this, I want them to shoot at me.
There is no resistance at all :/

Report message to a moderator

Civilian
Re: Enemies Moronic Ai iQ, why?[message #311474] Wed, 24 October 2012 10:20 Go to previous messageGo to next message
lockie is currently offline lockie

 
Messages:3721
Registered:February 2006
Location: Scotland
Toss a grenade at em and move on ! And await the counterattack on Drassen .......

Report message to a moderator

Captain

Re: Enemies Moronic Ai iQ, why?[message #311475] Wed, 24 October 2012 14:37 Go to previous messageGo to next message
Sam Hotte

 
Messages:1966
Registered:March 2009
Location: Middle of Germany
Eugene
but what should I do?
I am not enjoying this, I want them to shoot at me.

Disable NCTH; switch back to OCTH.
Doesn't make AI genius, but they get better CTH with their pistols so that they do shoot back eventually. Smile

Report message to a moderator

Sergeant Major
Re: Enemies Moronic Ai iQ, why?[message #311476] Wed, 24 October 2012 16:05 Go to previous messageGo to next message
Slax is currently offline Slax

 
Messages:1411
Registered:July 2006
Location: People riding polar bears...
You could try replacing your CTHConstants.ini (Data-1.13 folder) with this one. Makes NCTH behave more like OCTH. Somewhat. Wink

Report message to a moderator

Sergeant Major
Re: Enemies Moronic Ai iQ, why?[message #311481] Wed, 24 October 2012 20:45 Go to previous messageGo to next message
eugene20072008 is currently offline eugene20072008
Messages:4
Registered:May 2008
Thanks, I've tried this .ini, did not help, Enemies are still very dumb

Report message to a moderator

Civilian
Re: Enemies Moronic Ai iQ, why?[message #311482] Wed, 24 October 2012 21:22 Go to previous messageGo to next message
Headhunter is currently offline Headhunter

 
Messages:264
Registered:November 2009
Location: Sweden
Yeah, they've always been dumb. All the AI has going for it is numbers.

Report message to a moderator

Master Sergeant
Re: Enemies Moronic Ai iQ, why?[message #311502] Thu, 25 October 2012 19:19 Go to previous messageGo to next message
eugene20072008 is currently offline eugene20072008
Messages:4
Registered:May 2008
There were not that dumb in original version.

Report message to a moderator

Civilian
Re: Enemies Moronic Ai iQ, why?[message #311505] Thu, 25 October 2012 19:57 Go to previous messageGo to next message
Sam Hotte

 
Messages:1966
Registered:March 2009
Location: Middle of Germany
Again: deactivate NCTH, if you want old behaviour back.

If you knew someone willing and able to code new, better AI - (s)he would be very welcome here ... Smile

[Updated on: Thu, 25 October 2012 19:57] by Moderator

Report message to a moderator

Sergeant Major
Re: Enemies Moronic Ai iQ, why?[message #311664] Wed, 31 October 2012 20:51 Go to previous messageGo to next message
bdict is currently offline bdict

 
Messages:5
Registered:October 2012
Go into INI and turn off the new AI setting, if u search "light" u will find it. It is responsible as far as i can tell for the dumb behavoir of short range weapons making enemies act strange.

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312258] Mon, 19 November 2012 19:25 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
I also found my experiences to be similar with the OP. I tested several times on 2085, and this behaviour didn't happen. It seems like some kind of AI decision making code is causing weird the weird behaviour of running out and back into cover turn after turn, and I think there's some sort of code that causes the enemy to evaluate the situation (being out of range, seeing many enemies), that makes him run back to cover, where he starts the loop again and runs out, then back etc.

This happens regardless of NCTH and new tac AI, and theory is that the new decision making code was added in with the HAM 2.8 merge. So, someone who knows the code could maybe take a look at tactical_ai.cpp and perhaps disable this behaviour?

I'll take a stab at it myself, but I'm no coder unfortunately.

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312371] Fri, 23 November 2012 19:53 Go to previous messageGo to next message
Mercury-FMJ is currently offline Mercury-FMJ

 
Messages:18
Registered:November 2012
Yes these decision making behaviors really have to go. I think they should all be programmed to pretty much just run within range and shoot. That would stop them from running around in circles at the back of the map and would immediately greatly enhance the difficulty, but would also make the game easier in the very few situations where the AI programming works in their favor. To supplement this, I think a bunch of enemies that never move (like the guy who hides behind the door in the police station at chitzena mine) should be hand-placed in strategic positions - crouching in buildings at windows/behind low walls with a large view, lying behind rocks, etc., and these static enemies could possibly be covered by other enemies in their immediate area that only start moving and join the fight when you get within a certain distance of their position.

Well that's what I dream about anyway Smile

[Updated on: Fri, 23 November 2012 19:54] by Moderator

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312460] Sun, 25 November 2012 19:25 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
Good to see there's interest in this, question is, what can we do about it?
How can we help the devs fix this, as I believe this should be priority number 1? Is further "proof" and evidence required?

I agree with you - for now, let's just make then run and gun at you, and worry about smart decision making later, when we can catch a real AI expert from somewhere.

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312478] Mon, 26 November 2012 01:42 Go to previous messageGo to next message
Flugente

 
Messages:3509
Registered:April 2009
Location: Germany
The behaviour of the AI do seek cover if on open field, or in sight of too many mercs, was introduced because having them rushing at the enemy is equally stupid. We are currently at an impasse. Any 'simple solution' to repair one AI deficiency will simply damage it otherwise imho. Especially as coding new AI routines is far from easy (and testing is very timeconsuming, as one can easily cause the AI to loop or perform other nefarious stuff.

So you have to wait for a certain someone to finish a certain project that is aimed at modularising the AI. Once that is done, altering the AI will propably be much easier.

Report message to a moderator

Captain

Re: Enemies Moronic Ai iQ, why?[message #312489] Mon, 26 November 2012 07:41 Go to previous messageGo to next message
Uriens is currently offline Uriens

 
Messages:346
Registered:July 2006
I don't think that OP's example shows AI's problem at all. AI can't do much in that example unless you would consider running at 5 bunched up mercs with a pistol and hoping you live for the next turn so you can shoot as a good idea.

The problem show is actually two fold:

- First its enemy gun choices where whole Deidranna's army starts with only pistols. Pistols in JA2 have very short range and you can throw knives as far as they can shoot. Heck it's probably easier to rush in and go melee then to shoot with starting pistols and hope you won't miss. The whole idea of an army armed with only pistols is silly in fact and I believe it's only there so it would be as close to the original JA2 gun progression as possible. This is why there are mods and modding tools to fix it. I would suggest for OP to try AIMNAS or UC mods where such problem does not exist and I guarantee him he will not see such behavior from AI.

- Second is the NCTH system itself. In his example you can see why I don't use it myself. You can actually shoot at max range and still hit the enemy often enough to make it a viable tactic. AI doesn't know that. It seems to act like it's old CTH system and believes he has almost 0% CTH from that distance and thus would just waste ammo firing. Personally, I like what NCTH tries to do but I believe it still needs a lot of work for it to be a viable replacement of the old system. Being able to hit target from that distance so often as OP did in his example and nearly useless snipers at long range make some of the reasons why I stopped using NCTH for the time being. AIMNAS, for example, does not support NCTH at all so, if OP wants to get more from AI, I'd suggest installing AIMNAS and not using NCTH (it can be turned off when starting a new game).

Actually my suggestion for OP would be install AIMNAS (links for version compatible with the official stable 1.13 release should still be in the forums somewhere) and turn off NCTH.
After that I'd suggest also trying UC mod where there are lots of changes and new maps making it a completely different experience.

Report message to a moderator

Master Sergeant
Re: Enemies Moronic Ai iQ, why?[message #312524] Tue, 27 November 2012 00:16 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
Flugente, the problem is that only a part of the enemy force are engaged with you currently, even if all of them are aware of you. Those "close enough" to start engaging, do so, but those who are currently too far and intimidated by you fiddle around in cover while their mates die. I'm of the belief that for this reason, running and gunning worked better for the AI in the earlier versions.

If all of the enemy behaved the same way, staying back in cover, it'd be different. Another problem, however, is that the enemy don't just stay in cover - they walk back and forth from and to cover, thus triggering multiple reactions and getting shot anyway.

So, in either case the current behaviour fails in comparison to running and gunning, and that is easily seen by playing pre-HAM and after HAM (I think it's the 100 AP system that brought all this along)

NCTH is a non-issue in my case at least, as I play with it off.

But, sounds like there is hope at the end of the tunnel - maybe I'll just have to hold off on my return to Arulco until the certain someone (Warmsteel?) is able to do his magic.

There's plenty of games in the backlog anyway, and I've just started old UFO as a "replacement".

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312616] Thu, 29 November 2012 15:15 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
While i know almost nothing about ja2 modding, and i have only some familiarity with c++ programming, i have worked a bit on ai projects, and i find them interesting.
I also want to learn c++, so maybe i can do something to help..

only thing i want is pointers on how to get started...
eg. where to find the latest 1.13 source code, any documented knowledge on current ai, ideas on how to improve the ai... I'm thinking of completely changing the way ai works, writing it from scratch.

Since i have mostly worked with python, and much less with c, c#, this will take much time, but in this period, it will give me something to do. At the least i can promise to try..

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312618] Thu, 29 November 2012 15:25 Go to previous messageGo to next message
DepressivesBrot is currently offline DepressivesBrot

 
Messages:3658
Registered:July 2009
Source: https://ja2svn.dyndns.org/source/ja2/trunk/GameSource/ja2_v1.13/Build/
GameDir: https://ja2svn.dyndns.org/source/ja2_v1.13_data/GameDir/
(both SVN repositories)
Once you've opened the Solution in VS, there's a project aptly named TacticalAI, with DecideAction being the most critical file.

Report message to a moderator

Captain

Re: Enemies Moronic Ai iQ, why?[message #312620] Thu, 29 November 2012 15:38 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
ok, thank you..

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312628] Thu, 29 November 2012 18:43 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
And the change in AI behaviour occurred after official release 2085 (which still had the aggressive behaviour from vanilla).

Thanks for having a go at it! Do you need more videos or explanation about the behaviour in different versions?

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312667] Sat, 01 December 2012 13:54 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
for the time being i'm trying to figure out how the original 1.13 code works...
the DecideAction file on its own is 8000 lines of code, and i am naturally lazy Smile

still, everything i know might be of use... and i prefer explanations than videos (unless the videos explain better the situation)

I am aware that the ai used to run at you en masse (dieing on the way, but some would get through), and now they just stand and run in circles if they cannot see you, more frequently than before.. so no need to explain that.

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312669] Sat, 01 December 2012 15:11 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
It's not just about not seeing you, it's in fact seeing you massed together that scares some enemies into running in circles, especially so if they're so far out of range that the code calculates it doesn't have a good shot.

So basically it's something like:

"Do I have LOS at enemy? If no, try to get into LOS"
"Do i have a good enough shot from where I am?"
If yes, shoot.
If not, decide between getting into the best available cover or into range for a shot.
And in that decision, number of enemies seen is a factor, so actually them seeing you causes them to run in circles! I'm sure there's other factors in there, too.

When they're back in cover, the loop starts again. As a result, the enemy shuffles from cover to your LOS (triggering reactions) and is totally ineffective at either helping their mates or staying in cover themeselves!

Whatever the preference for enemies to stay in cover would be, I think the highest priority would be to help their mates, so they can do at least some teamwork.

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312671] Sat, 01 December 2012 15:46 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
i think that at first (after understanding, at least superficially what the ai does) i have to understand what the ai knows, and how it uses that knowledge (there is a separate file handling the ai knowledge).
Maybe i can expand that a bit, in order to add short term memory if it is not in already.
After that, a new (or modified) decision making system is in order.

I actually dislike -if- trees.
I much prefer to make a tree with all possible actions (or a simplified one, if that's too big), and then evaluate those found action-sequences, maybe with a fuzzy logic system where the action-sequence with the highest rating prevails, thus choosing a "best course" of action.

So in your example, the enemy soldier will have to decide if
1. It is better for him to shoot as is, despite the bad shot %
2. Try to close in despite the danger of massed enemies (he has to take into account existing friendly support, enemy cover and snipers)
3. Take cover and fall back, maybe hiding inside buildings or on rooftops, so that you will have to flush them out the hard way...

also, the enemy soldiers have to follow an almost uniform reaction each time, since each one doing his thing is a recipe for disaster..


seems too ambitious, but i can clearly see how that can help...


anyway, don't expect fast results on that project.. i work slowly at best Wink

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312677] Sun, 02 December 2012 01:13 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
Sounds good. How about the end of next year as the target? I find it helps a lot to have targets.

[Updated on: Sun, 02 December 2012 01:14] by Moderator

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312682] Sun, 02 December 2012 12:26 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
well, ok... i'll bite..
1+ year is lots of time to see how it is going.... so i hereby officially set as my target the Christmas of 2013. (after all many things can happen in the meanwhile)

when/if i have progress, i will update as i can at the mod forums...

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312683] Sun, 02 December 2012 12:36 Go to previous messageGo to next message
DepressivesBrot is currently offline DepressivesBrot

 
Messages:3658
Registered:July 2009
If you produce any semi-working snippets, definitely post your thoughts and code somewhere before disappearing ... else I'll sic our resident assassin on you Wink (Joking aside, there are several projects we always start from scratch because nobody ever bothers to leave his preliminary findings)

Oh btw, I like the sound of 'evaluating fuzzy based action sequences' :thumbsup:
Just recently thought that they might be a good way to deal with 'just out of range', 'just below required cth' and stuff like that, although I'm not sure how often that really leads to applying the catechism of command.

Report message to a moderator

Captain

Re: Enemies Moronic Ai iQ, why?[message #312690] Sun, 02 December 2012 17:22 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
no disappearing without sharing, aye aye. :ok:

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #312852] Fri, 07 December 2012 12:49 Go to previous messageGo to next message
Gazz is currently offline Gazz

 
Messages:32
Registered:October 2010
Location: Bavaria
DepressivesBrot
Oh btw, I like the sound of 'evaluating fuzzy based action sequences' :thumbsup:
Just recently thought that they might be a good way to deal with 'just out of range', 'just below required cth' and stuff like that,

It's a staple in AI programming (or should be =) unless you're dealing with absolutes like a rifle that has a range of 20... and then the bullet vanishes.
For a space game (3D and realtime, though) I built one where stuff like in-rangeness were merely values to consider and the "gunner" might switch to a farther away target... because it required a much lower deflection shot. The script merely worked degrees of hit-ability and how advantageous it would be to damage this particular actor into one value, then picked the target with the highest value.
Really nothing new there but it can be quite tricky to value all the aspects correctly.

If it works, it's beautiful because it's much harder for actors to get stuck without an "allowed" action. There is always a best solution - even if it's a bad one.

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312853] Fri, 07 December 2012 13:10 Go to previous messageGo to next message
DepressivesBrot is currently offline DepressivesBrot

 
Messages:3658
Registered:July 2009
It might be a staple (I'm not up to speed on AI progging) but it's a groundbreaking innovation for JA2.

Btw, I think I said that before but MARS was great.

Report message to a moderator

Captain

Re: Enemies Moronic Ai iQ, why?[message #312855] Fri, 07 December 2012 14:26 Go to previous messageGo to next message
Gazz is currently offline Gazz

 
Messages:32
Registered:October 2010
Location: Bavaria
It was something that hadn't been tried before in X3, either.
The entire AI in that game is pretty much built in long chains of If-Then-Else. The hardcode as well as all the higher level AI scripts for pilots or turrets.
At least most custom scripts, too. AEGIS and all it's offspring like MEFOS or younameit.

It's no concidence that the AI in that game is considered smart as a rock. Because it is. It flies towards the nearest enemy and from then on, all behaviour is purely reactive. There is no trying to create a tactical advantage. There are no formations. Every ship acts individually. Ship gets shot, ship starts evading. Otherwise it closes with and if possible shoots at the closest enemy. Repeat.

With writing a smarter AI for JA2, the problem is not the principal approach - it's all the moving parts.
Weapons alone end up with a huge array of stats (some of which are irrelevant in a stand up fight, of course) which need to be tested for their "value" when deciding what weapon to use or what to shoot.
I spent a lot of my time watching, logging, tweaking, and re-evaluating conditions. You can still turn that display on in the game now. Shows the ships' relative "yumminess" in the ship name and how it fluctuates. =)

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #312955] Tue, 11 December 2012 16:15 Go to previous messageGo to next message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
For me, an added problem is my lack of knowledge of c++, and lack of experience in manipulating so big programs.
So it gets somewhat hard for me to grasp everything i need to know.
So, while i can do something, i think it is unfeasible for me to "rewrite" most of the ai.

On some occasions though (meaning some elementary situations where the ai is doing poorly) i think i can create such a system inside the if tree, where the approach will be based on evaluation.

Namely, when i understand that the if-then solution can be faulty, a small evaluation will run to modify the previously determined reaction.
Since i think i'm not ready to really overhaul the whole system using that idea (that would be the ultimate goal) i will try keep it small scale for now..

the basic idea though would be simple enough:
when the if-result is proven to be often wrong,
we generate solutions (or use a pre-defined list of them), then choose one of them through a fuzzy system.

The bad thing in generating solutions, is that they can be too many for any cpu to handle, so one has to discard many of them through assumptions, complicating the code.

And as Gazz mentioned, the evaluating idea is not very hard to grasp or code, but the fuzzy system needs much tweaking to work successfully, and the more things we factor in, the hardest the tweaking can get..

This is patchwork, i know, but one has to start somewhere...

Report message to a moderator

Private
Re: Enemies Moronic Ai iQ, why?[message #321602] Fri, 14 June 2013 21:40 Go to previous messageGo to next message
Zelekendel is currently offline Zelekendel

 
Messages:20
Registered:November 2012
Sorry for the necro, but I assume Jcd has run away without posting his work as we were afraid of? Any light at the end of the tunnel for making enemies stop dicking around in LOS?

Report message to a moderator

Private 1st Class
Re: Enemies Moronic Ai iQ, why?[message #321938] Mon, 24 June 2013 21:18 Go to previous message
Jcd000 is currently offline Jcd000

 
Messages:19
Registered:July 2011
haven't logged in a while, but its a coincidence...

well, its not that i run away, more like i didn't do anything.. Sad

RL changes etc.

so... well, i dunno... don't have much time in my hands currently... sorry bout that..

Report message to a moderator

Private
Previous Topic: Drag mercs around on Merc bar?
Next Topic: What's with Doreen?
Goto Forum:
  


Current Time: Sat Apr 20 00:23:34 GMT+3 2024

Total time taken to generate the page: 0.01780 seconds