I would just like a little clearity here; what is the major difference (that I should be concerned about) with float and int ? It is my understanding the floats take up more memory and are therefor are more taxing on my cpu load dureing calculations,. . with In The Shadows I don't really notice a difference changing the 64x64 array between the two,. (the data for the raycasting/wall collisions)
Thing I'm wondering is if i should do my lighting by int 0-32 for brightness of walls 33-64 for floor light level etc. or just use 0-1f for walls 1-2f floors etc..
float vs int
Moderator: Moderators
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
float vs int
iterationGAMES.com

There's no difference in size between a ( single ) float and a integer. Both take up 4 bytes. There's a difference in range though ...
int ( signed ) = -2147483648 to 2147483647
float ( single ) = ±1.5 × 10^−45 to ±3.4 × 10^38 (~7 digits)
The main thing to ask yourself when making the choice is whether you need decimals or not. When you do, you usually want to go with floats, when you don't you definitely want to go with integers.
Also, you want to prevent having to convert from & to float / integer at all times. So since all colors in ZGE are float based ( glColor4f ), go with floats for your color data.
K