Author Topic: AI and explosives  (Read 30690 times)

Offline volutar

  • Colonel
  • ****
  • Posts: 351
  • Vanilla digger & Quality assistant
    • View Profile
Re: AI and explosives
« Reply #15 on: December 16, 2014, 05:57:34 pm »
Being myself a person, who joined this project in 2011, when it just went 0.3, I found it highly "non vanillish" in every possible way, except for VISUAL (visual replication was the only thing that developers could make), and something from not very reliable Ufopaedia.org (mostly gameplay info was taken not from the game observation, not CODE itself).

So, being a perfectionist I took "Ufo defense.exe" and reversed it. Completely. I made many corrections in the https://ufopaedia.org, and actually by my effort favoured OpenXcom into rails of "gameplay replication" from not very viable "visual replication".

I given alot of actual deep info about vanilla x-com insides for the few actual contributors. Warboy became my friend and  main "agent" towards OXC development. He's really good programmer, and v1.0 is actually obliged to him, his passion. Without him it would probably stuck at v0.6.

And if anything you find in OXC doubtful, in terms of being "vanilla", better blame me. Perhaps I didn't explain that correctly to him, or didn't understand that correctly myself. Explosion code for the AI was handled like 1.5-2 years ago methinks?... I don't really remember if that code is of Warboy or Daiky, but actually, looking into vanilla, I can say:

AI is using actual units as throw targets, if it sees them. If not - it trying to use NODES to make max damage.

Code: [Select]
if ( p_AI_Target_UnitPos_addr )
{
  _x = p_AI_Target_UnitPos_addr->x;
  _y = p_AI_Target_UnitPos_addr->y;
  _z = p_AI_Target_UnitPos_addr->z;
}
else
{
  nodeId = xc_BF_AI_Get_Node_Of_Maximum_Grenade_Damage(p_ObData_DAT[curitem->obdata_ref].weapon_damage);
  if ( nodeId == -1 )
    return;
  _x = a_Routes_DAT[nodeId].x;
  _y = a_Routes_DAT[nodeId].y;
  _z = a_Routes_DAT[nodeId].z;
}

And please, stop pestering Warboy, if you want to see TFTD soon.
Thank you.
« Last Edit: December 16, 2014, 06:04:01 pm by volutar »

Offline ivandogovich

  • Commander
  • *****
  • Posts: 2381
  • X-Com Afficionado
    • View Profile
    • Ivan Dogovich Youtube
Re: AI and explosives
« Reply #16 on: December 16, 2014, 07:19:19 pm »
Thanks for that Explanation, volutar!
I can understand that a thread like this can be frustrating to the devs and warboy particularly, but I really do appreciate how much I've learned through it.  I can understand the danger of knowing how the sausage is made can diminish the game, but I still find this game and incredible piece of work, and I'm thankful and awed by the devs, everytime I play it!  So thanks for all the awesome work, and thanks for the explanation!
Cheers!

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: AI and explosives
« Reply #17 on: December 17, 2014, 07:01:44 pm »
interesting, i had thought it was nodes only in vanilla, but it's clear they used both, so guess i'll have to add node behaviour (or something better) at some point as well.

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: AI and explosives
« Reply #18 on: December 19, 2014, 12:52:35 pm »
I guess I agree that danger from blaster launchers and grenades should be present right from the start. After all, I can't remember getting my whole squad hit much in the original unless I was stupidly leaving them clustered up.

As for the Lightning making your troops open to fire right from the start: this is actually potentially advantageous for your soldiers. If you have to step out from behind a wall to see the aliens, that opens them up to take a shot at you with reaction fire. But if you're already facing them, you can make the first shot. Make it an aimed shot, and kill an alien with a heavy plasma who's got a good line of fire. The one with the pistol and an obstructed path can be shot later, and any facing away from you or any terrorists are last priority.

Offline bladum

  • Colonel
  • ****
  • Posts: 213
  • Bladum
    • View Profile
Re: AI and explosives
« Reply #19 on: December 19, 2014, 02:13:00 pm »
why not just make this as a global variable in ruleset ? initialGrenadeDelayForAliens with default value of 3

Offline jackstraw2323

  • Colonel
  • ****
  • Posts: 206
    • View Profile
