Patch: Trip History

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Patch: Trip History

Post by chrissicom »

This might be a bug that I caused tho due to removing

Code: Select all

case WE_DESTROY:
free(v->trip_history_pchange_array);
free(v->trip_history_TBT_array);
free(v->trip_history_TBT_change_array);
v->trip_history_avg_daylength = 0;
v->trip_history_profitpd = 0;
v->trip_history_total_change = 0;
v->trip_history_total_profit = 0;
break;
I will look into it :) but it would also be nice if the patch author can say something about it :)
Molp
Engineer
Engineer
Posts: 3
Joined: 27 Jul 2003 16:06

Re: Patch: Trip History

Post by Molp »

Yeah sorry for the long silence but holidays and real life have taken over :| I'll try to fix it this week and maybe add some new features :!:
The Zero
Engineer
Engineer
Posts: 5
Joined: 26 Aug 2007 16:12

Re: Patch: Trip History

Post by The Zero »

Molp wrote:maybe add some new features :!:
Sounds great. I have one more feature request :). Is it possible to copy trip history when (auto)renewing vehicles? It makes perfect sense to keep it - you would be able to see the benefits of upgrading the train.
aYs-Halo
Engineer
Engineer
Posts: 4
Joined: 31 Aug 2007 13:55

Re: Patch: Trip History

Post by aYs-Halo »

Hello everyone,
I wanna report a bug :)

I hope the following picture describes my current situation with enough detail:
http://funat.fu.funpic.de/openttd/1.png

Now, at the beginning all the trains were of length 14, which i then decreased to the total length of 7 (all of them).
I then used the trip history feature (which is awesome btw) to see how much more profit I get by using a lot of short trains instead of many long ones.
The bug occured to me when i looked at one of the trains that are doing the final route (which certainly shouldnt have transfer values):
http://funat.fu.funpic.de/openttd/2a.png

So well I thought, who cares? Just sold the train and replaced it. Everything was fine with the new train. However (!), I checked all of my other trains if that bug has "hit" any of the others... and indeed, now i found another one:
http://funat.fu.funpic.de/openttd/2b.png

Oh, and btw, this value will stay there forever, and will remain at the top

If you need any further details, please ask, i really want this bug fixed 'cause the patch is almost the best one ever to me (Right after the pbs and the auto-signal complete)
In case you want the savegame -> here it is:
http://funat.fu.funpic.de/openttd/savegame.sav
(latest ChrisIn version)


Halo


//edit:
*update*
Look at this:
http://funat.fu.funpic.de/openttd/3.png
:(
User avatar
Red*Star
Transport Coordinator
Transport Coordinator
Posts: 355
Joined: 12 Nov 2005 19:46
Location: Germany
Contact:

Re: Patch: Trip History

Post by Red*Star »

Also commendation from me: This patch is really nice ;).

But there is [at least] one bad thing, maybe:
Is it possible that there is a bug in the "Change" value calculator? If you look at this image:
wrong percentage calculation
wrong percentage calculation
sample.png (88.84 KiB) Viewed 6828 times
I don't know what you /want/ to be the "Change" value to be, but it seems that it /should/ represent the change of the profit in relation to the last time the vehicle made profit by carrying cargo. In that case the green 90% should be 931%, because 866 L is the 1031-fold of 84 L. It seems you've mixed up the calculation for negative and positive values in a very strange way. However, it *should* be computed like this:

Code: Select all

percentage = (new_value / old_value - 1) * 100%
Like sun is to the dark soil,
so is true enlightenment to the soil's friends.

N.F.S. Grundtvig
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Patch: Trip History

Post by XeryusTC »

Growth should be calculated by

Code: Select all

percentage = (new - old) / old * 100%
IIRC from economy class 3 years ago.
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
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: Patch: Trip History

Post by cirdan »

Red*Star wrote:

Code: Select all

percentage = (new_value / old_value - 1) * 100%
XeryusTC wrote:Growth should be calculated by

Code: Select all

percentage = (new - old) / old * 100%
IIRC from economy class 3 years ago.
My math may be very wrong, but aren't those formulas just the same?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: Trip History

Post by DaleStan »

They are exactly the same. Don't forget operator precedence, Xeryus.

Code: Select all

(new - old) / old * 100% = (new / old - old / old) * 100%
                         = (new / old - 1) * 100%
                         = new / old * 100% - 100%
To avoid floating-point math, it would be better to do the multiplication before the division, though.

My economics teacher was fond of

Code: Select all

2 * (new - old) / (new + old)
So that's what I used for that class. When in Rome...
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Patch: Trip History

Post by XeryusTC »

It seems to be the same indeed, I didn't even realise it until you guys pointed it out to me.
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
User avatar
Red*Star
Transport Coordinator
Transport Coordinator
Posts: 355
Joined: 12 Nov 2005 19:46
Location: Germany
Contact:

Re: Patch: Trip History

Post by Red*Star »

Still I personally prefer a simple factor for growth, that is the easiest one to understand and to calculate with - so e.g. the factor 1.02 for 2% of growth. (I know that it doesn't matter which way you denote the growth as long as the terminology is clear and there exists a bijection between the two growth indicator variants, but I simply don't understand why all these strange economists etc. are enjoying the percentage variant. It's probably just the science cleft that I can't understand it ;).) But enough ot.
Like sun is to the dark soil,
so is true enlightenment to the soil's friends.

