Thread Tools
Old July 21, 1999, 00:02   #1
shamrock
Warlord
 
shamrock's Avatar
 
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?
shamrock is offline  
Old July 21, 1999, 01:27   #2
mrtemba
 
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
mrtemba is offline  
Old July 21, 1999, 18:55   #3
Gothmog
Scenario League / Civ2-Creation
Prince
 
Gothmog's Avatar
 
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.
Gothmog is offline  
Old July 21, 1999, 19:24   #4
shamrock
Warlord
 
shamrock's Avatar
 
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?
shamrock is offline  
Old July 21, 1999, 20:02   #5
shamrock
Warlord
 
shamrock's Avatar
 
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!
shamrock is offline  
Old July 21, 1999, 22:43   #6
DieHardGamer
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.

DieHardGamer is offline  
Old July 21, 1999, 23:19   #7
shamrock
Warlord
 
shamrock's Avatar
 
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.
shamrock is offline  
Old July 22, 1999, 16:28   #8
DieHardGamer
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!


DieHardGamer is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 19:59.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team