Author Topic: [SOURCEMOD] Brutal-OXCE 7.12.1  (Read 126182 times)

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
[SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #330 on: September 21, 2023, 09:58:37 am »
@jnarical thanks for sharing and very quick bugfix! Very interesting analysis.

I got the Tapatalk app to my phone and now it’s so much better to access oxc forums)

I’ll look into other bug, was a little bit occupied last days

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #331 on: September 21, 2023, 10:35:48 am »
Xilmi, I read the changelog for 7.6.6. and it seems practically good approach.
The mechanics in OXCE are that each crewmate death damages morale for all units. Plus, in XPZ morale lowers by itself due to units' armor stats (crew gets bored).

"The AI shall no longer attack targets that it cannot harm at all and instead spend their time-units on something else." -
How is it checked?
If by trial and error, then will it be that barehanded naked guys will flee from power-armored crew? 
« Last Edit: September 21, 2023, 10:37:24 am by Abyss »

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #332 on: September 21, 2023, 11:11:01 am »
Made saves for werewolves howling, both geoscape (vessel approaching) and battlescape. The version with "bugged" behavior was 7.6.1. Testing it too.
UPD. Works much better.
Still, one thing that will raise the elegance: howling disrupts reaction attacks, so if werewolf howls at someone, he logically should attack that particular unit.
Right now howling is much less (still here, which is good for objective reasons), but melee attacks and "aimed shots" are patterned in such way that melee to closest unit, while howl at random.   
« Last Edit: September 21, 2023, 11:20:28 am by Abyss »

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #333 on: September 21, 2023, 12:10:25 pm »
"The AI shall no longer attack targets that it cannot harm at all and instead spend their time-units on something else." -
How is it checked?
If by trial and error, then will it be that barehanded naked guys will flee from power-armored crew?
Now that you mention this, I realize that I didn't think this through fully.
Firstly it checks this via the scoring-algorithm that also determines who to attack. There it calculates the assumed damage based on their weapon-damage, the targets armor and the targets resistances. Previously the algorithm would act so that it assumes it would always do at least 1 damage. But attacking a target that you can't damage just gives away your position and does not help you. That's why I changed it. Should also help with immersion, that a naked guy with bare-fists doesn't try to go up against someone in power-armor.

But I just realized that there now is a contradiction between leeroy-mode or other high-aggressiveness settings. Because those would still run up to the enemy and then... just stand there. I think that I should check for the units aggressiveness and if it is 3 or higher it should still attack in these cases because otherwise it would look pretty dumb.

This behavior in general needs more testing of what the impact is. Even on lower aggressions. It might still make sense to run up to the enemy to maybe scout more squishy targets.

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #334 on: September 21, 2023, 01:30:03 pm »
A mission vs ghosts that can only do CHARM damage. (it is similar to daze and inflicts stun.)
Indeed, now AI doesn't use it, preferring to hide or run around, whereas in vanilla it just spammed charm spells until whole crew is unconscious.
I, in person, think that AI still doesn't realize that driving whole enemy squad unconscious is victory condition, too.
If it can inflict wounds - that's good,
If it cannot, then every possible way is good.
Ghosts can do much better, as their attacks ignore armor.

Firstly it checks this via the scoring-algorithm that also determines who to attack. There it calculates the assumed damage based on their weapon-damage, the targets armor and the targets resistances.
That's convenient, but does it:
- count (0-100)x2 damage roll? Which means, that weapons rarely make 200% damage
- to be not that cheaty, at least try to inflict damage before deciding to flee or hide?
- know that fire does at least 1 damage?
- know that his weapon (mostly, multibarrel weapons and energy weapons) reduces target's armor, and then damage can be inflicted?
- interesting, can BAI decide to pass the most convenient weapon to the next unit (e.g. drop it on ground and move a tile, then next unit picks up the weapon and shoots one more time, as player can do this multiple times)

Well, actually the part of the balance is mostly up to the modders who design enemies in each tier of game, BAI's part is to make it better in decision making.
If some unit cannot inflict damage, it still should act with it's powers.

BTW, ghost mission is not the only when possible CHARM attacks are mostly ignored by BAI. There's a mission where naked guys are running around your single soldier on cruise liner. Seems like they don't know how to use melee CHARM attack properly. This is their only attack, because lore-wise they are non-combatants (no brawl).
Ranged CHARM attacks from other units were simultaniously used (although not that efficiently as it could be).