N.F.S. Grundtvig
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Patch: Trip History

Post by MagicBuzz »

I took a look at this patch with the ChrisIN.

So far I understand it, I think there is an issue with "complex" trips.

I design a lot of train passengers routes, with many stops (I design a line that cross the whole map, and try to desserve a maximum of cities).

As a result, my trains stop 2 times at everystation (only one time for edge stations) during the same trip.

But as I see, the trip history patch just show the values from any "mini" trip, IE each time the vehicle got revenues. I think if should compute a total for each station until the order looped back to first order, so we would be able to see values for actual trips.

If it already should work like this, then it's buggy as I got trips information for each visited station ;)
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Patch: Trip History

Post by chrissicom »

I agree with you MagicBuzz the trip(!) history should really display a history of real trips and not just station to station trips. I have some passenger lines with 40+ stations and some are very far apart while others are pretty close and that produces quite useless trip histories. For station to station industry lines the patch is very useful tho :) so maybe an update will improve this... maybe the patch should consider a trip start at station and trip ends when this station is reached again. That might also reduce checks for the stations the train passes as it will only need to remember the starting station which is an easy task by looking at the orders (assuming the trip starts at the first station otherwise things get complicated again).
//edit:
*update*
Look at this:
http://funat.fu.funpic.de/openttd/3.png
Is that yellow money transfer income? If so the patch doesn't seem to consider this income. I don't know how this "virtual income" is done by the game mechanics so the patch author would need to look at this.
aYs-Halo
Engineer
Engineer
Posts: 4
Joined: 31 Aug 2007 13:55

Re: Patch: Trip History

Post by aYs-Halo »

i dont think that thats transfer income, but anyways, there's something buddy, since some of those numbers wont disappear/move on the next delivery
User avatar
Lupin III
Engineer
Engineer
Posts: 66
Joined: 11 Jul 2007 16:36

Re: Patch: Trip History

Post by Lupin III »

On the station-to-station-trip vs. round-trip history: I don't know where I'v have seen this, but a recent screenshot showed a patch, where a list could be expanded by a plus symbol (like in windows explorer). So when opening the trip history window, maybe the roundtrips could be shown folded and then be expanded to show the station-to-station trips in detail. Of course there may be an issue, if someone is building 40+ station roundtrips like chrissicom that maybe run hundred trains. Multiply this with ten for the all roundtrips and you sure have a lot of numbercrunching to do.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Patch: Trip History

Post by chrissicom »

Hehe, that would be way above my coding skills but it'd be nice if the patch was modified like this. I think it's more an issue of RAM usage than performance impact and even that shouldn't be a problem I think. But as I said I can't code this myself so someone else or maybe the original author should update this patch :)
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch: Trip History

Post by Vaulter »

Lupin III wrote:On the station-to-station-trip vs. round-trip history: I don't know where I'v have seen this, but a recent screenshot showed a patch, where a list could be expanded by a plus symbol (like in windows explorer). So when opening the trip history window, maybe the roundtrips could be shown folded and then be expanded to show the station-to-station trips in detail. Of course there may be an issue, if someone is building 40+ station roundtrips like chrissicom that maybe run hundred trains. Multiply this with ten for the all roundtrips and you sure have a lot of numbercrunching to do.
without expanded plus, but with round-trip:
Attachments
trip-history.r22604M.patch
(32.71 KiB) Downloaded 392 times
2011-07-31-153133_1920x1080_scrot.png
2011-07-31-153133_1920x1080_scrot.png (86.32 KiB) Viewed 6035 times
User avatar
Vaulter
Traffic Manager
Traffic Manager
Posts: 185
Joined: 21 Dec 2004 05:35
Skype: andrey-zaharov
Location: St. Petersburg, Russia
Contact:

Re: Patch: Trip History

Post by Vaulter »

Fixed and reworked version
Attachments
trip-history.r22604M.patch
(32.8 KiB) Downloaded 393 times
bcmpinc
Engineer
Engineer
Posts: 19
Joined: 18 Nov 2008 00:10

Re: Patch: Trip History

Post by bcmpinc »

Updated to trunk (r25578).
Attachments
trip-history.r25578.patch
(30.41 KiB) Downloaded 277 times
mtm2207946034
Engineer
Engineer
Posts: 12
Joined: 30 Mar 2015 20:04

Re: Patch: Trip History

Post by mtm2207946034 »

Updated to trunk.
trip-history.r27210.patch
Updated to trunk (about release 1.5.0). Behavior is unchanged to previous published patch.
Savegames of previous patch cannot be loaded. Savegames of current patch cannot be loaded with offical release.
(31.32 KiB) Downloaded 338 times
(Minor change: Trip history window can be opened by Ctrl + Click to vehicle details icon.

I extended the patch by average occupancy during a trip. Occupancy is calculated as loaded freight / capacity. The shown value of a trip is averaged using manhattan distance between two stops as weight.
trip-history_ex.r27210.patch
Extended patch with occupancy of 10 last trips in trip history window.
Same restrictions of savegames like unchanged patch.
(35.28 KiB) Downloaded 316 times
Average occupancy during a trip is shown in right column of trip history window.
Average occupancy during a trip is shown in right column of trip history window.
Extended_Trip_History.png (8.71 KiB) Viewed 5260 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest