Why only 32767 texture numbers

From VbGORE Visual Basic Online RPG Engine

If you have tried making textures with a number higher than 32767, you may have noticed that ToolGrhDatMaker will display an error or that the textures simply won't work in the game. You may think this is stupid, but this article is designed to explain why this limitation is here.

First off, the exact limitation number is from the limit of a signed 16-bit integer. This value is acquired from the equation 2^15 - 1.

You could surpass this number by changing from an 16-bit integer to a 32-bit long, which would allot for 2^31 - 1 or 2,147,483,647 texture numbers, but the reason this isn't done is because as the texture numbers raise, whether or not you use the textures in-between, it will increase the RAM usage and slow down the engine.

The reason for the RAM increase is that the NumGrhFiles variable holds the highest texture number used. As this variable increases, so does the size of the SurfaceDB(), SurfaceSize() and SurfaceTimer() arrays.

The speed decrease comes from that there are more textures numbers that have to be looped through and managed, along with more memory has to be allocated when the engine initializes.

So the point is, although this may seem like a stupid limitation, it is here to help prevent you from antecedently destroying your game's performance.

Personal tools