aliens

Author Topic: hit angle and armor side  (Read 857 times)

Offline TrickyTriscene

  • Sergeant
  • **
  • Posts: 21
    • View Profile
hit angle and armor side
« on: October 05, 2021, 02:58:58 pm »
Maybe someone knows more about this, I don't know the mechanics.

But some naut was hit at 20 degrees or so and I expected front armor to kick in and save me. At 132/142 you should have no danger from blasta rifles. The naut was killed.

What about, if you hit an enemy and it retaliates, you should always enjoy front armor. Because during the shot you are not on 45 degree clicks but facing the alien straight.
And we need the angular rules explained somewhere.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 7118
  • OXCE developer
    • View Profile
    • My Wiki
Re: hit angle and armor side
« Reply #1 on: October 05, 2021, 03:04:53 pm »
Code: [Select]
if (!type->IgnoreDirection)
{
if (relative == Position(0, 0, 0))
{
side = SIDE_UNDER;
}
else
{
int relativeDirection;
const int abs_x = abs(relative.x);
const int abs_y = abs(relative.y);
if (abs_y > abs_x * 2)
relativeDirection = 8 + 4 * (relative.y > 0);
else if (abs_x > abs_y * 2)
relativeDirection = 10 + 4 * (relative.x < 0);
else
{
if (relative.x < 0)
{
if (relative.y > 0)
relativeDirection = 13;
else
relativeDirection = 15;
}
else
{
if (relative.y > 0)
relativeDirection = 11;
else
relativeDirection = 9;
}
}

switch((relativeDirection - _direction) % 8)
{
case 0: side = SIDE_FRONT; break;
case 1: side = RNG::generate(0,2) < 2 ? SIDE_FRONT:SIDE_RIGHT; break;
case 2: side = SIDE_RIGHT; break;
case 3: side = RNG::generate(0,2) < 2 ? SIDE_REAR:SIDE_RIGHT; break;
case 4: side = SIDE_REAR; break;
case 5: side = RNG::generate(0,2) < 2 ? SIDE_REAR:SIDE_LEFT; break;
case 6: side = SIDE_LEFT; break;
case 7: side = RNG::generate(0,2) < 2 ? SIDE_FRONT:SIDE_LEFT; break;
}
if (relative.z >= getHeight())
{
bodypart = BODYPART_HEAD;
}
else if (relative.z > 4)
{
switch(side)
{
case SIDE_LEFT: bodypart = BODYPART_LEFTARM; break;
case SIDE_RIGHT: bodypart = BODYPART_RIGHTARM; break;
default: bodypart = BODYPART_TORSO;
}
}
else
{
switch(side)
{
case SIDE_LEFT: bodypart = BODYPART_LEFTLEG; break;
case SIDE_RIGHT: bodypart = BODYPART_RIGHTLEG; break;
default:
bodypart = (UnitBodyPart) RNG::generate(BODYPART_RIGHTLEG,BODYPART_LEFTLEG);
}
}
}
}

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1479
    • View Profile
Re: hit angle and armor side
« Reply #2 on: October 05, 2021, 06:33:11 pm »
If the aquanaut is facing the enemy, they will tend to get hit in the front, but will frequently get hit on either side. Only their back armor will not be hit-able. You can mod the armor facings if you don't like such weak sides making your front vulnerable.

The soldier's hitbox is a cylinder divided into four quadrants. If a soldier faces their diagonal toward the enemy, such that exactly two quadrants are visible to the enemy, then the odds of hitting either of the two far quadrants is drastically reduced if not eliminated entirely.

Some mods add a left-side shield to soldiers, so that they have especially high front and left armor. Those units will have very sturdy and reliable defense when properly facing the enemy, but it takes up the left-hand slot so that they cannot use a two-hand weapon with full accuracy.
I don't know all of the details, but you can harvest the work from other mods which have done it, listed here:
Re: [Q] Riot Shield mod for Open XCOM Extended?

- - -

Under armor only applies to explosive-type attacks (such as HE, freeze) which detonate either under or adjacent to the soldier. If the center of the blast is any farther than that, it will also hit side armor.
« Last Edit: October 05, 2021, 06:39:33 pm by The Reaver of Darkness »

Offline TrickyTriscene

  • Sergeant
  • **
  • Posts: 21
    • View Profile
