Our map import is giving us 100% CPU


I hope someone can help! So we have a game that we made around 16 years ago, and currently wanting to use Tiled as our main editor for the game, what we have tried to do is import our map in to Tiled but we are getting our CPU usage at 100%.

Our tiles are 20x20 each.

Has anybody else experienced this or know a reason for it happening?

The map is pretty large. Around 512 x 512 chunks of 20x20 each.

Here is a bigger scale of our full map

Even seeing this might not show you the scope of how big it is. This is 1 layer of a map, it is not separated in to separate layers and would like to know if this is a reason for it, because it cannot render the huge map we have?

If you force Tiled to render so many tile cells at once, yes, it will struggle. It should be fine if you zoom in, so it doesn’t have to handle so many cells all at once. You can use the Minimap to navigate large maps to avoid needing to zoom out.

Generally this is a problem when panning or using tools, though. If you’re getting high CPU usage when the map is loaded and you’re not interacting with Tiled at all, that sounds like some other issue.

Thank you for this response.

Do you think we should split the map up in to multiple layers? As they are technically several maps but on 1 single layer. In the actual game, you have to go through teleporters to get to the different maps.

Do you think this would help splitting them up?

Splitting them up into several layers won’t help, and could even make things worse since it’ll mean dealing with even more cells (albeit empty ones).

However, you may want to split the map up into multiple maps, so that instead of one giant map, you have a bunch of smaller ones. Since they’re already separate maps to begin with, why load them into one giant map in the first place?

Well, we had our own inbuilt master editor from 2005 that we made in C++ and everything back then was just built on 1 single map with no need to separate it as our editor handled it completely fine at the time, but around 2013 we sadly lost all our code for the editor and was never really able to get back to where we was and the game was shut down… Now, 10 years later I have decided to reboot our MMO with a small 200-500 playerbase community but to make a full dedicated editor from scratch will take us a huge amount of time, hence why we landed with Tiled.

Here is a screenshot of our game with some players and some items they looted from another clan they killed.

You’ll probably have a better time editing this giant map as a collection of smaller maps. You can use a World to store where each map is located relative to other maps, and to navigate between maps.

A downside to Worlds is Tiled scripting does not currently have proper access to Worlds, so you’ll have to do some extra work if you need to load your .dat file into a World or save a World’s worth of maps into a single file. But generally, it’s a good idea to keep an MMO’s sections in smaller files that the engine can access independently of one another anyway.

You don’t currently hire yourself out for a day or 2 to help try and explain a few things in our dev discord channel? ;>

There is currently 6 of us working on the game, and would be really interested to hear from you in private to help us through this, or to at least get a basic understanding of where we should start with the worlds and maps?

Can you try to disable “Show Tile Animations” from the “View” menu? Even though this should not be causing repaints if there are no animated tiles, it could be that this is related, since when you don’t do anything there should not be CPU usage at all regardless of map size (unless animations are playing, which cause the whole view to get repainted continuously).

The grid rendering can also be quite expensive when a lot of lines are visible, so it might help to turn off the grid (View > Show Grid).

Thanks for the suggestion @bjorn. I work with @MalakezDarnos on the project, and I tried disabling all the features in the “View” menu, including “Show Tile Animations” and “Show Grid” but that didn’t help much in terms of speed. My feeling is that tiled rendering engine doesn’t do any kind of smart optimisation when displaying a large amount of tiles. It just stores everything in RAM (which is confirmed when I look at the performance section of the task manager) and it takes a lot of time to access everything and re-render a large bunch of tiles at once. I don’t see any easy workaround to this, but to optimise the rendering engine which would involve a lot of work I suppose. Does that sound sensible or am I wrong?

Also one thing to note is that the 100% CPU usage issue isn’t quite accurate (sorry @MalakezDarnos :slight_smile: ), on my laptop it is only in the 10-20% range, especially when making move operations. However it takes quite a large amount of RAM, in the >=1GB ballbark, which is quite a bit but not crazy in modern standards. I suspect that what takes a lot of time is indeed the rendering and perhaps suboptimal cache usage.

@twacks Did you by any chance enable hardware acceleration (OpenGL) in the preferences? This option causes the entire view to be repainted whenever it needs an update, whereas normally Tiled stays quite efficient even with a large amount of tiles, by only repainting the parts of the view affected by movements or changes.

I tried with and without, the result is the same as far as I’m concerned.