What is it all about, I think:
If modder adds some special weapon (like special claws, howl, or melee/ranged charm, or mind control), he presumes that it alone will make difficulties to the player, thus keeping intrigue even in mid/late missions where all-brutally armored.
« Last Edit: September 21, 2023, 01:33:51 pm by Abyss »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #335 on: September 21, 2023, 03:44:19 pm »
A mission vs ghosts that can only do CHARM damage. (it is similar to daze and inflicts stun.)
Indeed, now AI doesn't use it, preferring to hide or run around, whereas in vanilla it just spammed charm spells until whole crew is unconscious.
I, in person, think that AI still doesn't realize that driving whole enemy squad unconscious is victory condition, too.
I think this whole endeavor is pointless, attacks are effective "Turing complete" (if someone allow AI to have weapons with complex y-scripts attached).
Probably much easier would be add configs for each weapon that inform AI how much should prefer it over others weapons.
Of corse this will not fix problem like energy shields that are vulnerable only to specific weapons types.

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #336 on: September 21, 2023, 05:22:43 pm »
Of corse this will not fix problem like energy shields that are vulnerable only to specific weapons types.
Of course, that's what I come up to during the analysis of possibilities: if modder (universe's God) gives something to the unit, it is purposeful and should be used.
Other, special attacks use should be balanced purpose-wise. If howl, then specifically to disrupt reactions. If CHARM, then specifically to take one out of the equation, not just to inflict some stun.

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #337 on: September 21, 2023, 06:03:49 pm »
New AI decision making breaks patterns of weak enemies: they just dance back and forth on two tiles. The save is attached (past few panic screaming sounds. The whole situation is that one unit dropped gas grenade and killed other unconscious BAI-controlled units).
BAI doesn't yet consider own unconscious units as potential combatants past couple of turns? Doubious situation, but overall ok.
« Last Edit: September 21, 2023, 11:15:40 pm by Abyss »

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #338 on: September 22, 2023, 09:22:22 am »
One more "bug" report: enemy turrets don't shoot. I haven't checked 1x1 turrets, but 2x2 turrets, which are supposed to be the most troublesome enemy in specific missions (and during the base defend at the side of player too), just stay looking at same direction with no particular action.
With BAI turned off works as intended (seeks targets within line of sight and perform shooting).
I checked the stats of turrets, if this somehow helps: they all have some amount of TU (32-100) and 1 energy (immobile), with shooting cost flat % (like, 40% for chaingun turrets, 55+% for battle tank, which is this mission). Turning the turret costs some TU.   
Savegame is attached (XPZ).

As turrets are common and most strong enemy in early & mid game missions, this is vital issue.

« Last Edit: September 22, 2023, 12:38:08 pm by Abyss »

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #339 on: September 23, 2023, 01:40:27 pm »
If the stun isn't used at all, then something is wrong with the calculations that are being done to deduce the effectiveness. I think it probably wasn't a good idea to not attack when the AI thinks they won't do damage due to potential scripts that have effects which are not among the regular effects. Like spawning units and stuff like that. So I think I'll go back to assuming each attack does at least 1 damage no matter what.

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.6
« Reply #340 on: September 23, 2023, 02:23:18 pm »
One more "bug" report: enemy turrets don't shoot. I haven't checked 1x1 turrets, but 2x2 turrets, which are supposed to be the most troublesome enemy in specific missions (and during the base defend at the side of player too), just stay looking at same direction with no particular action.
With BAI turned off works as intended (seeks targets within line of sight and perform shooting).
I checked the stats of turrets, if this somehow helps: they all have some amount of TU (32-100) and 1 energy (immobile), with shooting cost flat % (like, 40% for chaingun turrets, 55+% for battle tank, which is this mission). Turning the turret costs some TU.   
Savegame is attached (XPZ).

As turrets are common and most strong enemy in early & mid game missions, this is vital issue.
This must have been broken since I introduced the AI checking for hiding-spots before moving. I fixed two AI issues in relation to the turrets now. But I'd pass this save on right to @jnarcical, as after fixing the issue and testing, the turret was unhittable with "Realistic accuracy"-mode, despite the AI thinking it was hitable. So there was once again a discrepancy between the logic of the AI and the logic in the game.

Also disabling realistic accuracy made the tank hitable again and the other units killed it within two turns.

Edit: I put out a 7.6.7 with fixes for turret-AI and informed Joy Narical to look at the issue of turret not being hitable when "Realistic accuracy" is enabled. My observations showed that the tank is kinda weird since the clickable box to select the turret is not mounted on top of the tank like usually in WH40k but instead somehow sunken into the tank. I suppose this is what's causing the issues.
« Last Edit: September 23, 2023, 02:37:28 pm by Xilmi »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #341 on: September 24, 2023, 01:25:27 am »
As turrets are common and most strong enemy in early & mid game missions, this is vital issue.

