Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri Feb 22, 2019 11:46 pm

All times are UTC




Post new topic  Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sat Jan 12, 2019 12:44 pm 
Offline
Engineer
Engineer

Joined: Fri Aug 31, 2012 5:09 am
Posts: 18
I'm trying to get an estimate of how slow it is to redraw the "cargo flow legend" overlay in the game, in the hope of modifying the GUI so that the delay when redrawing the overlay (after panning or zooming) isn't so apparent. Can someone give me a really large cargodist save (the more stations and connections (i.e. edges between two stations) the better)?


Top
   
PostPosted: Sun Jan 13, 2019 3:42 am 
Offline
Engineer
Engineer

Joined: Thu Jan 21, 2016 11:04 pm
Posts: 46
778 stations, cargodist on all cargos. Needs JGR patchpack.


Attachments:
3.sav [1.93 MiB]
Downloaded 41 times
Top
   
PostPosted: Sun Jan 13, 2019 4:00 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Aug 08, 2005 1:46 pm
Posts: 1885
Location: Ipswich
I should point out that linkgraph recalculation and details of how the graphical overlay is implemented differ significantly between trunk and that patchpack.
It already includes solutions to resolve the issue of the cargodest overlay not updating in a timely manner when being scrolled.
Using a JGR patchpack savegame/version will probably not give you the correct results for modifying trunk.

The delay isn't caused by how long it takes to actually do the rendering and isn't related to how many nodes/links are on-screen,

For trunk savegames, try some of these: https://wiki.openttdcoop.org/PublicServ ... ll_of_Fame

_________________
Ex TTDPatch Coder, Grumpy Greymuzzle
Avatar by MoonsongWolf.
Patch Pack, Github
Dad-Coder since April 2018


Top
   
PostPosted: Sun Jan 13, 2019 4:08 pm 
Offline
Engineer
Engineer

Joined: Fri Aug 31, 2012 5:09 am
Posts: 18
Thanks for the save.

Quote:
The delay isn't caused by how long it takes to actually do the rendering and isn't related to how many nodes/links are on-screen

From what I think the code is doing, it seems that someone realised iterating through all stations and edges is too slow to be done on every single tick, so (to prevent choppy scrolling/resizing) the delay is added to make OpenTTD only need to rebuild the cache once, at the end of the scroll/resize. It won't be related to the number of nodes/links on screen, but amount of work for rebuilding the cache is proportional to the number of nodes/links in total on the whole map. Am I correct? :)


Top
   
PostPosted: Sun Jan 13, 2019 5:47 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Aug 08, 2005 1:46 pm
Posts: 1885
Location: Ipswich
btzy1996 wrote:
From what I think the code is doing, it seems that someone realised iterating through all stations and edges is too slow to be done on every single tick, so (to prevent choppy scrolling/resizing) the delay is added to make OpenTTD only need to rebuild the cache once, at the end of the scroll/resize. It won't be related to the number of nodes/links on screen, but amount of work for rebuilding the cache is proportional to the number of nodes/links in total on the whole map. Am I correct? :)

That is pretty much the case, plus the cache is re-calculated periodically.
The details of how the delay is determined/handled have been changed recently.
Resizing without scrolling (for the main viewport at least) doesn't trigger a sooner cache rebuild, so the display is only updated after the next periodic update.

For reference some of the things which I've already done in this area are:

* For the smallmap: just cache the whole graph, most of it will be visible anyway
* For viewports: incrementally update the existing cache as necessary during scrolling or zooming, and cache a slightly larger area than the viewport area to give some margin
* Cache more node and edge details to avoid needing to recalculate them during drawing
* Better line visibility/clipping algorithm (for whether lines intersect the drawing area and should be cached and/or drawn)
* Some general improvements to the cache performance

They're in this repo: https://github.com/JGRennison/OpenTTD-patches

_________________
Ex TTDPatch Coder, Grumpy Greymuzzle
Avatar by MoonsongWolf.
Patch Pack, Github
Dad-Coder since April 2018


Top
   
PostPosted: Mon Jan 14, 2019 4:22 am 
Offline
Engineer
Engineer

Joined: Fri Aug 31, 2012 5:09 am
Posts: 18
Thanks for the information! I'll be sure to check the code in your patch pack :)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2019 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2019.
Hosted by Zernebok Hosting.