18

In XCOM configuration files, distances are expressed in some obscure units, that do not translate to grid cells easily.

Example values:

  • unit vision radius: 27
  • most weapons range: 27
  • sniper rifle range: 100
  • soldier (and most enemies) run distance: 12
  • thin man run distance: 15
  • cryssalid run distance: 20

A soldier definitely does not run 12 grid cells straight.

So, what are distance units in grid cells, and how distances are calculated diagonally?

  • I couldn't really make sense of it from in-game. I think the soldier moves 7 tiles in a straight line in a half-move or 15 while sprinting. This doesn't seem to line up well with these numbers. Additionally, there appears to be some cost for changing height - even if it's a gentle slope instead of a step up or jump down. – agent86 Oct 29 '12 at 1:16
3

Here is an answer that explains all apparent issues with arithmetic, e.g. the "off by 1" issue, or ghosts of additive modifiers.

The exact conversion factor of tiles/mobility is 0.666. This differs from the intended factor of 1/1.5 (or 2/3), which equals 0.666(6) in decimal, with an infinite number of trailing 6's. Since the game cannot process infinite precision numbers, it truncates it to 0.666, with 3 or more trailing 6's. Because of this, we now have 1/0.666 or 1.5015 mobility points per tile.

For example, with mobility 12 we have:

blue move: 12 * 0.666 = 12/1.5015 = 7.99 => round_down(7.99) = 7 tiles yellow dash: 12 * 0.666 * 2 = 15.98 => round_down(15.98) = 15 tiles

So we get the actual 7/15 tile movement instead of the intended 8/16 tiles for mobility value of 12.

I tested all movements (single/double for straight and diagonal) for all mobility values between 3-30, and have confirmed that the factor of 0.666 correctly predicts 100% of the cases with the assumption that fractional number of tiles are always rounded down.

I've updated the ufopaedia.org page on Movement, and said more about this in the discussion page

This conversion also works for the range and radius of throwables (e.g. grenades). For example, an AP grenade has a blast radius of 5.6 mobility, which equals 5.6 * 0.666 = 3.73 straight tiles, which rounds down to a 3 tiles, and also 5.6*0.666/1.414 = 2.6 diagonal tiles which rounds down to 2 diag tiles.

  • Excellent! Btw, did you by chance test vertical movements (like slopes), too? – Orc JMR Mar 18 '18 at 11:44
  • ( nitpick: periodic fractions, like 0,(6), are rational, irrational numbers never repeat, like Pi ) – Orc JMR Mar 18 '18 at 11:45
12

how distances are calculated diagonally?

They are simply calculated with pythagorian distance equation, rounded.

In A column and 1 row, I put 1 to 15. Then I put this formula in B2, and copy pasted it down and to the right: =ROUND(SQRT($A2*$A2+B$1*B$1),0)

straight line travel distance for half move and full move

A full move is 15 squares and a half-move is 7 squares (15/2, round down). The diagonal half-move is highlighted red - you can move 5 squares diagonally in a half-move, because that square is 7 units distant from the origin of movement. Obstacles and elevation use some of the 15 unit move allowance, as the soldier no longer moves in a straight line (look at the glow trail before moving).


what are distance units in grid cells

various unit conversions

A couple theories are show in the above picture. We can be pretty sure that a config unit is between 90 and 96 fictional units, between 0.625 and 0.667 cells. This might be precise enough to do whatever you want to do with config units. In game with the default ini, the only distance we don't understand is: at what range does a squadspotted sniper rifle shot fail (62-67 cells - approx 4 full moves). All the other distances are verifiable by examination. Embrace the pragmatic - if you want some distance to be longer, increase the value.

  • Also, mutons just helped me to check that a shotgun does not have a shorter range than an assault rifle. The range is the same as rifle and as vision range. – Orc JMR Nov 27 '12 at 16:16
  • Summarized your findings, Orc JMR. Sadly, not much to add. – Amy B Nov 28 '12 at 16:50
  • This is brilliant. How would this work if there was a 3rd axis? How do you calculate that? – Sam Mar 8 '16 at 21:59
1

My own theory was 0.625... But then I went and asked.

@SolomonJake A tile in XCOM is 96 unreal units squared, which is 1.5m in real world units.

So it is 1.5 meters per cell. But the calculations are trickier. Let's assume config files state meters:

  • Single move: 12 meters / 1.5 = 8.
  • Double move: 24 meters / 1.5 = 16.
  • Vision range: 27 meters / 1.5 = 18.

All values off by one. A ghost of additive modifier is upon us again :-)

After reading Jake's response, I have been laying out calculations and for some reason have set 0,64 as cell-to-config-unit ratio (as if a meter was 64, and a cell was 100 unreal units, which is false). And numbers made sense - 7.68, 15.36, and 17.28, just round down and voila. But it is wrong :-(

  • It's 5/8. Why 5/8? No idea. – Raven Dreamer Nov 28 '12 at 12:29
-1

Unit is tiles.

move distance
A normal (without any move bonus) soldier move 6 tiles twice, or dash 12 tiles once.

Visual range
my experience about 17 tiles, but mission almost at dark night, attenuate is possible.
(Yesterday, I'm LUCKY catch a different test.
council mission, Russia, territory is a radar station, 2:00 AM seem Dawn not so dark.
When my soldiers climbed to the roof of station, they FOUND some enemy still inside fog of war, just near edge, only red frame showed.
The most interesting was, there was no encounter trigger, and no one can shoot them. Still need send someone to encounter them laster.
I guess that's long visual range mean, SEE enemy inside fog of war.)

weapon range
Can't test exactly.

  • 3
    Soldier moves 7 or 15 tiles, not 6 or 12. Test again. Units are NOT tiles - or else a shotgun would fire for 27 tiles. – Orc JMR Dec 10 '12 at 6:23
  • The tiles witch soldier standing distance 0, and can move out 6 tiles, it's looks like blue movable area has 7 radius. Can't shoot enemy out of sight, so normal weapon range unimportant. – Tiger_Zhao Dec 11 '12 at 1:27
  • Think in steps, not distance. A cell next to a soldier is distance one, then two.. there are seven cells between the soldier and movement zone edge. Make sure your soldier is not changing height - vertical movement is also counted. Weapon range is important, but it is equal to sight radius. Sniper rifle has range 100, and a soldier CAN shoot ouside his own sight. – Orc JMR Dec 11 '12 at 8:01
  • SO STRANGE. archangel armor soldier 6, ghost armor(+3) soldier 9. whatever it's called tiles/cells/steps, on deck of Supply Barge, I hold down right-button and count carefully, that's my result. – Tiger_Zhao Dec 12 '12 at 2:13
  • 1
    Here are my screenshots, new game, rookies: imgur.com/a/22L1W To be honest, I've modded the game some time ago, but never changed mobility, and the mod should've been overwritten with updates. – Orc JMR Dec 12 '12 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.