1

我有一个基于关卡的游戏,它使用平铺引擎来呈现这些关卡。关卡的大部分部分在整个关卡中保持静止,例如地面和天空。
我考虑过将平铺数据中的地面和天空预渲染到渲染纹理,然后每帧都绘制它,而不是每帧绘制一堆预制件。
整个关卡始终可见,因此无需担心不会绘制的内容。
我可以看到渲染纹理的唯一缺点是它占用内存空间(虽然是图形空间),而预制件很小并且可以复制到整个地方。
什么是更好的?预先绘制整个东西还是每帧都绘制所有预制件?

4

1 回答 1

0

The whole point of a tile map is that you can reuse certain parts of the image multiple times, which saves on memory, and in most cases, is faster to render. Since you will most likely have objects moving around on your map, you will need to render the ground and sky images at every frame anyways, otherwise, you'll have after-images everywhere! The easiest way to test this is to try both ways, and use tools to see how each way affects speed, memory, and battery life.

I've played with both ways, and I've found that tile maps are for the most part more efficient for background images, although they are a bit more difficult to maintain.

My general rule of thumb is, if I have a bunch of sections in my background which could just be repeated tiles, and the size of the tile set is roughly 50% or less of the size the whole image, I implement the tile map. Otherwise, I just use the image.

Another note though, if your sky is all one colour, and there are no differences anywhere, then I found the best thing to do is to take a 1 pixel image of that colour, (or a white pixel, and make its colour the colour of your sky!) and scale it to the appropriate size. This is easy to maintain, and easy on the speed, memory and battery life, but you do sacrifice detail.

Hope that Helps!

于 2011-08-27T17:18:47.583 回答