Originally posted by Famine
As flat-out says
I assume the next alternative down to coding on 32 bits is coding on 16 bits. Using flat-out's example, this would give 2^16 values, ranging from -2^15 to + 2^15. 2^15 is... 32,768 - so as soon as you reached 32,768 miles (or km...) travelled in total, the game would crash. I don't know about you, but I've gone well past that distance on my games. So that's why the speed and distance blah blah blah blah...
Good assumption I would say, but that's not the way it works. Actually it seems to me that most variables in the game are of type 'integer', thus limited to the famous 2,147,483,647. (Sorry Spock, this is 'integer', not 'floating point', but it's indeed a limitation of the PS2 chip. Floatint point would have allowed much higher values.)
This limitation is true for the speed (as those who manage to go past the track borders know), and also for the credits, the number of days...
BTW, that would represent in game-time about 5.8 million years (enough for never being reached).
Daan and others who just don't care, you can jump to the next post or thread unless you fancy a little nap right now, because I'll do the explanation again.
But first I'll put some keywords that should make this stuff easier to find in the future.
Keywords : integer - value - maximum - floating point - 2million - crash - out of range - memory - variable - bit - byte
Explanation :
Computer chips work with 'bits'. A bit is something with a value 0 or 1, nothing else (that's why we call things made out of bits 'binary'.)
A byte is made of 8 bits, so it can have 256 different values : 00000000, 00000001, 00000010, 00000011, 00000100, 00000101... 11111111. The number of values is easily calculated by considering that the first bit can have 2 values, and for each of them the second bit can have again 2 values... So the byte can have 2x2x2x2x2x2x2x2 = 2^8 = 256 values).
An integer value is usually stored on 4 bytes (thus 4x8 = 32 bits), then it can take 2^32 values. Half of these values are negative ranging from - 2^31 to -1 (and we don't care in our case), the second half are positive, ranging from 0 to -(2^31)-1. This is how the maximum speed/days/credit/races won... is calculated : 2,147,483,647.