project-navigation
Personal tools

Author Topic: Artificial Intelligence  (Read 36751 times)

Offline Harkhanam

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Re: Artificial Intelligence
« Reply #45 on: November 23, 2014, 10:59:52 pm »
Thanks for the reply, I'm compiling the project for the first time and it gave the satisfactory : ||=== Build finished: 0 errors, 24 warnings ===|

First thing is to mess with the cost function of the search, I'll be back for more questions sooner or later. (-:

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Artificial Intelligence
« Reply #46 on: November 24, 2014, 12:27:27 am »
Hi,

Good to know you could compile without problems :)

And I must correct myself... typed that reply in a hurry before going out to an appointment, I was bound to make a mistake... anyway, ROUTING_NOT_REACHABLE is returned not when the actor doesn't have enough TUs but when the pathing cost is too high (currently max lenght is 50 TUs IIRC)

Offline Harkhanam

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Re: Artificial Intelligence
« Reply #47 on: November 25, 2014, 04:48:09 am »
Ok so I've compiled the maps and launched the compiled .6 version :o)

I have a much more clear view of AI limits now

Basically, it's :

Move to a shooting spot by the shortest path where you can shot at a visible ennemy
Shot as much as you can
Find cover if possible

However, the "find cover" seems very rare and that would be because there's no saving of TU for it : AI select its target & its move, then, a cover if TU's left permit it (if I'm right).
But, AI will more likely try to use every TU available because the score function depend on the damage inflicted.

There's another interrogation :
g_ai.cpp : AI_FighterCalcActionScore(...)
Code: [Select]
if (!(AI_IsExposed(hidingTeam, actor)) && !AI_HideNeeded(actor)) {
bestActionScore += SCORE_HIDE + (aia->target ? SCORE_CLOSE_IN + SCORE_REACTION_FEAR_FACTOR : 0);
} else if (aia->target && tu >= TU_MOVE_STRAIGHT) {
It seems those line are for Aliens to make ambush : They don't want to risk reaction fire so they find a spot out of ennemy sight and gives it value, it lacks a check to see if the alien has reaction fire turned on.
It would require AI_HideNeeded(actor) without the negation ( ! )
I made a change an tested it, aliens start to play more passively once they start suffering losses. (and killed one of my soldier with reaction fire)

I'm wondering, is there a way to print data into the console while the game is playing ?
« Last Edit: November 25, 2014, 04:50:17 am by Harkhanam »

Offline Sandro

  • Squad Leader
  • ****
  • Posts: 240
  • Maintenance guy for UFO:AI 3D engine
    • View Profile
Re: Artificial Intelligence
« Reply #48 on: November 25, 2014, 03:30:25 pm »
However, the "find cover" seems very rare and that would be because there's no saving of TU for it : AI select its target & its move, then, a cover if TU's left permit it (if I'm right).
But, AI will more likely try to use every TU available because the score function depend on the damage inflicted.

IIRC, that is not exactly true -- if AI is NOT in the "brave" mode, it will try to hide at the end of turn, but on most maps it is quite hard to find a safe spot, since they are outdoors. Also, window between "brave" and "panic" modes is quite narrow IIRC. Maybe DarkRain could give a better explanation.

It seems those line are for Aliens to make ambush : They don't want to risk reaction fire so they find a spot out of ennemy sight and gives it value, it lacks a check to see if the alien has reaction fire turned on.

Aliens always have reaction fire turned on. And yes, there are some attempts to implement ambuses, though not very effective on most maps.

I'm wondering, is there a way to print data into the console while the game is playing ?

Com_Printf(...), syntax is like classic printf(...)

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Artificial Intelligence
« Reply #49 on: November 25, 2014, 06:06:21 pm »
Re: AI and cover as Sandro says AI will not always look for cover only if they are not brave or if they see an enemy with a powerful weapon, but the problem you mention with them using all TUs for shooting is also true as expected damage is currently the main part of the AI action scoring.

No aliens don't always have reaction fire enabled ̣— see AI_InitPlayer() is only a 75% chance they do — and it can change during battle (the AI won't their change RF status once spawned by themselves, but losing their weapon, flashbangs and the shaken status)

Offline Harkhanam

  • Cannon Fodder
  • **
  • Posts: 4
    • View Profile
Re: Artificial Intelligence
« Reply #50 on: November 25, 2014, 08:07:41 pm »
HDD went dead today.

Thanks for the Com_Printf(...), will be priceless to check scoring while skirmishing once I've redownloaded, reinstalled and recompiled all the things needed :p

Another thing that may be clear for you : the visibility of aliens. I've read that "we" believe they see everyone because the way they search for target "move them" to the position before checking visibility. However, if the visibility check is a simple "flag test" that is only set when the correct "move procedure" is done, maybe that flag is not reset when the position of the alien is changed, hence negating the assumption that they can see everyone.

I'll go check ASAP if you can't say without looking at it, and I'll do my first Com_Printf(...) on it to be sure :P



Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Artificial Intelligence
« Reply #51 on: November 25, 2014, 11:44:18 pm »
Sorry to hear that :(

The AI should be doing actual visibility tests (which involve line tracing) if there are places that are using flag test that should be regarded as a bug (for the reason you mentioned)
« Last Edit: November 25, 2014, 11:48:04 pm by DarkRain »