Some personal changes

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

Post Reply
JeroenDStout
Engineer
Engineer
Posts: 2
Joined: 02 Feb 2018 15:10

Some personal changes

Post 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.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Some personal changes

Post 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.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Some personal changes

Post by HackaLittleBit »

Nice idea!

Why did you not send a patch?
JeroenDStout
Engineer
Engineer
Posts: 2
Joined: 02 Feb 2018 15:10

Re: Some personal changes

Post 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.
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Some personal changes

Post 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)
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Some personal changes

Post 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
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5656
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Some personal changes

Post 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.
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7238
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Some personal changes

Post by Redirect Left »

Very useful changes, would be nice to see these merged into one of the larger patch packs later on.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Google [Bot] and 11 guests