Dibujar previamente las partes estáticas de mi nivel

I have a level based game that is using a tiling engine to present those levels. there are large parts of the level that stay static through the level like the ground, and the sky.
I thought about pre-rendering the ground and the sky from the tile data to a render texture and just drawing that every frame instead of drawing a bunch of prefabs every frame.
The whole level is visible at all times so there are no concernes about things that will not be drawn.
The only downside to the render texture I can see is that it takes space in memory (graphical one though) while the prefabs are small and copied all over the place.
What is better? pre-drawing the whole thing or just drawing all the prefabs every frame?

preguntado el 27 de agosto de 11 a las 14:08

1 Respuestas

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.

¡Espero que ayude!

Respondido 28 ago 11, 00:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.