Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Jan 16, 2019 11:24 am

All times are UTC




Post new topic  Reply to topic  [ 19 posts ] 
Author Message
PostPosted: Sat Feb 06, 2010 10:58 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7260
This patch might help finding bottlenecks in the network by giving locations where trains wait for a long time.

This uses m7 for rail tiles [not road crossings or tunnel-/bridgeheads] as an 8-bit counter.

every 4 ticks that a train waits at a signal, the counter is increased by 1 [takes 1024 ticks to get to maximum of 255], every 256 ticks the counter is decreased by 25%. this emphasises trains that are currently waiting, and slowly phases out trains that have been waiting in the past months.

the values are then painted on the smallmap when you open the "routes" view.

Edit: updated to r19525


Attachments:
Ravenswald Transport, 12th Oct 1987.png
Ravenswald Transport, 12th Oct 1987.png [ 102.94 KiB | Viewed 13187 times ]
stuck_trains3.diff [3.23 KiB]
Downloaded 234 times

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Last edited by Eddi on Mon Mar 29, 2010 10:23 pm, edited 3 times in total.
Top
   
PostPosted: Sun Feb 07, 2010 12:31 am 
Offline
President
President
User avatar

Joined: Sun Jun 18, 2006 6:18 pm
Posts: 953
Location: Switzerland
tested on current #openttdcoop PublicServer, but we use mostly block...

Eddi wrote:
NOTE: currently seems to work only at path signals


... so I didn't find many red dots, but it has, also orange and green. :-)


Nice idea anyway. :-D

Greets
Ammler

_________________
Image
Town Names: Image Portuguese Image Belarusian Image French Image Swiss · Image Temperate Lumber Mill
Still work in progress: OpenGFX or/and OpenSFX - Please help!


Top
   
PostPosted: Sun Feb 07, 2010 1:33 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7260
Well, i know where to put the check for the block signals, but the counting seems off then, maybe that code path is not run every tick, need to investigate that further.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Sun Feb 07, 2010 5:44 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 02, 2005 11:05 am
Posts: 15415
Skype: XeryusTC
Location: localhost
Very nice patch indeed, it helps you identify problem areas in a way that the traffic overview doesnt show. Too bad it currently only works with path signals though.

_________________
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image


Top
   
PostPosted: Sun Feb 07, 2010 9:37 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7260
updated the patch, should now work with block signals, too.

the problem is, the block signals are handled in TrainController() which does not appear to be run every tick for stopped trains. initial tests have shown this to be every 5 ticks, but i can't be sure if that holds for all vehicles, so counting might be slightly off.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Feb 09, 2010 12:53 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Wed May 16, 2007 4:59 pm
Posts: 2825
Nice :) Simple but effective.

_________________
GRVTS/eGRVTS --- Generic Tram Set --- UK Town Set --- zBase ---RichardWheeler.net


Top
   
PostPosted: Mon Mar 29, 2010 1:49 pm 
Offline
President
President
User avatar

Joined: Sun Jun 18, 2006 6:18 pm
Posts: 953
Location: Switzerland
The patch does still apply to trunk, but somehow the gui is broken, how easy to fix?

-Ammler

_________________
Image
Town Names: Image Portuguese Image Belarusian Image French Image Swiss · Image Temperate Lumber Mill
Still work in progress: OpenGFX or/and OpenSFX - Please help!


Top
   
PostPosted: Mon Mar 29, 2010 10:10 pm 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7260
quick skim says in smallmap_gui.cpp:GetSmallMapRoutesPixels there was an "else if (t == MP_RAILWAY)" block added, this must be replaced by the stuck-counter block.

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Mar 30, 2010 12:03 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2650
Location: Lost in spaces
Thank you for the update Eddi.

While I was reading your patch ...
Would it not be better for codingstyle to have :
Code:
/**
* Colour Coding for Stuck Counter
*/
...

delared after the violet aray?

I know it does not do anything to the way it works, it would just look better if your patch is to hit trunk. ;)

Needless to say I like this patch. It helps a lot to identify the troubled areas in my long lasting game.

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Tue Mar 30, 2010 1:15 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7260
ChillCore wrote:
[...]after the violet aray?

that part was introduced after i wrote the patch, i didn't check whether it needs to be reordered...

Quote:
if your patch is to hit trunk. ;)

honestly, i don't expect that to happen...

first, it doesn't record trains waiting on bridges or in stations. (this might be solved by using the counter at the signal tile, not at the tile the front engine waits, but that is difficult to determine, e.g. trains may be "waiting for path" while not at a signal at all)

second, it needs a better GUI representation, i just kinda hijacked the "routes" view...

... i don't think i'm going to do either of that ...
feel free to pick it up, though...

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Mar 30, 2010 2:04 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2650
Location: Lost in spaces
Eddi wrote:
that part was introduced after i wrote the patch, i didn't check whether it needs to be reordered...

Because I have been quite busy around that part of the code it kinda jumped out towards me. :)

Quote:
honestly, i don't expect that to happen...

That would be a shame because it is very useful.

