aliens

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

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9084
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #345 on: September 24, 2023, 11:53:46 am »
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().

Yes, that's probably the only way how to make both return the same values in all cases.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #346 on: September 24, 2023, 03:10:11 pm »
Quote
I don't want to roll out new version in it's current state.
I've changed my mind. It'll take some time to make everything right, so I've just uploaded the fix.

upd: while testing it before I can tell xilmi to make new version, I found another odd bug, which is (as far as I can tell) is not related to my code, and happens before my code. Game return false when checking for LoS, and applies noLoS penalty. While there's obvious LoS in first-person view. There's obvious visible tank turret.

I'm considering to add "big target accuracy multiplier" btw...

upd2: so, I've got clear OXCE and here it is. There's no line of fire to the "turret" unit, thus -50% accuracy penalty multiplier applies. Displayed accuracy is 55%, real accuracy is 27% after casting to int. That bug is not mine (which is good) but I should fix it anyway cause I need noLOS penalty too, and LOS definitely exists here
« Last Edit: September 25, 2023, 12:28:32 am by jnarical »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #347 on: September 25, 2023, 01:12:03 am »
Meridian, here's the fix. Hopefully it won't break anything. And to be honest, that's the very same bug I've fixed in my code first - the issue was more obvious as the debug made it clear.
That's the second time when I'm too lazy to make a PR for a bugfix, first one was when I found UD in getOriginVoxel recently

upd: that tank implementation is nuts, anyway
« Last Edit: September 25, 2023, 01:14:36 am by jnarical »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
[SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #348 on: September 25, 2023, 05:52:58 am »
Bug 1: Have a look at the attached screenshot. You can see the debug log saying my agent (standing on the right) hit the deep one (standing one the left) but it is not true - the shot actually hit the tree. Right in the middle.
Fixed. Current state (in my repo) - fixed 3 bugs, tanks in x-piratez are killable now (maybe too easy, but what do you want from rocket launchers with accuracy > 150 while kneeling?)
There's disrepancy between displayes accuracy and that which is showed by debug - it's ok, will be fixed soon. Also, some issues with close combat accuracy numbers and big units - same reasons.
I've done some strange thing - removed my own distance calculations and use one from UFO Extender.

IMPORTANT! If you got a crash - please run the game again, load last battlescape autosave, and check if it will crash again. If yes - post the save here.
« Last Edit: September 25, 2023, 11:11:36 am by jnarical »

Offline Scamps

  • Captain
  • ***
  • Posts: 84
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #349 on: September 25, 2023, 03:30:41 pm »
V7.6.6. Threw a proximity grenade under reaper's feet. But reaper was smart, and thew (kicked?) grenade away, somehow not triggering proximity (well, it didn't move before throwing, smart creature). A couple of turns later a civilian stepped on said grenade, blowing him(her?)self up. Then I realised that grenade was thrown into my equipment pile. Smart reaper. Civilians were also controlled by Brutal-AI, which leads me to beleive they cooperated with aliens. :)

Offline Xilmi

  • Moderator
  • Commander
  • ***
  • Posts: 642
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #350 on: September 25, 2023, 04:53:42 pm »
V7.6.6. Threw a proximity grenade under reaper's feet. But reaper was smart, and thew (kicked?) grenade away, somehow not triggering proximity (well, it didn't move before throwing, smart creature). A couple of turns later a civilian stepped on said grenade, blowing him(her?)self up. Then I realised that grenade was thrown into my equipment pile. Smart reaper. Civilians were also controlled by Brutal-AI, which leads me to beleive they cooperated with aliens. :)
Aliens picking up and throwing proximity-grenades that land on their tile is intended. But I think units probably have a flag of whether they can pick up stuff which is apparently ignored by the AI. Pretty sure reapers shouldn't be able to.

I can explain the civilian-issue. The code to go for and pick up weapons isn't from me. It's actually outside of the AI code and is run with priority. I never bothered to change that. So if a brutal-AI-controlled unit has no weapon it's primary directive is to go and pick one up. All the safety-checks that are normally associated with movement of brutal-AI are not exected in this case.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #351 on: September 26, 2023, 02:44:42 am »
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).
DONE! Works like a charm, consistently, gives distance in voxels. Perfectly aligns with numbers calculated “by hand” on paper. It’s really cool to see that distance for shooting “from below” is less than “from above”, as weapon barrel is closer to the top of a tile. And even more cool to see that similar fire positions relative to target give totally equal distances. It’ a win)

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #352 on: September 28, 2023, 12:14:48 am »
tanks in x-piratez are killable now (maybe too easy, but what do you want from rocket launchers with accuracy > 150 while kneeling?)
The thing is, battle tank with the select box "sunken" into the chassis is the only tank and only mission in the whole giant mod. It might be done in such fashion to be harder dealt with, if not for basic defense from below. It also may had been done so player had to use his brains to deal with it. It's "challenge mission", too, btw. 
Other tanks, which are not static objects, are movable 4x4 units with clear select box.

