When to stop drawing all tiles in a tile base game

We are buliding our maps with Tiled (mapeditor.org) and currently we are drawing all tiles on each Draw-Call.
The biggest map by now is the major city with a size of 100x100 tiles (tile size 64px).

During adding more and more NPCs, dynamic lights and other animated stuff I wondered if I may run into performance issues.
I probably want to make a check if the current tile is even visible before drawing it, no? And also update dynamic lights only if visible?

We currently don’t have any issues and it is running on smooth 60fps, but I ask my self at what point am I forced to change my drawing routines?
Do you have any experience in this or is it just trial and error?

Welcome to the world of Programming…

As a rule of thumb, when you start seeing performance issues is when you should change it. What you will need to optimize depends on what the bottlenecks are that you find via profiling. If it’s your tile drawing, then drawing only visible tiles sounds like a viable optimization technique.

In short, I wouldn’t worry about it until it becomes an issue.


In past places I’ve worked (that don’t have a dedicated engine team for performance) the way to test this was basically figuring out our max allowable world size and entity count and then putting it all up in a test level and seeing if we would need to worry about it. If you have no idea what your cap numbers are going to be then just try with a very large number of tiles / NPCS and if it is running fine, you probably don’t need to concern yourself with it for now. But yeah as the others have said, it is definitely a lot of trial and error.


I would think from this point forward about how to make your world into variable sized chunks vs large set piece tile groups for the future.
Or probably more to the question, to allow for draw looping structures that allow you to exclude tiles.

If later you need to cull its a lot easier to do it if you have allowed for the possibility of culling as you go foward as a fore thought vs a after thought.

IMO you should definitely only draw visible tiles. Drawing everything all the time is not a good practice.
In my game, I use a concept of viewport, which has size and drawing offset. Based on the viewport, only a subset of tiles is selected and rendered. There’s a little margin added, so that if there’s a large object partially off-screen, it doesn’t disappear prematurely.
Also, this shouldn’t only apply to rendering, but also to object updates. If you have a large map with tons of animated characters, for example, it’s not necessary to update animations of characters that are off-screen.

Thank you for your answers guys.

I am going to skip the updating and drawing for some elements that are outside the viewport. Rather do it now than later be forced to do it ^^

I figured the frustrum would be key here, so I made a web search on it:

Search phrase:


1 Like