July 21, 1999, 00:02
|
#1
|
Warlord
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Jul 1999
Location: Los Angeles, CA
Posts: 161
|
MAXIMUM MOVEMENT VALUES?
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?
|
|
|
|
July 21, 1999, 01:27
|
#2
|
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Dec 1969
Location: Bloomington, IN, USA
Posts: 2,919
|
well....no. I have always found 42 is the max. I don't know what's going on
|
|
|
|
July 21, 1999, 18:55
|
#3
|
Prince
Local Time: 19:59
Local Date: October 30, 2010
Join Date: Dec 1969
Location: Minas Morgul
Posts: 421
|
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.
|
|
|
|
July 21, 1999, 19:24
|
#4
|
Warlord
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Jul 1999
Location: Los Angeles, CA
Posts: 161
|
Thank you Gothmog, you're exactly right - I did change my movement multiplier to 4. Does anyone out ther understand this relationship?
|
|
|
|
July 21, 1999, 20:02
|
#5
|
Warlord
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Jul 1999
Location: Los Angeles, CA
Posts: 161
|
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!
|
|
|
|
July 21, 1999, 22:43
|
#6
|
Warlord
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Jun 1999
Location: Garfield, NJ, USA
Posts: 138
|
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.
|
|
|
|
July 21, 1999, 23:19
|
#7
|
Warlord
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Jul 1999
Location: Los Angeles, CA
Posts: 161
|
diehardgamer,
Your explanation does not account for the effect of the movement multiplier.
|
|
|
|
July 22, 1999, 16:28
|
#8
|
Warlord
Local Time: 23:59
Local Date: October 30, 2010
Join Date: Jun 1999
Location: Garfield, NJ, USA
Posts: 138
|
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!
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
All times are GMT -4. The time now is 19:59.
|
|