I wanted to ask you, regarding your improvements in shooting mechanics:
can it be done in such way that legacy hit chances stay in place (e.g. extender accuracy, because all firearms had been balanced with it in mind), while weird stuff, like missing all twelve 140% shots, because bullets fly through the sprite, but don't hit the actual voxels, got solved? This mostly happens when enemy is either near the wall (while your soldier shoots from parallel position to it), or near the border of the map, or behind the opened door, or behind a stick pinned into the ground and so on. That's really frustrating.

The save is attached, soldier is facing the ninja, which is adjacent to map edge.
From this position, and from one tile diagonal closer it weirdly misses.

Don't get me wrong, your accuracy modification improves close-range shooting too well. And that's why I think it affects the balance (had it checked, too, vs plasma autofire enemies, and I thing there should be misses in the queue. Literally all plasma shots hit my soldier and I was upset. That's not what I got used to!). There's not only mechanical issues why things miss (aside from weird voxel issues) - each turn in X-COM is similar to 6-8 seconds in real life. Thus, hand tremor can justify three misses with 60% hit chance. Or four with 70%, rarely. But not twelve with 140%).
« Last Edit: September 28, 2023, 12:16:41 am by Abyss »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #353 on: September 28, 2023, 03:24:19 am »
I wanted to ask you, regarding your improvements in shooting mechanics:
can it be done in such way that legacy hit chances stay in place (e.g. extender accuracy, because all firearms had been balanced with it in mind), while weird stuff, like missing all twelve 140% shots, because bullets fly through the sprite, but don't hit the actual voxels, got solved? This mostly happens when enemy is either near the wall (while your soldier shoots from parallel position to it), or near the border of the map, or behind the opened door, or behind a stick pinned into the ground and so on. That's really frustrating.

The save is attached, soldier is facing the ninja, which is adjacent to map edge.
From this position, and from one tile diagonal closer it weirdly misses.
I've tested your save, it works with "real accuracy"=ON pretty like it's intended to. Do you mean the situation when "real accuracy" is OFF, and "ufo extender accuracy" is ON? If that's the case, I can make it clear for you. There's no such thing as "legacy hit chances", honestly. There's accuracy number, which is basically unit's accuracy * weapon accuracy with particular shot type * 1.15 if kneeling * 0.5 if no line-of-sight * 0.8 if weapon is two-handed but there's something in second hand... and some penalties for wounds count and per health percent left. if a unit has 100 accuracy, weapon has 65% base accuracy for autofire, and unit is kneeled - you get 100*0.65*1.15 ~= 75% accuracy. For some fixed UNKNOWN distance to a 1-tile target, that would mean roughtly 75% chance to hit. For any other distance, or for a bigger target, chances would change drastically. But most important - there are no known numbers at all, just like no known method to calculate them. That's what can be said about vanilla accuracy.

