Performance issues on large maps

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
GrandSeverus
Engineer
Engineer
Posts: 23
Joined: 20 Jul 2022 13:52

Performance issues on large maps

Post by GrandSeverus »

So I am playing on large maps 2048x4096 or 4096x4096.

I have some cities over 400k citizens.

When I try to zoom out and move without the game pausing I am getting stutters.

Do I need to invest in better hardware or there is nothing I can't do?

My specs:

i5-4460
rx570

Thanks for the help,
Cheers,

P.S.
Will putting this game on ssd help in any way ?
User avatar
kamnet
Moderator
Moderator
Posts: 8548
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Performance issues on large maps

Post by kamnet »

You can try a faster processor, but it may make very little difference. Most of the game only runs on a single core (some processes have been updated to run on multiple cores), it doesn't touch your graphics card at all. Running at game at 2048x2048 or beyond is pushing the limits of a clone of a game designed for PC hardware 30 years ago.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Performance issues on large maps

Post by Eddi »

the short answer is: no, throwing more hardware at it probably doesn't solve anything.

much of the game performance is determined by a single thread, and single thread perforance hasn't increased as fast in the past 10 years (although there still were some improvements, it hasn't quite kept up with moore's law)

there's generally two things that need performance:
  1. calculating what is happening in the world
  2. getting everything drawn on the screen
(there's a performance/framerate monitor in the ? menu that gives slightly more detailed information)

the first thing is influenced mainly by map size and the amount of vehicles travelling, plus each piece of cargo. with the exception of modern additions like cargo distribution, most of this was designed to run in a single thread, because everything depends on each other (like waiting at signals, collisions and stuff) and untangling that into several threads and then recombining it at the end is complicated, and probably creating more overhead than it speeds up things.

the second thing is influenced by how much is visible at once. here the main problem is that modern graphics cards are designed to handle 3D objects, which get smaller and less detailed the further away you go. what they aren't designed for is handling isometric worlds where everything has the same level of detail no matter how far it is away, plus old gimmicks like 8bit palette, animated colours, etc. which got left out of modern graphics cards because no modern game uses these tricks. when you zoom in, everything visible on the screen has 1 sprite to draw, which gets thrown into a pool, which needs to get sorted back-to-front for drawing. when you zoom out, still everything has 1 (now slightly smaller) sprite to draw, which still gets thrown into a (now much bigger) pool that needs to be sorted. due to the low demand, i don't think anyone has ever researched how to do this efficiently with multiple threads


now, for the scenario drawn here: scrolling zoomed-out world with unpaused game, these two things collide with each other head on.

if you zoom out while paused, and then scroll around, the part of the map that was visible before gets moved around the screen, and only the parts that became newly visited actually have to be redrawn. but when the game is unpaused, and things move around, also those areas have to be redrawn (on a busy world, this is probably the whole screen)

so the drawing has to wait for the game simulation to finish, the simulation has to wait while drawing is happening. either of these things on its own are likely to bring a modern system to the edge of performance limits, so combining them creates a perfect storm.

conclusion: just pause when you zoom out.
GrandSeverus
Engineer
Engineer
Posts: 23
Joined: 20 Jul 2022 13:52

Re: Performance issues on large maps

Post by GrandSeverus »

kamnet wrote: 31 Dec 2022 05:08 You can try a faster processor, but it may make very little difference. Most of the game only runs on a single core (some processes have been updated to run on multiple cores), it doesn't touch your graphics card at all. Running at game at 2048x2048 or beyond is pushing the limits of a clone of a game designed for PC hardware 30 years ago.
How about an ssd? It usually helps today's games.
skc
Traffic Manager
Traffic Manager
Posts: 170
Joined: 17 Sep 2022 02:02

Re: Performance issues on large maps

Post by skc »

GrandSeverus wrote: 31 Dec 2022 11:15
kamnet wrote: 31 Dec 2022 05:08 You can try a faster processor, but it may make very little difference. Most of the game only runs on a single core (some processes have been updated to run on multiple cores), it doesn't touch your graphics card at all. Running at game at 2048x2048 or beyond is pushing the limits of a clone of a game designed for PC hardware 30 years ago.
How about an ssd? It usually helps today's games.
Given that it sounds like the bottleneck is the CPU, there's likely no gameplay advantage in using an SSD - it'll make loading and saving faster, but that's probably about the limit.
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7240
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Performance issues on large maps

Post by Redirect Left »

GrandSeverus wrote: 31 Dec 2022 11:15
kamnet wrote: 31 Dec 2022 05:08 You can try a faster processor, but it may make very little difference. Most of the game only runs on a single core (some processes have been updated to run on multiple cores), it doesn't touch your graphics card at all. Running at game at 2048x2048 or beyond is pushing the limits of a clone of a game designed for PC hardware 30 years ago.
How about an ssd? It usually helps today's games.
Disk access speeds aren't an issue for OpenTTD, or at least there's no difference I notice between using an old 5400RPM HDD (probably tops at about 60 to 80MB/s) with my current NVMe SSD with > 5000MB/s read speed when it comes to OpenTTD.
I use an i9-12900k and OpenTTD does become noticeably slower at times for me too. I have over 5000 trains on a 2048x2048 map, it's not quite enough to slow it down beyond normal 1x speed, but the fast forward button now does... basically nothing.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1729
Joined: 30 Mar 2005 09:43

Re: Performance issues on large maps

Post by peter1138 »

Not sure how relevant this is these days but If you're also using a lot of add-on graphics sets, you might be hitting the default sprite cache limit, in which case the LRU cache hits nearly every frame which is a massive slowdown.

Look for `sprite_cache_size_px` in openttd.cfg and try doubling it or so. Default appears to be 128.
He's like, some kind of OpenTTD developer.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 3 guests