Re: AI and explosives
« Reply #20 on: December 19, 2014, 03:37:07 pm »
I understand if dev's don't want to change but how about allowing the mod on explosives use to be in the unit section of the rules file? That way individual units could be made explosives aggressive if someone wanted. I've got a unit with built in explosives that on terror missions is totally passive until turn 3.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: AI and explosives
« Reply #21 on: December 19, 2014, 03:56:08 pm »
you could make your own build instead of putting pressure on me?
the source code is publicly available, you can alter it in any way you see fit.
« Last Edit: December 19, 2014, 08:52:09 pm by Warboy1982 »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: AI and explosives
« Reply #22 on: February 12, 2015, 08:08:54 pm »
While that's a bit harsh of an answer, how about someone made a pull request to implement jackstraw's solution? What's the likelihood of that being pulled into the mainstream OpenXCom?

Making your own build for your mod defeats the purpose of publishing a mod: nobody will use it. Making a pull request to address such a recurrent topic as the early explosives? Might be good for the community as a whole!

Offline Hobbes

  • Commander
  • *****
  • Posts: 2101
  • Infiltration subroutine in progress
    • View Profile
Re: AI and explosives
« Reply #23 on: February 12, 2015, 08:17:00 pm »
While that's a bit harsh of an answer, how about someone made a pull request to implement jackstraw's solution? What's the likelihood of that being pulled into the mainstream OpenXCom?

Making your own build for your mod defeats the purpose of publishing a mod: nobody will use it. Making a pull request to address such a recurrent topic as the early explosives? Might be good for the community as a whole!

If you want to make such a build then you'll need to be constantly updating it to the newest nightlies, just like a mod. Plus, having two different builds running around is not a good idea because of the confusion.

Based on the discussion and the reasoning behind the no-explosives choice, I've actually changed my mind regarding this issue because its effect is rather minimal when you consider the whole tactical mission. I doubt that people would actually notice a difference if things were changed to  vanilla. The aliens starting facing the Skyranger has a much bigger (and deadlier) effect, but it is a great idea and the no explosives helps to balance it.
« Last Edit: February 12, 2015, 08:20:09 pm by Hobbes »

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: AI and explosives
« Reply #24 on: February 12, 2015, 08:35:49 pm »
I'm not suggesting to make another build, I agree that it is not a good solution. It either splits the community or nobody uses it so it was a waste of time. That's why I'm asking if moving the number of turns before using explosives to a ruleset (I am thinking of it as a weapon property) would be likely to be pulled in the main OpenXCom build. If it is, I might look into doing it (then people could set it to whatever they want and it would end the debate once and for all). If it isn't likely to be pulled, I won't waste my time and try to sustain an alternate build.

I had/have plans to give aliens new ammo in late game: Anti-plasma (anti-matter can be turned into plasma as well as matter, as far as I know). It would be explosive, of course. This restriction means that for the first 3 turns, aliens armed with this new ammo would be totally harmless, which is useless, hence my interest.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2101
  • Infiltration subroutine in progress
    • View Profile
Re: AI and explosives
« Reply #25 on: February 12, 2015, 08:51:44 pm »
I was going to discourage you by saying that there might already too many options, but instead I'll simply say: try it. You got a valid reason for the feature and it may get pulled into the main build. And if it doesn't, then you'll have learned how to do it :)

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: AI and explosives
« Reply #26 on: February 12, 2015, 09:17:32 pm »
Oh, I don't need any discouragement. Already plenty of other things I want to do! If I knew that the feature is likely to get in, I would consider it seriously though.

Offline Yankes

  • Commander
  • *****
  • Posts: 3194
    • View Profile
Re: AI and explosives
« Reply #27 on: February 12, 2015, 09:20:18 pm »
I think it could be done on fine grained way, every item with splash damage can have "deley" property that determine when AI can start using this weapon.
This could be too much for master branch but my extended version will accept it.

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: AI and explosives
« Reply #28 on: February 12, 2015, 09:49:15 pm »
That's what I am thinking. Another weapon/ammunition property that is checked by the AI for when it can bring out a given toy instead of just checking against "3".

It's good to have some support :) After I get the XAE to the stage I want, I think I will look into it.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11408
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: AI and explosives
« Reply #29 on: March 20, 2015, 09:54:24 am »
I also support de-hardcoding this value. The reason is, it's a source of discontent and confusion for so many people that just giving them the tool to change it would probably save everyone a lot of trouble. :)

Besides, some mods are much more influenced by this than others. For example, Piratez is a fast, close-quarters game, where in many instances most enemies are dead by 3rd turn, or you're doing something wrong. This makes grenades much less viable for the AI, and especially when explosives are the only weapons this particular unit has.

And if we do have this configurable via ruleset, can we please have the number adjustable too? (Something like explosivesDelay: X, where X is the number of turns, and 0 means they can be used straight away.)