What does "extender accuracy" do?
0. It takes vanilla accuracy
1. reduces it beyond some distance threshold, on per-tile basis
2. reduces it for close-range shots for weapon with "minimal distance" threshold (I don't know any btw)
3. shows resulting accuracy near the cursor in real-time
But number, by itself, still means nothing...

So, missing 12 times in a row with 140% shots is a resulf of vanilla accuracy algorithm. You can change the numbers, it's clear that 140% will hit more often than 100%, and 300% - even more. But what exactly those numbers mean, in the first place? In real life, there's 0% which means "absolutely never" and 100% which means "absolutely every time". You can increase those numbers, but you can't balance them in a meaningful way, like "I want it to hit 50% of the time" in mind. That's why I started to make my own accuracy system, in the first place.

About "bullets fly through the sprite" - the game doesn't use sprites for collision detection. It uses voxel 3D cylinders, representing units. You can press F10 in game and then look in savegame folder how it all looks from your unit's eyes perspective. There are no known bugs when your shot fly through the unit but not detected as hit. You can say from the pictures, that for aimed shot the target is 100% exposed - because line of fire is calculating from the eyes level for aimed shots (in my mod). There's 80% exposure for auto-shot, as it's calculated from waist / chest level, and bottom part of the target becomes hidden.

Don't get me wrong, your accuracy modification improves close-range shooting too well. And that's why I think it affects the balance (had it checked, too, vs plasma autofire enemies, and I thing there should be misses in the queue. Literally all plasma shots hit my soldier and I was upset. That's not what I got used to!). There's not only mechanical issues why things miss (aside from weird voxel issues) - each turn in X-COM is similar to 6-8 seconds in real life. Thus, hand tremor can justify three misses with 60% hit chance. Or four with 70%, rarely. But not twelve with 140%).
Close-range accuracy could be changed, for sure. I just can't figure out the exact formula... I can add "maximum accuracy cap for close-ranged shots" to the options menu, but I don't personally like that idea. And I can't reproduce vanilla chance to hit, as there are no option to know that chance other then statistical experiments )) But I can say for sure, that chance has nothing to do with displayed accuracy, and always was much higher than it.

Other than that... I can't make a mod, which would be balanced against all other mods. I totally don't want it to be balanced against one particular mod either. All it has to do is to show CORRECT accuracy numbers which align with real chance to hit. If there's 1% then it should hit 1 time of 100, but not in a way "I counted 99 misses, the next one should be a hit". And I'm afraid I can do nothing to make it align with, I'd say, such STRANGELY balanced mod as X-Piratez.

Look at pictures, look at the formula and try to guess how that thing is supposed to miss
https://www.ufopaedia.org/index.php/Accuracy_formula

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #354 on: September 28, 2023, 01:52:42 pm »
weird stuff, like missing all twelve 140% shots, because bullets fly through the sprite, but don't hit the actual voxels, got solved? This mostly happens when enemy is either near the wall (while your soldier shoots from parallel position to it), or near the border of the map, or behind the opened door, or behind a stick pinned into the ground and so on.
Maybe vanilla accuracy algorithm has some corner cases, which become visible in X-Piratez cause the game wasn’t designed for such extreme numbers

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #355 on: September 28, 2023, 01:53:25 pm »
There are no known bugs when your shot fly through the unit but not detected as hit.

Actually, there is, and when real accuracy is off, and extender is on, I simultaneously see the cases when supposed 100% shots miss and projectiles fly through the sprite, not hitting the voxel itself. I just don't have savegame, because I never thought I will address these issues. Nevertheless, your mod makes this particular shot actually hit, thus the problem is solved.

As for the balance - if there's indeed no clue of how close-range shots affected by extender accuracy, may we talk with the designer of this? You see, it's kind of magic and fits game very well.
I'll bring you the case:
You have auto-fire sniper rifle, which has reduced hitchances for any tile closer than 10. At 10 tiles away it gives you 100% vanilla hitchance (which magically won't hit 100 out of 100 shots, but that's cool, too), but 0% at 2 tiles away.
Still, due to extender accuracy, you will likely hit at least 1 time in a queue of 3 shots, but also it may be 2 times or even 3.
I can only guess, that it somehow creates cone of possible trajectories, and the more precise the shooter, the narrower the cone is.
It's not like it will shoot somewhere 45 degrees from a target, right? Soldier with accuracy 120 should shot with little deviation from LoS (line of sight), but still can miss because target is too far away and it's actual contact surface is too small.

The question: what actual mechanics are, both in your mod and extender?
Is it cone mechanics, or just pure formula-based pre-hits (mean, system rolls 1 hit out of 10 and then forcefully pulls 9 hits to the random tiles around the target?)
     
And, one suggestion for your accuracy mod:
If it checks several points of shooting before deciding which fits best, shouldn't this also affect accuracy? You see, if straight/ out-of-the-waist  shot is considered worst, then the obstacle is on the way. If then weapon shifted to a side, such action must have penalty of decreased accuracy. My suggestion is 1/4 decrease of the final value.
Same to melee. I've noticed from the game that if target stays in front of the door, it sometimes can be attacked from adjacent tiles, and vice versa. These hits shouldn't be of same accuracy to the straight attack, because target has natural cover and has lesser area to evade/parry from. I guess, final chance attack success rate should be, at least, halved.
I would also suggest that shifting the hand should affect the chances, if not complicated to implement.
     
« Last Edit: September 28, 2023, 01:57:51 pm by Abyss »

Offline Abyss

  • Colonel
  • ****
  • Posts: 355
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #356 on: September 28, 2023, 02:13:24 pm »
Other than that... I can't make a mod, which would be balanced against all other mods. I totally don't want it to be balanced against one particular mod either. All it has to do is to show CORRECT accuracy numbers which align with real chance to hit. If there's 1% then it should hit 1 time of 100, but not in a way "I counted 99 misses, the next one should be a hit". And I'm afraid I can do nothing to make it align with, I'd say, such STRANGELY balanced mod as X-Piratez.
I assure you that in 99,5% cases both BAI and your mod will be used in mods.
And, most likely, statistically, 50% cases will be that it is used by Piratez player, 20% in XCF and Wh40K, and 9,5% rest. I guess, only tiny part of the players play vanilla X-COM in OXCE.
Nothing is balanced to the perfection. This particular autogun from my save is PSI-powered and considered OP by many players + soldier has weird high stats too. But that's due to excess of battles and battle commendations.

Initially, request was about weird voxel issues. One example is if enemy stands adjacent the wall, and is target for a shooter that stands parallel this wall, this wall somehow affects shooting chances, which makes no sense to me, but still is.

I will get the savegame as soon as I will find this behavior once again.

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #357 on: September 28, 2023, 04:25:33 pm »
Actually, there is, and when real accuracy is off, and extender is on, I simultaneously see the cases when supposed 100% shots miss and projectiles fly through the sprite, not hitting the voxel itself.   
As I've said, "projectiles fly through the sprite" doesn't mean anything. Sprites don't represent voxels. Unit is just a cylinder in voxel-space. Grab some paper and pen, draw a rectangle with width=5 and height=16. That's sectoid proportions from the base game. Width=5 means that his "diameter" is 1/3 of a tile width, or he takes 1/9 of tile's area. Than look at his sprite, with huge head. Shot WILL fly through and that's not a bug.

As for the balance - if there's indeed no clue of how close-range shots affected by extender accuracy, may we talk with the designer of this? You see, it's kind of magic and fits game very well.
As I've said earlier, extender accuracy almost does NOTHING. You can look at the picture, I highlighted the block where "ufo extender accuracy" actually applies. As you can tell, there's a drop-off for accuracy below the weapon minimum distance, and above the maximum one. And that's in VANILLA code. Extender accuracy just adds different maximum distances for auto/snap shots. That's all. Another place where it matters - in drawTerrain() code, 'cause there should be a way for a player to see how the accuracy changes for different tiles - so it draws modified accuracy near the cursor.

The question: what actual mechanics are, both in your mod and extender?
Is it cone mechanics, or just pure formula-based pre-hits (mean, system rolls 1 hit out of 10 and then forcefully pulls 9 hits to the random tiles around the target?)
In vanilla(extender doesn't affect anything here) it's cone based, in a wierd way. All the code is on second picture. You can tell by yourself, that while it's obvious where and how accuracy is used in calculation - there's NOTHING you can tell about actual chance to hit. That code gives unnatural kind of distribution, where you either hit the squirrel right to the eye from 10 km away, or you go full startrooper mode hitting any point of the cone with (almost) similar probability. That's why misses in x-com are so unnatural. On this gif you can seen probabilities distribution for 0/25/50/75% accuracy: https://www.ufopaedia.org/images/1/16/Accuracy_areas_above.gif

On the cortrary, my mod takes vanilla/extender accuracy numbers and makes them real chance to hit, by rolling. So you get the roll with precise probability first, and then, if it misses - my code calculates some missing trajectory, which should look realistic. That don't work with vanilla accuracy NUMBER in close-combat, as it's totally unrelated to vanilla chance to hit in close-combat, which is much higher than displayed. So I had to make my own algorithm to increase close-range accuracy.

While I'm writing all this, a realised a good way of capping close-range accuracy - by unit's own accuracy! Min cap could be 50%, and max cap will depend on unit. I'll definitely will try that out!

And, one suggestion for your accuracy mod:
If it checks several points of shooting before deciding which fits best, shouldn't this also affect accuracy?
3D in this game is implemented with very low resolution, that means there's often one huge occassional voxel blocking LoS/LoF. To counter that, off-center shooting was added. There's no need to add penalty, as well as balance accuracy with such detail in such low-detail game. There's always something to be done elsewhere, to a greater benefit.
« Last Edit: September 28, 2023, 04:40:34 pm by jnarical »

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile

Offline jnarical

  • Captain
  • ***
  • Posts: 78
    • View Profile
Re: [SOURCEMOD] Brutal-OXCE 7.6.7
« Reply #359 on: September 28, 2023, 05:37:00 pm »
weird stuff, like missing all twelve 140% shots
I've just tested in "default OXCE", it hits 10/10 there. I've got a regression somewhere, investigating...

upd: found bug, fixed, now testing...

upd2: uploaded the fix, seems working
« Last Edit: September 28, 2023, 09:41:49 pm by jnarical »