Author Topic: How do you make AI aim better?  (Read 2466 times)

Offline AlexMB2000

  • Posts: 8
  • Cookies: 0
How do you make AI aim better?
« on: November 27, 2008, 02:31:10 AM »
The AI in my game aim terrible. When an AI comes around to face its forward torpedoes, it starts shooting well before it is ready. Maybe by the time it fires the fourth torpedo the AI actually is aiming correctly and hits me. Is there a way to make the AI aim it's torpedoes and then fire them?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: How do you make AI aim better?
« Reply #1 on: November 27, 2008, 01:23:40 PM »
It already is aiming.

I suppose it's "just" aiming too soon.

In the TorpedoRun.py (scripts/AI/PlainAI) there are 3 constants:
Code: [Select]
fMinDistance = 25
fIdealDistance = 200
fMaxDistance = 250
Change those and you can get what you want, to make the AI start later.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline AlexMB2000

  • Posts: 8
  • Cookies: 0
Re: How do you make AI aim better?
« Reply #2 on: November 27, 2008, 05:43:51 PM »
The AI in the stock game hits better than the AI in my game. I played around with those #s they didn't change the fact the AI starts shooting before it has turned around. I have KM 1.0 with DJ's galaxy installed with many of my own changes in the scripts but none have to do with the AI. Is there another way to make AI aim?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: How do you make AI aim better?
« Reply #3 on: November 27, 2008, 05:46:31 PM »
Try turning off FoundationTechnologies (for now anyway).
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline AlexMB2000

  • Posts: 8
  • Cookies: 0
Re: How do you make AI aim better?
« Reply #4 on: November 27, 2008, 06:02:43 PM »
That didn't work.  :(

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: How do you make AI aim better?
« Reply #5 on: November 27, 2008, 06:18:17 PM »
Ok, you can turn FoundationTechnologies back on. If both didn't work, then it has to be some other variable in the AI scripts.


What I would suggest for now, is try doing a search over the entire forum, I believe (know) that this question has been asked before.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline AlexMB2000

  • Posts: 8
  • Cookies: 0
Re: How do you make AI aim better?
« Reply #6 on: November 27, 2008, 06:23:45 PM »
I did search for days now. I was very reluctant to ask for fear for sounding like an idiot. I even checked another BC forum site. I can't find anything.  :(

Thanks anyways. I suppose I will live with it. I will probably make the torpedoes ridiculously accurate.

Offline AlexMB2000

  • Posts: 8
  • Cookies: 0
Re: How do you make AI aim better?
« Reply #7 on: November 27, 2008, 07:37:26 PM »
I figured it out. I started to think when I first started to see the problem. When I first encountered the AI aiming stupid is when I first downloaded MVAM Infinite back when it came out. Then I noticed again after getting DJ's Galaxy. So I looked up MVAM AI scripts and found a line in one of them about InaccruateTorps and then a change a couple of values to experiment.

It worked and my AI now shoot like they did in Stock BC. Thank you for trying to help me out MLeo.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: How do you make AI aim better?
« Reply #8 on: November 28, 2008, 03:21:48 PM »
Interesting, I forgot about MVAM(AI).

Now we have a neat record for this.

*Locked*
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: How do you make AI aim better?
« Reply #9 on: November 28, 2008, 03:46:45 PM »
please forgive me for unlocking this thread for just one second, i apologize for stepping on your toes, MLeo...   but the MvamAI is something i had never considered myself...

i am curious tho - how and why does the MvamAI script control this function, as far as affecting the accuracy of torps hitting?

i see it is located in the script in this section
Code: [Select]
#we need to find what group the ship was in... 0 = enemy, 1 = friend, 2 = neut
pAttackEnemies = None
if pEnemies.IsNameInGroup(pShip.GetName()):
if pMission.GetFriendlyGroup().GetNameTuple():
pAttackEnemies = AI.Compound.BasicAttack.CreateAI(pShip,  pMission.GetFriendlyGroup(), Difficulty = 0.1, InaccurateTorps = 1)
elif pMission.GetEnemyGroup().GetNameTuple():
pAttackEnemies = AI.Compound.BasicAttack.CreateAI(pShip,  pMission.GetEnemyGroup(), Difficulty = 0.1, InaccurateTorps = 1)
if not pAttackEnemies:
return None

what would be a better value to make them more accurate, 0?

and for that matter, what does Difficulty = 0.1 mean?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: How do you make AI aim better?
« Reply #10 on: November 28, 2008, 04:00:05 PM »
InaccurateTorps is a boolean (just checked the scripts).
So 1 in less accurate, 0 is accurate.

The Difficulty parameter (from 0, being the dumbest, to 1 being the most complex, ie. appear smartest), basicly controls the complexity of the AI.

At 0.0 it only uses the "InaccurateTorps" and "DumbFireTorps" AI modules.
At 1.0 it uses the "UseRearTorps", "UseSideArcs", "SmartShields", "ChooseSubsystemTargets", "AvoidTorps", "NeverSitStill", "PowerManagement", "SmartWeaponBalance", "SmartPhasers", "SmartTorpSelection", "DisableBeforeDestroy" and "AggressivePulseWeapons" AI modules.

Other values are just between these.

Difficulty 0.1 means "InaccurateTorps", "UseSideArcs".
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: How do you make AI aim better?
« Reply #11 on: November 28, 2008, 04:02:27 PM »
aaaaah okee i understand now :)

thanks for clarifying that, MLeo! :D

+cookie


(feel free to lock the thread down again, i promise i wont step on your toes and unlock it again lol :P)

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: How do you make AI aim better?
« Reply #12 on: November 28, 2008, 04:03:10 PM »
As Moderator you could have just posted. :P
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.