I am trying to give some of my aircraft units very large movement rates. I have found in the past that the maximum movement recognized by the game is 42. (Movement rates higher than 42 are interpreted as 0 for some reason). However, in the current scenario I am creating, the maximum movement rate allowed is 31. This seems very odd to me - anybody know what might be going on?
Announcement
Collapse
No announcement yet.
MAXIMUM MOVEMENT VALUES?
Collapse
X
-
Shamrock,
I bet you changed your road movement rate to 4 times instead of the default 3 times. I once changed the road rate to 5 times and noticed the maximum move was considerably less that 42, 25 I think it was."Cease fire! Please! Cease fire. What a dreadful waste of ammunition!" -- General Horatio Herbert Kitchener
--
Comment
-
All right, here's the deal on max unit movement rates. If your road movement multiplier is 1, max movement is 127; for a multiplier of 2, the max is 63; for a multiplier of 3, the max is 42; for a multiplier of 4, the max is 31. I didn't investigate higher movement rates, but the relationship seems straightforward. It looks as if the programmer allocated a just one byte (8 bits) for unit movement info. For instance look at the last example with 4 and 31. Note that the number 4 requires 3 bits to represent in binary and 31 requires 5!
Comment
-
Computers use the last bit of a number to indicate whether it is positive or negative. If the last bit is 0 then it is positive, a 1 means it is negative.
For example a one-byte integer could have a positive value of Zero through 127 and a negative value of -1 though -128.
Due to the way binary math works a one byte integer with a value of 127 becomes -128 when a computer adds one to it.
That is why a unit does not move when its movement allowance is 128, because it interprets a one byte integer with a value of 128 to be negative 128. The same goes for the gold amount.
I tried to make a Starship Troopers scenario but it turned out to have a lot of bugs in it. ;)
Comment
-
Oh, your right shamrock ... I am remiss.
The limit is 127 because the movement rate for unit, from the computer's perspective, is not divided by the road multiplier rather it is multiplied by it.
For example alpine troops, from the computer's perspective, is three (1 * RoadRate).
Cavalry would be six, movement rate of two times the RoadRate of three.
The difference is the way it counts the cost of the squares. For the Cavalry the cost to move into a square is the movement point cost of the square times the road rate. Thus a road square costs one, a road-less grassland costs three and a forest costs six. For the alpine troops all square cost one.
To prove this: all you need to do is set the
Set the movement value of the unit to 13 and the road rate to 10. It will not be able to move.
Then change the movement value to 12 and it will start moving.
Then to really get fancy set the movement value to 30. Either your computer will crash with an overflow error or the unit will have a base movement rate of 4 and 4/10ths! This is because the 300 exceeds the maximum value of 255, thus it overflows and is seen by the computer as 44 (300-256).
I have not tried it but if I'm wrong I'll eat my shoe!
I tried to make a Starship Troopers scenario but it turned out to have a lot of bugs in it. ;)
Comment
Comment