Author Topic: Do aliens spend TU's to prime grenades?  (Read 4546 times)

Offline Nerva

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Do aliens spend TU's to prime grenades?
« on: December 19, 2016, 08:07:19 pm »
Since aliens don't throw grenades that are set for a delay, I'm curious if the game requires them to waste TU's to prime grenades?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11722
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Do aliens spend TU's to prime grenades?
« Reply #1 on: December 19, 2016, 09:21:53 pm »
Yes, I remember Warboy said that they don't get to use grenades faster than X-Com.

Offline Nerva

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Do aliens spend TU's to prime grenades?
« Reply #2 on: December 19, 2016, 10:28:41 pm »
A related question would be, do aliens ever prime grenades on one turn, run out of time to throw, and then throw them the next turn, or does the AI never prime if it can't immediately throw?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Do aliens spend TU's to prime grenades?
« Reply #3 on: December 19, 2016, 10:43:20 pm »
A related question would be, do aliens ever prime grenades on one turn, run out of time to throw, and then throw them the next turn, or does the AI never prime if it can't immediately throw?

I have only peeked into the AI code, so not 100% sure, but looks to me they throw grenade only if they can prime + throw + have 4 more TUs to move the grenade from belt to hand.

https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/AIModule.cpp#L1814

Offline Nerva

  • Sergeant
  • **
  • Posts: 31
    • View Profile
Re: Do aliens spend TU's to prime grenades?
« Reply #4 on: December 19, 2016, 10:53:48 pm »
You're saying that's how OpenXcom works?   Any idea if anyone knows how the original game's AI worked?   Did OpenXcom recreate the AI from observing the original game, or did they somehow decompile the original code and find the actual algorithms?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9090
    • View Profile
Re: Do aliens spend TU's to prime grenades?
« Reply #5 on: December 19, 2016, 10:58:41 pm »
You're saying that's how OpenXcom works?   Any idea if anyone knows how the original game's AI worked?   Did OpenXcom recreate the AI from observing the original game, or did they somehow decompile the original code and find the actual algorithms?

Yes, this is OpenXcom forum. Unless stated otherwise, we talk about OpenXcom.

I don't know how original worked... maybe Volutar or Warboy could say.

AI was (intentionally) not re-created 1:1, but it is quite similar to original. There was reverse-engineering involved, but not everything.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Do aliens spend TU's to prime grenades?
« Reply #6 on: December 20, 2016, 12:01:00 am »
Any idea if anyone knows how the original game's AI worked?   Did OpenXcom recreate the AI from observing the original game, or did they somehow decompile the original code and find the actual algorithms?

Warboy recreated the original AI from the original code, made a few improvements upon it but nothing too different.

The AI itself isn't too complicated: each alien can have 4 states, Patrol/Attack/Flee/Ambush