2 to a computer is the equivalent of 10 to you or me.
You can multiply/divide by 10,100,1000,etc almost instantly, just as a computer can multiply/divide by 2,4,8, etc far faster than any other numbers
16 players, 512*512 tiles, 64*64 textures, why?
Quote:
Original post by Sandman Quote:
Original post by catch
I think most people pick round numbers because they are... round. Not necessarily because they are programmers.
Of course, to a programmer, the powers of two ARE round numbers...
I think that's the main reason.
True, for a lot of technical issues, powers of two are very handy and efficient, but in many cases, I suspect it's just that they had to settle on some number, and powers of two are nice round numbers... :D
Like the 16 player limit. You'd have to be pretty desperate for that extra bit to matter, but hey, it's a nice round number. :)
I think it's an issue of binary data structures, and all those fun O(log n) functions that we play with. Powers of two are nice and efficient, but if you add one, you bump that up a little. Again, it's not much, 5 operations per function per cycle against 4 operations, but if you run those 4 operations 50 times a second, you're burning time.
Similarly, you can do fun things with those top bytes, like using multiple teams. Simple, trivial, but sometimes the difference between what we've seen before and a whirling free-for-all.
Similarly, you can do fun things with those top bytes, like using multiple teams. Simple, trivial, but sometimes the difference between what we've seen before and a whirling free-for-all.
As a programmer...
It has to do with optimal alignments of variables. Not to get too technically, most optomizing compilers traditionally align variables, regardless of their size, to the size of the natural integer of the processor. On the Intel 80x86 lines starting with the 80386, that size is 32 bits.
Also, the language traditionally used is C (or it's variant C++) and there are no variable "sizes" etched in stone. Everyone says that char, short, and int are 8, 16, and 32 bytes, but thats only on 32 bit machines. Cross-Compiling code for the 6502c (the NES's processor) means that char short and int are all 8 bits each.
So, its ultimately that of synchronization. Everything occupies the natural and optimal amount of space, so the maximums which arbitrarily have to be set will be set to the largest size possible for the space alotted. 16 players? Considering the amount of space needed to create a single player, I'd bet that there wasn't enough space for 32 players. Why 512x512 tiles? the pixel at (x,y) is tile[(y<<8)+x].
Hey, you wanted the graphics to be uber fast and realistic, so stop complaining when we're forced to count in another number system.
It has to do with optimal alignments of variables. Not to get too technically, most optomizing compilers traditionally align variables, regardless of their size, to the size of the natural integer of the processor. On the Intel 80x86 lines starting with the 80386, that size is 32 bits.
Also, the language traditionally used is C (or it's variant C++) and there are no variable "sizes" etched in stone. Everyone says that char, short, and int are 8, 16, and 32 bytes, but thats only on 32 bit machines. Cross-Compiling code for the 6502c (the NES's processor) means that char short and int are all 8 bits each.
So, its ultimately that of synchronization. Everything occupies the natural and optimal amount of space, so the maximums which arbitrarily have to be set will be set to the largest size possible for the space alotted. 16 players? Considering the amount of space needed to create a single player, I'd bet that there wasn't enough space for 32 players. Why 512x512 tiles? the pixel at (x,y) is tile[(y<<8)+x].
Hey, you wanted the graphics to be uber fast and realistic, so stop complaining when we're forced to count in another number system.
william bubel
Quote:
Original post by Spoonster
Like the 16 player limit. You'd have to be pretty desperate for that extra bit to matter, but hey, it's a nice round number.
The extra 8 players? or the extra 16? Neither seems desperate to me...
ld
No Excuses
Quote:
Original post by ToohrVyk
Also, multiplying by a power of 2 can be done in a bitshift operation, which is much less costly than a multiplication.
I second that
Quote:
Original post by Sandman
Of course, to a programmer, the powers of two ARE round numbers...
and i thought it was just because of my OCD...
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
might be a little off topic for now but:
A minor correction. OpenGL doesnt want n*n textures. it wants m*n textures where m AND n are powers of two BUT m and n need not be the same values. Square textures are the most common, but it is perfectly fine to use rectangular ones too. And although newer cards support irregular sizes, i think it does incur some performance loss. The simplest reason i see OpenGL prefering powers-of-2 (po2) is that its is auto-mipmap friendly. Mipmap textures are generally half the size of the previous mipmap level. Having textures of po2 (and square) allows perfect mipmap generation right up to 1x1, which is as detailed as a mipmap can (but not necessarily should) go.
Quote:
Why does OpenGL only want n*n textures where n is a power of two?
A minor correction. OpenGL doesnt want n*n textures. it wants m*n textures where m AND n are powers of two BUT m and n need not be the same values. Square textures are the most common, but it is perfectly fine to use rectangular ones too. And although newer cards support irregular sizes, i think it does incur some performance loss. The simplest reason i see OpenGL prefering powers-of-2 (po2) is that its is auto-mipmap friendly. Mipmap textures are generally half the size of the previous mipmap level. Having textures of po2 (and square) allows perfect mipmap generation right up to 1x1, which is as detailed as a mipmap can (but not necessarily should) go.
- To learn, we share... Give some to take some -
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement