OpenXcom Forum

Contributions => Programming => Topic started by: volutar on March 02, 2015, 07:59:40 pm

Title: Aiming algorithm
Post by: volutar on March 02, 2015, 07:59:40 pm
I know it's internal thing, but I still want to share my thoughts about aiming algorithms used in OpenXcom.

As I remember, initially (when Daiky started Battlescape) OXC was using simplest method of choosing the voxel to hit. It was either the middle of unit, or 3/4 of the height (to target the chest/head). Just two points. Yeah, that simple.

Then I changed that, made something vanilla alike, but with more precise height scanning (in vanilla it's 4 different height levels, and I made it scan each 2nd voxel). For each height level, starting with the middle, it tries 5 different inner voxels - central, and 4 at each side (depending on unit width, at the north, west, south, and east side).

After that I thought that I might scan unit more "optimized" way, using trigonometry, and turning target "plane" facing towards the shooter. So I had to check only 3 voxels instead of 5, for each level (plus top and bottom).
And it's how it works right now, pretty optimized, imposter-like shooter-aligned plane.

But in fact, it heavily suffers from the "obstacle" factor. In short - it always choses the available target voxel closer to the center of the unit. Even if it's next to wall or fence. So it often happens, that shown chances (which might be even 110%) doesn't reflect the reality, just because there are chances to deviate 1 pixel aside, and it will hit obstacle.

(https://volutar.eu5.org/fpslook_aim.png)

Target at the right will be hit with much more chances than target at the left, inspite of exactly the same distance. Because of obstacle issue. Random deviation is shown with highlighted ellipse. Without any obstacles it would be 100% chances to hit. But in fact, it will be 80% for the target at the right, and just around 30% for the target at the left.
It often happens when target is above and you're shooting and hitting the roof tile (which is obviously almost impossible, because you see only 1 voxel of the roof, being at the ground level), or targets at the corners. Sounds familiar?

I want to change that. I'm experimenting with aiming algorithm which gonna target the most visible part, not just the center.

Here are 3 different scenarios, blue is an obstacle or "miss", number is an aiming weight value. The more the number, the more chances this target voxel has when aiming.
First two are from the example above, and the third is "target behind the fence" (which is also often the case).

(https://volutar.eu5.org/aim_weights2.png)

With these changes made, you hardly would be able to hide over the corner or behind the gear. Neither aliens. So battles will become slightly more brutal, and quicker. But hey, isn't this "dumb miss" the thing you always wanted to get rid of, and was often pissed off about?
Title: Re: Aiming algorithm
Post by: Yankes on March 02, 2015, 08:13:33 pm
I think this is too "precise", something like that should be reserved only for aim shot, not snapshot or auto that are done in general direction of enemy.
Title: Re: Aiming algorithm
Post by: volutar on March 02, 2015, 08:16:59 pm
Snap and auto are already having low accuracy, so it doesn't matter which voxel is the target. It will mostly affect the aim.
Title: Re: Aiming algorithm
Post by: Arthanor on March 02, 2015, 11:52:59 pm
Cover is a difficult thing in XCom.

I think aiming for the "largest visible part" makes sense. Really you wouldn't aim for "just above a low wall" simply because the chest of your target is behind said wall.

That being said, in the example you gave above, I would tend to say that the guy hiding behind the stairs should be hit less often than the more visible one. It is a more difficult shot because the target area is smaller. Nothing to do with distance.

This makes me feel like both the placement of the "aimed point" (the "+" you drew) and the size of the hit zone are wrong. The "+" should indeed be at the center of the visible target, but the hit zone could afford to be larger so that being behind cover does benefit you.

In this case, a well positioned "+" would mean the left target has parts of its "hit zone" off target and parts obstructed by the stairs, whereas for the right one it would mostly/all be on target.

The "hit %" would then become something more akin to "% to hit a target at that distance without cover". If you really want to get into it, calculate the actual % to hit (% for the shot to be in the hit zone times % of the hit zone that is on target) and display that like the UFO extender accuracy %.

Moving your cursor about would show the odds of hitting something outside cover at that distance. Putting the cursor on a target without cover would display the same number. However, if the target has cover, the % would drop to represent how hard a shot it is depending of how much of the target is in cover. It would then open up a game of placement where you try to flank aliens in cover to get better shots at them.

Otherwise, I think the aiming should be for the chest, relatively large hit zone that will overlap cover. Complicating the game in order to ignore cover and simplify gameplay by making each shot at a given distance land with the same chance would remove a tactical element, which would be a lot or work for a sad outcome.
Title: Re: Aiming algorithm
Post by: hellrazor on March 02, 2015, 11:54:30 pm
Snap and auto are already having low accuracy, so it doesn't matter which voxel is the target. It will mostly affect the aim.

I can not concur, since i love hiding behind the gear :)
Title: Re: Aiming algorithm
Post by: kikimoristan on March 03, 2015, 01:10:00 am
i'm with volutar on this one. i think is fair to assume when you aim at something you aim at the visible component and not just the center.

you could make it so firing accuracy of the unit can affect this deviation  69 or under is regular game mechanic 70 and over is volutar's mechanic. so not everyone shoots perfectly.
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 05:23:44 am
Arthanor,
why do you think I'm worried about the numbers at the UfoExtender cursor? Frankly I don't give a shit about it (I'm not a fan of this mod). I've started this because of initially bad aiming algorithms.
You've mentioned "tactical elements". I'm naming them "exploiting algorithm/AI flaws". As with dropping weapon with MCed alien, and be 100% sure it will never pick it up.

Really bad reference for the tactics.
Title: Re: Aiming algorithm
Post by: kikimoristan on March 03, 2015, 05:46:18 am
also little things like these  work both ways. yes they protect you guys  but when you see some alien and try to shoot it the stairs blocked your shot and next turn alien shoots stairs don't block it's shot cause of the way the aiming works all your guys die and you're like...VOLUTAR change this bitch before i smash something. ahahahaha ...im kidding btw. is just LOF is smart system but is not perfect. volutar is saying he can optimize it to be better a bit more intuitive or predictable.

original game has this annoying and hilarious common situation you see the guy but can't shoot. but what if you can shot but always miss (or mostly miss) due to the way aiming works. that's not good either.
Title: Re: Aiming algorithm
Post by: vlad on March 03, 2015, 07:06:25 am
Its reasonable to believe that alien or operative is aiming at the area that can provide best hit ratio. It wont make the obstacle hiding obsolete, it will make it more difficult to find suitable one.
But i am little worried what that means on higher levels of difficulty and gameplay wise. There is already a lot of smoke screen usage, would that make players consider minimal movement or bringing artificial walls ?
Title: Re: Aiming algorithm
Post by: kikimoristan on March 03, 2015, 07:18:21 am
honestly on higher difficulty + on ufo defense/tftd those LOF "anomalies" are NOT cover because they don't have an objective calculable cover reduction mechanic. they are just side effects of using LOF. cover is simply run out hit and run back . 

then again these anomalies kinda function like cover by reducing hit percentage. but the reduction is not predictable.

the problem is i know fences and stairs and windows and doors with windows or things with holes in them or things that bend  do this but how much cover or hit percent reduction they provide is completely random magic nonsense.
Title: Re: Aiming algorithm
Post by: hellrazor on March 03, 2015, 08:29:10 am
original game has this annoying and hilarious common situation you see the guy but can't shoot. but what if you can shot but always miss (or mostly miss) due to the way aiming works. that's not good either.

Uhhh i just pounded a muton standing in front of a UFO Door, outside the ship with Plasma Rifle Snapshot fire from 6 Soldiers (all +70 Aim), who were kneeling at the upper edge of a hill and NOT even one of them scored a hit. If they moved up the hill completly (so they are on level 2 instead of 1), they can shoot and hit. I even tried aimed shoot all failed, guess this was such a case.
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 10:06:52 am
Just to recap about accuracy number from menu or UfoExtender cursor.

This value has nothing with actual hit chance. It's just accuracy, "abstract" value, showing how many %% of bullets will go straight to the target voxel (which can be too close to obstacles, but still opened).

To find actual hit chance, you have to trace thousands of actual bullets, considering all the envronment. Tho it is technically possible, it's highly unnecessary.
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 10:15:28 am
original game has this annoying and hilarious common situation you see the guy but can't shoot. but what if you can shot but always miss (or mostly miss) due to the way aiming works. that's not good either.
It's inherent logic of geometry. You see units from level of eyes, you fire  units from level of shoulders. It it wouldn't show you "no line of fire" and allow you to fire, there are 146% of chances to hit some obstacle. That's that.
Title: Re: Aiming algorithm
Post by: kikimoristan on March 03, 2015, 10:21:36 am
aimed shots should fire from level of eyes..auto and snap should fire from level of shoulders.. and the focus point  should always be the center of most exposed part of the thing firing at
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 10:42:21 am
aimed shots should fire from level of eyes
I also thought of that thing since I joined OpenXcom. But this origination point is not something to be changed that easily. It needs of deep and thorough estimating of consequences. Having no "no line of fire" for AIM shot at all pretty changes the game feeling.
Title: Re: Aiming algorithm
Post by: kkmic on March 03, 2015, 03:55:01 pm
How about targeting the center of the largest visible area but having a hit % chance equal to the % of visible target area.

That means that being in cover is way better than being in the open.




I hope I worded this right
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 04:23:56 pm
What for? Random spread already making miss working that way.
Title: Re: Aiming algorithm
Post by: robin on March 03, 2015, 04:43:08 pm
I think the main problem with altering this aspect pf the game, is that.. more things are involved in the overall final perceived behavior, and all these things are "compromises". For example the voxel aliases of items/creatures: a humanoid shape is a cylinder, a big chicken (sectopod) is a cylinder, many tiles (especially new ones, since you have to use the same shapes) are "seemingly random half-floating kind-of-boxes". So you make one single aspect "less of a compromise" but the rest remains the same, with the result that it won't amalgamate as well as before. Like in this case the new proposed aiming is going to make lots of half-covers useless (more noticeably against aimed shots, as far as I understood your explanation), in exchange of reliable aiming in some situations: not a trade I would like.

Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 04:47:01 pm
Like in this case the new proposed aiming is going to make lots of half-covers useless (more noticeably against aimed shots, as far as I understood your explanation), in exchange of reliable aiming in some situations: not a trade I would like.
If you're making aiming shot with 110% of accuracy, you will actually have less than 50% chance. Is it fair?
Title: Re: Aiming algorithm
Post by: robin on March 03, 2015, 05:37:19 pm
If you're making aiming shot with 110% of accuracy, you will actually have less than 50% chance. Is it fair?
But with half-covers turned useless, is the change an overall improvement?

Also "fair"... As I said: it is (or looks like, to me) all a big compromise. It can also be considered "fair" too: 110% can be interpreted as "chance to hit an uncovered target", and a significant reduction can be expected if half the target is behind cover. This is to me more natural and, more importantly, fun, than having the half-cover doing near to nothing.

Each of us has his own idea about these things; for example ranged accuracy: some find it a must, others -myself included- don't like it at all. Vanilla is the base we can all understand and accept. So if you decide to make the change, I think the option to use vanilla-ish "dumb" aiming should be included.
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 05:42:41 pm
But with half-covers turned useless, is the change an overall improvement?
Not useless, they just stop being exploits vs costy aim. And stay the same for snap and auto.

And it's not a compromise, it's more vanilla than current OpenXcom way. Vanilla got only 3x4 grid - just 12 target points, so in most of cases the target voxel was at least 1 voxel away from the obstacle, and AIM was hitting the target. In OpenXcom we have a grid 3x10, with really precise vertical, which OFTEN choses the voxel at the edge of obstacle, which instantly lessen chances by 50% for AIM.

But this 3x4 low-precision grid has this "aiming" benifit comparing to current OXC way as a side effect, not intentionally, not controlled. It must be controlled, and logical.
Title: Re: Aiming algorithm
Post by: Arthanor on March 03, 2015, 06:54:25 pm
Arthanor,
why do you think I'm worried about the numbers at the UfoExtender cursor? Frankly I don't give a shit about it (I'm not a fan of this mod). I've started this because of initially bad aiming algorithms.
You've mentioned "tactical elements". I'm naming them "exploiting algorithm/AI flaws". As with dropping weapon with MCed alien, and be 100% sure it will never pick it up.

Really bad reference for the tactics.

Sitting behind a low wall/fence/staircase/chair/corner is not "exploiting algorith/AI flaws" it is using cover. Making use of cover is one of the most basic tactic. You don't stand in the open. Of course, if you can, you get out of sight, but a game that is strictly about line of sight and exploiting smoke is less interesting than one where you can duck behind a wall and be harder to hit.

This situation can all be summarized in a few simple questions:

My answers are:
- Yes, obviously.
- No, obviously.
- No, obviously but that's what both vanilla XCom and OpenXCom do.

How can that be fixed? There are two ways:
1 - Make cover essentially irrelevant so that the constant % displayed is accurate no matter what cover the target is in (Your solution, since you would pretty much only hit cover on a miss).
2 - Show a different number if the target is in cover.

Where would you show that different number? On the cursor like Extender Accuracy. I am using the % displayed by the extender accuracy as an example of placement. I couldn't care less whether you like that mod or not, use it or not, or whatever. It is a way to tell you where I think the % should be displayed as part of the suggestion I am making for an alternate solution. Besides the % being displayed at the same place, what I am suggesting has nothing to do with Extender Accuracy (and works with both vanilla and Extender Accuracy schemes).

I fully agree with those saying that the vanilla XCom system is a finely tuned compromise made out of a series of approximation to reach a desired effect. Changing one of these approximations (even if to make it better) changes the outcome.

In this case, changing the way aiming is done to make it more intelligent means an overall reduced effect of cover, which isn't a good thing in a tactical game. Hiding behind obstacles should matter. An aiming algorithm where "properly aimed shots" are as likely to hit a full bodied target in the open as to hit their toes sticking out from behind cover dumbs the game down. Vanilla XCom represents cover by making "shots on target" sometimes hit cover. If we take that out, this new XCom needs another way to represent cover.

The ideal situation would be to change the way aiming is done and change the way cover is handled in order to maintain the vanilla balance (and relevance of cover) while also improving the information provided to the user. If you don't want to tackle both aiming and cover to maintain the balance, I would rather you don't touch either.

What's left is that the information provided to the player could still be improved by showing a different number when the target is in cover (multiply the accuracy % by the proportion of the target area that is obstructed by cover). The aiming & cover mechanics don't change, but with the new info they also no longer deceive the player.

I don't think a change that makes cover even less relevant is a good thing for the game. To me, LoS tricks (step forward, spot, step outside of LoS range, fire from safety), especially dancing in the smoke, are much more akin to exploits than kneeling behind a wall to get cover. These LoS tricks should not be reinforced further as the primary way to preserve your soldiers.
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 08:45:26 pm
Arthanor, I already told you, I don't care abount numbers, they has nothing with hit chance, and let them be. They simply don't affect anything.
Did you even read what's written next?
Yes, AIM mode is stands for AIMed shots, even aiming your sticking toes, if they got bad luck. It's how precise sniping works.
And currently it works noticeable WORSE than in vanilla, it hits obstacles 2 times more often for aimed shots.. Oh god. Do I really need to repeat myself??
Title: Re: Aiming algorithm
Post by: robin on March 03, 2015, 09:12:06 pm
Not useless, they just stop being exploits vs costy aim. And stay the same for snap and auto.

And it's not a compromise, it's more vanilla than current OpenXcom way. Vanilla got only 3x4 grid - just 12 target points, so in most of cases the target voxel was at least 1 voxel away from the obstacle, and AIM was hitting the target. In OpenXcom we have a grid 3x10, with really precise vertical, which OFTEN choses the voxel at the edge of obstacle, which instantly lessen chances by 50% for AIM.

But this 3x4 low-precision grid has this "aiming" benifit comparing to current OXC way as a side effect, not intentionally, not controlled. It must be controlled, and logical.
The 3x4 grid seems a more sensible solution than both the current and the proposed one: it ease the problem of the first (selecting voxel just above cover edge thus butchering effective accuracy), without the alteration of gameplay of the second (quoting you directly:
you hardly would be able to hide over the corner or behind the gear [...] So battles will become slightly more brutal, and quicker.
).
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 09:15:22 pm
The 3x4 grid seems a more sensible solution than both the current and the proposed one: it ease the problem of the first (selecting voxel just above cover edge thus butchering effective accuracy), without the alteration of gameplay of the second (quoting you directly:).
No it's not. Because you will get "no line of fire" 3 times more often. Inspite of seeing unit and having direct line of fire.
And if there will be line of fire, you will not miss. So it will be same as I quoted + extra no line of fires.

The only sensible solution is to deal with what I proposed.

You guys are really weird, prefer to stick to flawy solution #1 (no line of fire) or flawy solution #2 (hitting obstacles even with aimed shots). It' s like you love bugs and ugliness. Do you really like to be ashamed?
Title: Re: Aiming algorithm
Post by: robin on March 03, 2015, 09:43:33 pm
No it's not. Because you will get "no line of fire" 3 times more often. Inspite of seeing unit and having direct line of fire.
And if there will be line of fire, you will not miss. So it will be same as I quoted + extra no line of fires.

The only sensible solution is to deal with what I proposed.

You guys are really weird, prefer to stick to flawy solution #1 (no line of fire) or flawy solution #2 (hitting obstacles even with aimed shots). It' s like you love bugs and ugliness. Do you really like to be ashamed?
Then this should have been locked, with "deal with it" written from the start.

In the first of your three scenarios, to me it makes no sense that the cover doesn't count at all (provided I'm interpreting the picture correctly, all the blue voxels have "0" weight), even if it's an aimed shot. This is not making partial covers not exploitable, but it's making them useless. I don't care about ugliness.


Title: Re: Aiming algorithm
Post by: kikimoristan on March 03, 2015, 09:45:21 pm
volutar's idea should be used at least for aimed shot in order to make it more accurate over snap/auto.
Title: Re: Aiming algorithm
Post by: Arthanor on March 03, 2015, 09:54:49 pm
You are such a gentle debater volutar.. respectful and all...

What we want is a tactical game in which cover is relevant (yes, even against aimed shot because it should be more difficult to hit a partially obscured target). The actual mechanic that achieves best that is up for debate.

I did read everything you wrote and in fact I even support your proposition of improving the algorithm to choose a target.

The problem is that, unlike you, we feel that all shots (aimed shots included) should still suffer from cover on targets. Weapons in XCom are not scoped sniper rifles but assault rifles, pistols and whatever a heavy laser/plasma/cannon is supposed to be. They should not have the accuracy to pick toes as reliably as whole bodies. Especially since there is no effect of hit location on damage, so you can essentially be "headshot" (= high damage) in the toes (because that was the visible area).

Center the target voxel better, but make your target area (highlighted ellipse) larger so cover still has some effect and that sounds like a great solution. Change the size of the highlighted ellipse with the shot type for bonus points.

You can't rely on "near misses" that hit obstacles to represent the effect of cover because those are much too rare compared to hits + all  the other misses.

@tollworkout: Aimed shot are already more accurate..? Changing the size of the target area (the highlighted ellipse in volutar's 1st post) would make more sense than changing the placement which should always be for center of visible area.
Title: Re: Aiming algorithm
Post by: volutar on March 03, 2015, 09:58:19 pm
In the first of your three scenarios, to me it makes no sense that the cover doesn't count at all (provided I'm interpreting the picture correctly, all the blue voxels have "0" weight), even if it's an aimed shot. This is not making partial covers not exploitable, but it's making them useless. I don't care about ugliness.
Partial covers shouldn't matter as much for aim as for snap. Scenarios showing the best aimed voxel, not the cloud itself. And cloud of probability is much bigger than this grid. Partial covers doesn't matter that much in vanilla.

Oh god. Who am I talking to... Did you even see vanilla algorithms and hit/miss statistics? Why are you people pushing me towards hating you?
Title: Re: Aiming algorithm
Post by: robin on March 04, 2015, 11:00:29 am
Hum I don't understand anymore, but: I find out that I don't like how it changes things, can I eventually make a fork to have an OpenXcom build that exclude this specific change?
Title: Re: Aiming algorithm
Post by: volutar on March 04, 2015, 11:52:25 am
robin,
- start vanilla game.
- get to the situation with target behind the cover.
- make a save.
- make at least 50 trials of aim shots to find the actual vanilla hit chance.
- copy saves to openxcom. enabke save scumming.
- use import vanilla save and test 50 trials.
- compare results.

you will be surprised how oxc far from vanilla. i'm just making hit ratio adjusted to vanilla 
Title: Re: Aiming algorithm
Post by: hellrazor on March 04, 2015, 12:07:27 pm
It should be logical that a unit shooting on another unit should target the visible part of it.
This means if the target is in the open priority targer area woukd usually be the chest or head.
if the unit is in cover, but visible partially, aiming should be centered on the visible parts.
This only changes the aiming focus of a shot on the visible parts of the enemy.

Since aiming at a enemy (and priorize visible parts), then shooting and actually hitting it, are two different things. Shooting the enemy will trigger the normal chance to hit calculation, but its aiming focus is now on the visible parts of the enemy and not the probably not visible center of the unit.

Result would be less "no line of fire" errors.
This does not effect your chance to hit, your shot could still stray and hit the enemys covers destroy it or miss completly.
Would this be what you wanted to explain to them volutar?
Title: Re: Aiming algorithm
Post by: volutar on March 04, 2015, 12:36:52 pm
no line of fire is already ok.
the matter is hitting target with chances almost 2 times less than vanilla (roof case).
in 90% of cases when you're using snap and auto it will cause almost same result. in case of aim shot it wont cause too much of ridiculous misses due to obstacles, which are OpenXcom specific and not common for vanilla.
Title: Re: Aiming algorithm
Post by: hellrazor on March 04, 2015, 12:50:12 pm
no line of fire is already ok.
the matter is hitting target with chances almost 2 times less than vanilla (roof case).
in 90% of cases when  you're using snap and auto it will cause almost same result. in case of aim shot it wont cause too much of ridiculous misses due to obstacles, which are OpenXcom specific and not common for vanilla.

Enemy on the roof of a building i guess you mean. And yes if there is a way tomake this more vanila like do it.
Title: Re: Aiming algorithm
Post by: Arthanor on March 04, 2015, 04:05:34 pm
You know what, I have agreed with this change from the beginning, with one caveat. Getting that caveat across must be too complicated. And OXC's aim at being vanilla (which I very much like, don't misread me) probably interferes with my intereset in cover any ways.

To take a last shot at it (HA!):
This does not effect your chance to hit, your shot could still stray and hit the enemys covers destroy it or miss completly.

The problem is that a "stray shot" hitting cover is not a great way to represent cover. Turning a miss into a miss is really not changing anything.

The % of shots that are "stray shot that happen to hit target" and could then be affected by the target being behind cover is such a minimal fraction of total shots that it's not really work speaking about. Say you have 70% to hit, probably 28% to hit anywhere but the target on a miss, so 2% "stray shots" on target, 1% shots blocked by cover from being half obscured. So being in half cover gives you a 1% extra chance of not being hit? Cover is irrelevant.

The current situation has bad target placement which results in obstacles taking away hits. It makes cover more relevant because now cover takes away from hits. (missing half of the 70% of hits as above is a significant gain in survivability for being in half cover!)

Before anyone explodes: Yes, I agree, it is a bad mechanic that creates stupid situations probably more often than good ones. The problem (for some of us) is that fixing it reduces the value of cover unless something else is done to compensate. But it seems like vanilla has no cover either, so the outcome is clear: OpenXCom is like vanilla, aiming should be like volutar proposed and we won't be playing with cover (something I find sad in a tactical game, but that's how XCom is).
Title: Re: Aiming algorithm
Post by: hellrazor on March 06, 2015, 01:59:16 pm
The problem is that a "stray shot" hitting cover is not a great way to represent cover. Turning a miss into a miss is really not changing anything.
It is a wonderful way to represent cover. It even has some catch of reality to it.
The % of shots that are "stray shot that happen to hit target" and could then be affected by the target being behind cover is such a minimal fraction of total shots that it's not really work speaking about. Say you have 70% to hit, probably 28% to hit anywhere but the target on a miss, so 2% "stray shots" on target, 1% shots blocked by cover from being half obscured. So being in half cover gives you a 1% extra chance of not being hit? Cover is irrelevant.
It is not. Cover has one main function it limits visibility (either completly or partially) the area on which you can be hit is smaller if you are behind cover (because the cover is in the line of fire and would be hit first).

The current situation has bad target placement which results in obstacles taking away hits.

Why? obviously this needs adjustment, but wouldn't make cover obsolete.

It makes cover more relevant because now cover takes away from hits. (missing half of the 70% of hits as above is a significant gain in survivability for being in half cover!)
Cover is in the line of fire so it will be hit anyway. Were is your fucking Problem?

Before anyone explodes: Yes, I agree, it is a bad mechanic that creates stupid situations probably more often than good ones. The problem (for some of us) is that fixing it reduces the value of cover unless something else is done to compensate. But it seems like vanilla has no cover either, so the outcome is clear: OpenXCom is like vanilla, aiming should be like volutar proposed and we won't be playing with cover (something I find sad in a tactical game, but that's how XCom is).

We always played with cover, i guess you didn't grasped how it works even in vanilla.
Title: Re: Aiming algorithm
Post by: volutar on March 06, 2015, 05:34:56 pm
Uh.. There's no "Cover concept" in Gollops' x-com universe. There was cover concept in Laser Squad, but not later. Solomon's x-com made cover concept into account and made it one of key features. It makes whole tactics totally different.
X-Com is not about covering and avoiding shots by some ruse. Aliens can't even kneel. It's about suffering and getting shots in the head even through 2 windows (not quite a real life situation). Adding gamey feature from xcom2012 heavily alters xcom tactics. Though it is possible to make "cover" concept (decreasing hit ratio by obstruction percentage), but it have to be _optional_, not default.
But before making it optional, this targeting should be at least taken under control, while currently it's just "how it goes", and not really vanillish. Which apparently is not good.
Title: Re: Aiming algorithm
Post by: kikimoristan on March 06, 2015, 06:39:09 pm
Uh.. There's no "Cover concept" in Gollops' x-com universe. There was cover concept in Laser Squad, but not later. Solomon's x-com made cover concept into account and made it one of key features. It makes whole tactics totally different.
X-Com is not about covering and avoiding shots by some ruse. Aliens can't even kneel. It's about suffering and getting shots in the head even through 2 windows (not quite a real life situation). Adding gamey feature from xcom2012 heavily alters xcom tactics. Though it is possible to make "cover" concept (decreasing hit ratio by obstruction percentage), but it have to be _optional_, not default.
But before making it optional, this targeting should be at least taken under control, while currently it's just "how it goes", and not really vanillish. Which apparently is not good.

i kinda like the idea of reducing damage based on cover %  optional advanced setting . how would you implement that?

instead of making firing more accurate you make the opposite...firing goes trough tranasparent cover with reduced damage if is a sure shot ???
Title: Re: Aiming algorithm
Post by: hellrazor on March 06, 2015, 07:39:20 pm
Uh.. There's no "Cover concept" in Gollops' x-com universe. There was cover concept in Laser Squad, but not later. Solomon's x-com made cover concept into account and made it one of key features. It makes whole tactics totally different.
X-Com is not about covering and avoiding shots by some ruse. Aliens can't even kneel. It's about suffering and getting shots in the head even through 2 windows (not quite a real life situation). Adding gamey feature from xcom2012 heavily alters xcom tactics. Though it is possible to make "cover" concept (decreasing hit ratio by obstruction percentage), but it have to be _optional_, not default.
But before making it optional, this targeting should be at least taken under control, while currently it's just "how it goes", and not really vanillish. Which apparently is not good.

So there was not really an intregration of it but the battlescape mechanics provided us with something like it. That's at least my understanding.
Title: Re: Aiming algorithm
Post by: volutar on March 06, 2015, 07:50:21 pm
i kinda like the idea of reducing damage based on cover %  optional advanced setting . how would you implement that?
No. It's about lowering chances to hit. Damage reduction is not the subject.
Title: Re: Aiming algorithm
Post by: kikimoristan on March 06, 2015, 07:56:58 pm
sorry yes. you're right. lowering chances to hit. rather than using magic where it hits or it doesn't hit cause of aiming how about if anything is partially visible shot always hits but at a reduced % based on how much is visible or something like that. optional advanced setting!

so i guess you can hit targets behind walls as well, on rooves(roofs), behind windows or other portholes etc. if target is 0% visible then this is not applied.
Title: Re: Aiming algorithm
Post by: Arthanor on March 07, 2015, 06:10:59 pm
It is a wonderful way to represent cover. It even has some catch of reality to it.It is not. Cover has one main function it limits visibility (either completly or partially) the area on which you can be hit is smaller if you are behind cover (because the cover is in the line of fire and would be hit first).

Why? obviously this needs adjustment, but wouldn't make cover obsolete.
Cover is in the line of fire so it will be hit anyway. Were is your fucking Problem?

We always played with cover, i guess you didn't grasped how it works even in vanilla.
Since you replied in such a heated way...

I don't think you understood what I am speaking of. Volutar described a situation where, with his fix, a unit mostly obstructed and one that is mostly visible will be hit with the same likelihood because of proper placement of the target and a small deviation of hits which does not overlap with the obstacle.

Prior to his fix, the obstructed unit would be hit less than the mostly unobstructed one, but for the wrong reason: The target was not properly placed. This is cover by obstacle in the line of fire because the line of fire is not well placed. With the fix, as volutar said: You won't be able to hide behind gear or around corners. There is now less cover by obstacle in line of fire, because the line of fire is placed properly and intersects more rarely with obstacles.

One way of making cover more relevant again is to increase the deviation on hits (the highlighted ellipse in volutar's picture), so that obstacles are again in the line of fire and corners/fences/low walls could provide some form of protection by being in the line of fire instead of the situation where proper target placement and narrow deviation keep the line of fire free of obstacles.

Any ways, I have been agreeing with volutar's proposed change for target placement since the beginning, just worried about its implications. I'm done with this now, we'll see what the consequences are once it is implemented...
Title: Re: Aiming algorithm
Post by: kikimoristan on March 07, 2015, 06:57:08 pm
ok this is my 2 cents for what is worth i think he should go ahead with his idea but make it an optional setting?? you guys gotta make pace just saying. that way everyone is happy.
Title: Re: Aiming algorithm
Post by: Arthanor on March 07, 2015, 07:18:03 pm
I don't think it should be optional, volutar's target placement is clearly superior to the current way of doing things. (And I've mentioned that in every post I've written I think?).

What should be optional (or variable as a setting) is the spread of a successful shot (the highlighted ellipse on volutar's picture), so people can play with varying accuracies (and thus more or less cover, depending on what they prefer). But that's for later.
Title: Re: Aiming algorithm
Post by: kikimoristan on March 07, 2015, 07:32:04 pm
yeah i guess volutars system is implemented but it has a number that reflects the "vanillaness" of aiming. 0 = vanilla ....max number is full volutar . maybe the number is the "deviation" from centre .

Aiming Spread: 0
This changes the way aiming is calculated. Higher numbers reflect deviation from center making cover less and less effective. Default Xcom is always dead center (0).

So max number is based on that 12 x 5 LOF system. Maybe max number is 12? Or maybe max number is an abstraction of an oval shape meaning at 0 is dead centre, at 1 then 2 top/bottom 1 side, ....

this spread system can also be added to the weapons as a
  WeaponSpread: 4 < or even AimingSpread: or ShotSpread: etc.

 but it uses same mechanic to randomize the shot instead of deviate it from the center

this would be useful for shotguns machine guns lmg and can make some weapons more or less effective at  long range . i dunno.
Title: Re: Aiming algorithm
Post by: Arthanor on March 07, 2015, 09:01:11 pm
A larger deviation (larger success area) makes cover more effective as the likelihood of there being some cover in the area is larger. The smaller the deviation, the more likely you are to snipe out toes from under a bush.

Otherwise, I agree that a precision (https://en.wikipedia.org/wiki/Accuracy_and_precision) property for weapons would be really interesting. It would combine well with the firing accuracy property that we currently have to represent the whole process. A sniper rifle could be a really precise weapon that requires a high accuracy soldier to use (a sniper should be a marksman), whereas other, less precise weapons would be more forgiving (down to the shotgun which is not very precise).

It would also deal with the issue above, someone who wants cover to be more important would simply have to make weapons less precise (= larger success area = cover is more meaningful) through a mod.
Title: Re: Aiming algorithm
Post by: vlad on March 08, 2015, 12:57:46 am
I would like to point out one more thing. I dont particularly like the idea of aimed shot getting special treatment.
The difference between auto, snap and aim shots (when ignoring amount of projectiles) is in TU needed and chance to hit with the specific shot. Those two are interchangeable in meaning - you can't expect great chances to hit when pointing gun in general direction of enemy and pressing the trigger in split of second and you also can't expect low TU usage when you need to aim carefully and guess whats target going to do next, predict his movement.
I dont like the idea volutar's proposition would be applied only to aimed shot. If anything, you are always going for the most visible part whether aiming or just spraying. The part where we differ the shots is in TU/chance to hit, not the aiming points. That part is already covered by hit/miss system. If chances for auto and snap needs to be adjusted, so be it. Or if only agents are affected by artificial number reduction for some shots. Or the larger/narrower deviation. Your call.
Title: Re: Aiming algorithm
Post by: Arthanor on March 08, 2015, 01:33:53 am
Aiming for the center of the most visible target area would indeed make sense for all kinds of shots. Whether you have time to aim or not, you would aim for what you see: the visible part of your target.

Maybe what volutar was saying regarding snap and auto shots is that since they are rather inaccurate to begin with (low hit %) it won't make as much of a difference as for aimed shots (which can often reach 100% to hit)?

It would be silly to keep 2 different aiming mechanisms when one is obviously inferior to the other.
Title: Re: Aiming algorithm
Post by: volutar on March 08, 2015, 07:22:27 am
It's not yet implemented, it's still in preparation stage.
And obviously noone have tested that, and noone can judge by practical results. Neither and I can.
Title: Re: Aiming algorithm
Post by: hellrazor on March 08, 2015, 09:20:17 am
I don't think it should be optional, volutar's target placement is clearly superior to the current way of doing things. (And I've mentioned that in every post I've written I think?).

Indeed it is. So it shall be done!
Title: Re: Aiming algorithm
Post by: vlad on March 08, 2015, 11:40:06 am
If that was implied before, I just had urgent need to point it out explicitly. No other intent behind it. Tbh from what i have seen so far this idea has support, with some adjustment for "cover" supporters.
Title: Re: Aiming algorithm
Post by: Dioxine on March 18, 2015, 07:21:24 am
Yeah, even a cover-loving, vanilla-hating enemy of freedom and democracy like myself understands the importance of Volutar's work here. This is not about "optional" system, this is about basic hitting algorithm which should be perfect. I don't care much about vanilla'ess (it was then and now is now), but an imperfect algorithm makes the cover relevant for all the wrong reasons.

What I think should be optional is the "see by the eyes, shoot from the shoulders" idea which, saying it bluntly, I consider retarded (as is hip-shooting). Even when firing bursts you first catch the target in your sights, so every shot should be coming from the eye POV. And that's not because I hate missing or seeing the "no line of fire" message, but because this makes much more sense.

Only when we have a more or less perfect underlying algorithm, we can start adding an optional mechanism of random spread (with the maximum spread either based on weapon, a d100 + displayed hit chance roll, or some combination thereof) - as long as there is any brave cover-lover who is going to code it down :)
Title: Re: Aiming algorithm
Post by: Warboy1982 on March 22, 2015, 07:46:04 pm
this is a re-creation of the xcom engine. we're here to imitate, not to innovate. the firing/accuracy model MUST be accurate to vanilla, or we're missing the whole point.

i appreciate all the weird and wonderful things you guys want to do with it, really i do. if you want to alter the deeper mechanics of the game, please do. there's nothing to stop anyone from doing so, apart from dealing with C++, and the openxcom codebase is written in such a way that it's actually easy to mess around with. hell, i cut my teeth on C++ by creating my own codebase and mod so that i could do all the crazy things i could come up with. it was fun, and a good learning experience for me. i realize that not all of you are coders, so this may seem somewhat unfair, but i'd remind you that yankes is working on an "extended" version of the engine where he IS doing features by request, so maybe talk to him? (and maybe buy him a beer)

but when it comes to the master branch... there's only one major goal in mind: make xcom. openxcom is all about recreating the original, warts and all. the accuracy model isn't a bug we can fix, it's a well defined mechanic, and it's really not the responsibility of the project to be the "swiss army knife" of tactical turn based games. it's highly specialized. it's impossible to cater to you each individually, as you all want different things, and by trying to incorporate more and more features and options, we end up with a quagmire of code that's difficult to navigate and work with (see the "range-based accuracy" fiasco).

and i don't mean this to come across with any bile, i fully endorse the "a la carte" philosophy, and think it's really the best way to acheive exactly what you want, exactly how you want it.