Optimizing your textures

From VbGORE Visual Basic Online RPG Engine


Although vbGORE's engine handles textures to use as little memory as possible at the most minimal cost of performance, it is recommended you still treat the textures the best you can for the best performance possible.

The rules of textures

First off, you must know the rules that you must follow when designing the textures. The reason we say textures is because vbGORE treats the graphics as textures, not as surfaces such as DirectDraw does. The difference is that DirectDraw just copies the pixels from one surface to another, while vbGORE uses Direct3D to actually perform 3D calculations to display texels.

1. Sizes in powers of 2: The texture sizes must be in powers of 2. This is the texture as a whole, not the individual Grhs in the texture. The individual Grhs can be any size you want them to be. The width and height of the texture do not have to be the same power of 2 - for example, you can have 2x128, 4x32, 64x64, etc.

2. No larger than 1024x1024 when possible: Most modern graphic cards can support textures over 1024x1024 resolution, but you want to design your game for all people, not just most people. When possible, try to make your textures 1024x1024 at largest. If you must, you may increase the resolution, but the next step to 2048 is a huge increase in size, and can end up very costly and may not be supported by all graphic cards.

The texture's content

What you put on each individual texture can be very important. 256 32x32 textures holds the same as one 512x512 texture, and the RAM usage is equal for the most part, but the individual small textures will load slower and result in more overhead. But this doesn't mean the one large texture is better, either, since you are most likely not going to use all those tiles at once, so why keep them all in memory at once?

The easiest thing to keep in mind is as little black space as possible. Black space does not refer to the transparent parts of Grhs, but completely unused parts of the texture. For example, if you have a 200x200 pixel image, putting it in a 256x256 texture is going to waste a lot of space. Often, there is nothing you can do about it unfortunately.

Now back to the first question, what do we do with a bunch of tiles? What you want to do is group graphics together that are commonly used together. For example, animations should always remain together in a single texture (or more if it doesn't fit in just one). Another example is if you have multiple pieces of a house, you want to put it all in one texture since you will most likely be using a majority of or all of the pieces at once.

It is important to not spend too much time worrying about it, though. Don't go through extensive lengths just to group together a few more graphics. In the end, it is often not worth going back to fix bad designs. If you get in the habit of proper designing from the start, though, you can get the most out of the engine.

Personal tools