Archived

This topic is now archived and is closed to further replies.

Tile Engine

This topic is 5622 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I want to start to code a tile engine, but i need some suggestions how to render the tiles. I thought of 2 methods First: I have one VertexBuffer with just one Quad. Then changing the WorldPosition and Texture Position for every Tile (with Matrices) and draw it. I do it for all Layers in my map. 2. I have a big VertexBuffer for the whole screen. Lock it once per frame and write the new tile data in it. i will arrange the vertex data in the buffer in a way, that first the tiles will be rendered wich are on the first texture then tiles of the secon texture and so on to prevent setting for every tile a new Texture. Next thing are the layers of the map. At the moment i don''t how to do this. One VertexBuffer for every layer? or big big Vertexbuffer arranged that renders first, second,...xxxLayer. When i''m using the big big vertexbuffer method i need to have a list of texture used in each layer and arrange the buffer in a way that every texture is only set once per layer(so that the z order of the layers will be correct) The second method is much more complicated than the first but i can imagine its faster although i lock a vertex buffer but i minimize the other operations like calculating the position in World and in Texture What do you use for rendering maps? Do you think my methods are usable? Please give me your opininons or make suggestions to make it better

Share this post


Link to post
Share on other sites
Both of them seem kind of slow. I would do it this way:

- Create a vertex buffer for every tile set (you probably only need one of two of these, you can probably store all of your tiles in one texture)

- determine the visible tiles and update the index buffer so only they are drawn (you can probably just do this with an offset)

-translate the all of the visible tiles.

This way you should have minimal texture changes and can probably use static vertex and index buffers. You can speed up the first method by only changing textures when the tile set changes, I''m thinking the second method will be slow though, because you keep locking and unlocking your VBs, but I''m not sure about dynamic vertex buffer performance.

Share this post


Link to post
Share on other sites