So, I have something to say. I've fixed a bug with 0% exposed turrets, but I don't want to roll out new version in it's current state.
There's a mess in UFO Extender accuracy code. I found a discrepancy between displayed accuracy number and "internal" accuracy, I get the reasons of that pretty wrong - I thought that the issue is caused by displayed accuracy calculated in 3D-space, but "real" applied accuracy calculated in 2D (which is true and looks like as obvious bug to me). As it turned out, displayed accuracy also 2D-based, and moreover - 2D "real" accuracy is intentional. So, UFO Extender accuracy doesn't take into account vertical distance. From the game' perspective, distance to adjanced unit is the same as distance to a unit 10 levels higher. Meridian doesn't count that as a bug. Also, calculations for displayed accuracy and "real" one is totally different and give different results. Sometimes you see 50% accuracy on screen and it's true, sometimes "real" accuracy under the hood differs due to different algorithm. Meridian doesn't consider that as bug too. So I closed my PR to OXCE, but for "real accuracy" mod the problem still persists and I'm looking for solution.

As I want to make my mod optional, I tried to save and reuse UFO Extender accuracy code. I suppose, I shouldn't try to fix UFO Extender accuracy, making it 3D-based, so I need to write my own algorithm for distance calculation - from shot origin to a nearest target point in 3D. Until that, displayed accuracy numbers would be false and confusing.


Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #342 on: September 24, 2023, 03:13:41 am »
Algorithm example

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #343 on: September 24, 2023, 10:56:33 am »
I found a discrepancy between displayed accuracy number and "internal" accuracy, I get the reasons of that pretty wrong - I thought that the issue is caused by displayed accuracy calculated in 3D-space, but "real" applied accuracy calculated in 2D (which is true and looks like as obvious bug to me). As it turned out, displayed accuracy also 2D-based, and moreover - 2D "real" accuracy is intentional. So, UFO Extender accuracy doesn't take into account vertical distance. From the game' perspective, distance to adjanced unit is the same as distance to a unit 10 levels higher. Meridian doesn't count that as a bug.

Personally, I most certainly count that as a bug.

If you look at the OXCE code (not OXC code), I have even changed the displayed accuracy to be 3D, not 2D. Already years ago.
It is also mentioned in the thread with differences between OXC and OXCE.

It doesn't help with the "accuracy issue" unfortunately, but it helps at least with the "max range" issue.

Also, calculations for displayed accuracy and "real" one is totally different and give different results. Sometimes you see 50% accuracy on screen and it's true, sometimes "real" accuracy under the hood differs due to different algorithm. Meridian doesn't consider that as bug too.

Again, I most definitely consider that a bug too.

Your solution was however both wrong and incomplete, that's (also) why it was rejected.

I have also written that a 100% correct solution doesn't exist in all cases (due to RNG), which is why I abandoned the idea of fixing it in OXCE.
But if you are OK with just a partially correct solution, you're free to partially fix it in your version.

Or, if you find a completely correct solution, I will gladly admit I was wrong.

So I closed my PR to OXCE, but for "real accuracy" mod the problem still persists and I'm looking for solution.

You have not made a PR to OXCE.
You have made a PR to OXC.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #344 on: September 24, 2023, 11:39:38 am »
Quote
If you look at the OXCE code (not OXC code), I have even changed the displayed accuracy to be 3D, not 2D. Already years ago.
It is also mentioned in the thread with differences between OXC and OXCE.
....
You have not made a PR to OXCE.
You have made a PR to OXC.
My bad. Very bad  :) I was sure that code wasn't changed. I'm working with OXCE-based code but decided to make a PR to OXC. To be honest, yesterday I was looking for my closed PR in OXCE repo ))))))
If someone interested: https://github.com/OpenXcom/OpenXcom/pull/1427

Quote
Your solution was however both wrong and incomplete, that's (also) why it was rejected.
That's true. Starting with my wrong understanding of reasons for the issue.

Quote
Personally, I most certainly count that as a bug.
I get it wrong, again, but that doesn't matters... I consider UFO Extender accuracy as legacy, I cannot change it to something totally different.

Quote
I have also written that a 100% correct solution doesn't exist in all cases (due to RNG), which is why I abandoned the idea of fixing it in OXCE.
But if you are OK with just a partially correct solution, you're free to partially fix it in your version.
You're most probably talking about vanilla applyAccuracy(). UFO Extender accuracy number represents real applied one kinda approximately, That's not fixable in current state, that's why I've reworked accuracy mechanics to the very bottom, making it determined. Now RNG depends on accuracy number, not the other way around. And that makes it possible to use the same algorithm in Map::drawTerrain() and in applyAccuracy().

Now, I'm working on voxel-to-unit distance algorithm, which would be voxel-based - that will change the accuracy more gradually. Algorithm should find the shortest path to a target cylinder (not tile).