Quote:
first, it doesn't record trains waiting on bridges or in stations. (this might be solved by using the counter at the signal tile, not at the tile the front engine waits, but that is difficult to determine, e.g. trains may be "waiting for path" while not at a signal at all)

I did not notice that. My bridges usually are enclosed by signals to minimize the gap and I still put signals in front of my stations eventhough they have a build in signal since some time now (I just think it looks better).

Quote:
second, it needs a better GUI representation, i just kinda hijacked the "routes" view...

... i don't think i'm going to do either of that ...
feel free to pick it up, though...

Would introducing a button for it and using for example "MP_WAITING_SIGNAL_TIME" be enough?
If so I might give it a try ...
My guess is that the rail colours would have to be preserved for trunk inclusion to be considered.
I think I will start by including it in my patchpak to see how it behaves with other patches (Signals in tunnels and on bridges).

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Tue Mar 30, 2010 2:44 am 
Offline
Tycoon
Tycoon

Joined: Wed Jan 17, 2007 12:14 am
Posts: 7260
ChillCore wrote:
My guess is that the rail colours would have to be preserved for trunk inclusion to be considered.

i tried, but the rail colour is very bright, it's difficult to make out the coloured spots in there, which is why i made it black. the original colouring also includes two pixels of the terrain, leaving only two pixels for the rail colour. i made it use the whole 4 pixels.

Quote:
I think I will start by including it in my patchpak to see how it behaves with other patches (Signals in tunnels and on bridges).

that should be easy to determine: if they use m7 for rail tiles, it's not going to work (the grass growth patch is the only one i know that does that)

i did not modify bridges or stations or level crossings, so it's unlikely to conflict anywhere...

_________________
You might not exactly be interested in Ferion, but if you are, have fun :)


Top
   
PostPosted: Tue Mar 30, 2010 1:05 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2650
Location: Lost in spaces
Eddi wrote:
i tried, but the rail colour is very bright, it's difficult to make out the coloured spots in there, which is why i made it black. the original colouring also includes two pixels of the terrain, leaving only two pixels for the rail colour. i made it use the whole 4 pixels.

Maybe having a seperate view will solve that.

Quote:
that should be easy to determine: if they use m7 for rail tiles, it's not going to work (the grass growth patch is the only one i know that does that)

Thanks for the info.
I tried using m8 for the grass growth but that does not seem to exist. :(

Quote:
i did not modify bridges or stations or level crossings, so it's unlikely to conflict anywhere...

Hmm grass or signals ...
Signals seem less cpu intensive. (Less places to check)
But this is off-topic here.

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Tue Mar 30, 2010 6:33 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon Jun 14, 2004 11:27 pm
Posts: 582
Location: Berlin, Germany
ChillCore wrote:
and I still put signals in front of my stations eventhough they have a build in signal since some time now (I just think it looks better).

They don't. What you see is simply the general don't-just-crash-my-trains protection. Just compare the position of the two waiting trains in http://www.tt-ms.de/forum/attachment.php?aid=1014.

-- Michael Lutz


Top
   
PostPosted: Tue Mar 30, 2010 7:01 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Oct 04, 2008 11:05 pm
Posts: 2650
Location: Lost in spaces
Michi_cc wrote:
They don't. What you see is simply the general don't-just-crash-my-trains protection.
...

Ah, OK. I assumed that they had like depots. Depots do have one built in them, don't they?
If not I have some more reading to do. :)

/me should stop assuming ...

_________________
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.


Top
   
PostPosted: Tue Mar 30, 2010 7:55 pm 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Mon Jun 14, 2004 11:27 pm
Posts: 582
Location: Berlin, Germany
Depots have signals built in. But as a train inside a depot has no real position anyway, it wouldn't make a difference where the train waits for a free path :)

-- Michael Lutz


Top
   
PostPosted: Sat Oct 01, 2011 8:30 am 
Offline
Engineer
Engineer

Joined: Wed Jan 06, 2010 6:06 pm
Posts: 36
Updated to current trunk


Attachments:
stuck_trains_r22958.diff [3.39 KiB]
Downloaded 155 times
Top
   
PostPosted: Sun May 12, 2013 3:44 pm 
Offline
Engineer
Engineer

Joined: Wed Jan 06, 2010 6:06 pm
Posts: 36
Updated to current trunk


Attachments:
stuck-trains-r25234.diff [3.43 KiB]
Downloaded 132 times
Top
   
PostPosted: Mon Apr 07, 2014 8:47 am 
Offline
Chief Executive
Chief Executive
User avatar

Joined: Mon Jan 14, 2008 3:51 pm
Posts: 644
Location: PL
I refreshed the patch:
- change: stuck counter now decreases to 0 so a highlight will disappear after certain period of time (previously once highlighted signal was staying highlighted for eternity)
- removed magic constants
- fixed coding style (whitespace)
- moved new functions in rail_map.h higher (to keep MakeXXX functions on the bottom as usually)


Attachments:
stuck_trains_r26405.diff [3.35 KiB]
Downloaded 94 times

_________________
:] don't worry, be happy and checkout my patches
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 19 posts ] 

All times are UTC


Who is online

Users browsing this forum: BeSt-Com and 5 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.