Page 1 of 1

Some personal changes

Posted: 02 Feb 2018 15:53
by JeroenDStout
I made some personal changes that I would like to share, in case some people are interested in implementing them further!

Just for the record: I branched my code of JGR's patch git repository. Obviously anybody can do with the changes what they wish, and I am sure they could be turned into a diff against the base game by someone who is more experienced in that than I am..
My changes can be found on this branch on github. I had a few issues getting the code to compile with Visual Studio, so ignore the first few commits.

The changes so far
Running early economies (1870's) you can easily need a lot of delivery vehicles as they are slow and have low capacity. This gives two issues:
1. Vehicles on a conditional delivery system (goto A, if loaded go to B, goto A, if loaded go to C, etc) will circle the pick-up station
2. Vehicles tend to pick the same drive-through loading area as the one in front of them, causing a block despite there being open bays.

So first off, I made vehicles which see their next actual order is the same station as they are at immediately go back to loading:
Image

This has the consequence many vehicles can be waiting for their delivery station to have available things and depart immediately:
Image

This also works for ships and trains.

I also removed a check from the refit code that erroneously seems to think vehicles are already refitted, causing them to not refit in this home station scenario.

For the second point, I modified yapf to check the tile in front of the current vehicle for other vehicles; and for every vehicle there note the tiles they are headed to right now. These tiles are then given a higher cost when traversed, and an even higher cost if they are loading areas. This means vehicles are willing to travel farther if it means not going the same way as the person in front of them. This can help clear up clogged cities, too, as vehicles are more willing to diversify.

Before:
Image

With modifications:
Image

This idea came about when I noticed vehicles make the wrong loading area choice because they make the decision to turn into it before the vehicle in front of them has entered the loading tile; meaning they think the tile is free whereas really it is already occupied.

This changes are not guaranteed to be stable or good, but as I made them and am enjoying my networks more with them, I thought I would share.

Re: Some personal changes

Posted: 02 Feb 2018 17:42
by Wahazar
BTW, lack of non-articulated horse vehicles in egrvts was a reason, why I started polroad grf project, which offer both small single horse carriages as well as multiple horse "articulated" ones.

Re: Some personal changes

Posted: 02 Feb 2018 19:03
by HackaLittleBit
Nice idea!

Why did you not send a patch?

Re: Some personal changes

Posted: 02 Feb 2018 19:32
by JeroenDStout
HackaLittleBit wrote:Nice idea!

Why did you not send a patch?
I am beginning to think I should! I just never modified OpenTTD before (I hail from OpenRCT2!), and the features were a bit experimental.

So to submit a patch I'll have to check what to actually do for that which may take me a bit longer to figure out.

Re: Some personal changes

Posted: 02 Feb 2018 21:30
by HackaLittleBit
I send you a pm with the patch

Re: Some personal changes

Posted: 03 Feb 2018 00:00
by supermop
JeroenDStout wrote:This idea came about when I noticed vehicles make the wrong loading area choice because they make the decision to turn into it before the vehicle in front of them has entered the loading tile; meaning they think the tile is free whereas really it is already occupied.
Nice - this is actually one of the most annoying things in game for me - as it makes timetabling trams etc needlessly difficult. (can't rely on slack time at a lay-up station to get back on schedule, as the late vehicle always gets stuck behind the one ahead)

Re: Some personal changes

Posted: 03 Feb 2018 11:27
by Eddi
both of these changes sound great, and are something i have wished for before.

does the station order thing work with conditional orders?
  1. goto A
  2. if load < 20% jump to 1
  3. goto B

Re: Some personal changes

Posted: 03 Feb 2018 11:38
by andythenorth
JeroenDStout wrote:This idea came about when I noticed vehicles make the wrong loading area choice because they make the decision to turn into it before the vehicle in front of them has entered the loading tile
+1 this is useful if it works. RV stops get contended easily because of the current behaviour.

Re: Some personal changes

Posted: 03 Feb 2018 12:47
by Redirect Left
Very useful changes, would be nice to see these merged into one of the larger patch packs later on.