Re: hit angle and armor side
« Reply #3 on: October 08, 2021, 01:17:03 pm »
So if you're straight under a Xarq or Tent you can hit their soft spot, the under armor. I don't know if an alien dropping on you is lethal or not.
And if the ratio x and y is sharper than 2, so angles sharper than 27 deg, the shot will meet the pure side (like the front). Other angles will give a 50/50 roll between the two concerning sides.
But I see >, not >= so you need 1 extra square above the 2:1 to make it sharp enough for 132/142.

Offline FireStarTracer

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: hit angle and armor side
« Reply #4 on: November 09, 2021, 08:42:55 pm »
I should note IRL there are alot of caveats to armor protection.  For example with real life hard plates 'edge hits' are considered less reliable than hits closer towards the center with ceramic armor so the chances of perforation could go up (or the round ricochets off the edge and perhaps hits your limb or an area NOT covered by armor.) - RL side armor panels also tend to be lower protection than front or back plates to reduce bulk and range of motion (front and back plates ARE of roughly equal mass though IIRC - that is intended to balance the load, although you could assume that if other things are worn on the back they could substitute and offer *different* protection.)

FWIW IRL 'angle' impacts have a harder time penetrating armor than perpendicular hits (same principle as sloped armor) but this is balanced out by the fact that 'real' armor also has far less coverage than in game (rifle plates just protect the upper chest and mostly the vitals) - also until relatively recently helmets usually offer somewhat less protection than torso plates to boot - meaning that head shots could almost always be considered dangerous (by blunt trauma even if the round doesn't perforate.) - so I tend to think things balance out when abstraction comes into play.  I'll take weakened side armor over 'reality' I think. :)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1479
    • View Profile
Re: hit angle and armor side
« Reply #5 on: November 10, 2021, 10:16:49 am »
So if you're straight under a Xarq or Tent you can hit their soft spot, the under armor.
Under armor can only be hit with explosives, if the center of the blast is on the unit or immediately adjacent to them.

I don't know if an alien dropping on you is lethal or not.
It is not. If a unit falls on another, the other unit is pushed one tile out of the way. If they cannot be moved out of the way, they are stunned.

Offline FireStarTracer

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: hit angle and armor side
« Reply #6 on: November 10, 2021, 09:50:54 pm »
Does under armor get hit if the target is on a lift/elevator above the unit firing (like in a UFO) or if they have an outfit capable of flight (which could include underwater situations like in TFTD?)  I'd assume logically you could hit under armor even with ranged weapons (but not melee) and not just explosives.

Likewise, what armor value gets used if the target is BELOW the firing unit (same reasons as above) and they are firing into the top of the target? 

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1479
    • View Profile
Re: hit angle and armor side
« Reply #7 on: November 17, 2021, 08:10:43 pm »
Does under armor get hit if the target is on a lift/elevator above the unit firing
No. Internally, there is no under armor. Instead, there is a special fifth armor facing used just for hits which are done by tile, such as high explosive. Any hit which has a line of fire trajectory cannot hit the fifth armor facing. Tile hits also do not hit the fifth armor facing if they emanate from at least 2 tiles away. The naming convention of the fifth armor facing is "under armor", so you can imagine it's what gets hit when your soldier stands on top of a live grenade.

Offline FireStarTracer

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: hit angle and armor side
« Reply #8 on: November 18, 2021, 02:11:06 am »
So I assume that means whether top or bottom armor gets hit will always depend on facing (Front, sides or rear) like it would with shots happening in the same plane.   If so, that makes sense.

This makes me wonder  - if there's a special facing for grenades and such would it be possible (now or in the future) to make more such facings or is that one constrained by limits to the engine?   Not sure if it would even have a use (resistances being a thing) but I'm curious all the same)
« Last Edit: November 18, 2021, 02:13:32 am by FireStarTracer »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1479
    • View Profile
Re: hit angle and armor side
« Reply #9 on: November 18, 2021, 04:04:43 am »
I doubt it, but I don't know.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1932
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: hit angle and armor side
« Reply #10 on: November 18, 2021, 02:11:32 pm »
Using a different armor value for explosions is possible using OXCE scripts, but in most conditions the under armor will only be hit when an explosion is centered on a unit or on an adjacent tile, making it a pretty good estimate of "explosion defense".