JGR's Patch Pack

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

User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: JGR's Patch Pack

Post by MagicBuzz »

I think the 3iff's problem is related to something I experience especially with pass-through stops, but the "bug" appears to be present for classic truck stops too.

When many trucks are heading to the same stop, they will choose the nearest empty slot.

This will work fine with :
- Not much trucks
- Short loading times
- Automatic (or manually set) separation using timetables
In other words, this will work as long as there are not multiple trucks arriving to the station at the same time.

But as soon as you have many trucks coming at the same time, you will get traffic jams because all trucks will head to the the same empty slot regardless how many other slots are empty and how many other trucks are already heading this slot.
And even worse, when all the slots are full, all coming trucks will head to the nearest slot regardless the number of trucks waiting for this slot.

In my opinion a counter should be added to each loading slot, then the pathfinder should be upgraded to :
- find the station slots with the lower "reservation" count, then choose the nearest if more that 1 slot have the same count of reservations
- "reserve" the chosen slot, just by doing a +1 to the slot's "reservation counter"
- when a truck leaves the slot, just "unreserve" the slot counter (do -1)

I know this could have some side effects when having long routes (trucks reserving a slot months before they actually need it) but as this reservation is just a counter, this would not stuck anything, just make other trucks to head slots a bit more far. This side effect might be fixed by creating a "reserving zone", by example of 10 Manhattan tiles between the truck and the station : no reservation is done until the truck isn't in this zone.

Here is a video showing the problem :
- Buses 1, 2 and 3 will head the nearest empty slot, and will make a traffic jam.
- Buses 4, 5 and 6 will head the second slot that is empty.
- Buses 7 and 8 will head the nearest slot and make the traffic jam bigger.

With my suggestion, bus 1 would go to slot 1, bus 2 to slot 2, bus 3 to slot 1, bus 4 to slot 2 and so on.
At anything the traffic jam would be balanced with the same number of buses heading each slot, rather than, in this example 5 buses heading to 1 slot and 3 to the second one. When bug 6 will leave, 7 and 8 will continue to get stuck to slot 1 while the slot 2 will be empty.

https://youtu.be/cmzJN2fzxqU
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

This slot issue should be easy to fix with a little bit of logic in the src:

1. Counter checks if vehicle is waiting for a slot.
2. Counter determines quantity (n) of slots to scan
3. for each slot: empty/available=0; filled/unavailable=1
4. Counter sequentially scans each slot from #1 through #n
5. If all n slots are not 0, counter rolls over and repeats scan sequence
6. If slot =0 (empty), first vehicle in line enters slot.
7. Counter sets entered slot to 1 (filled) and moves to next count in sequence
8. If no vehicles waiting in line, counter returns to step 1.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: JGR's Patch Pack

Post by MagicBuzz »

I just noticed that OpenTTD is registered to the Microsoft's winget tool (but version is not up to date though).

May you could also register your version as OpenTTD.JRGPP by example?
https://docs.microsoft.com/en-us/window ... r/package/

This would help users to upgrade version as soon as you release a new one on github :)
User avatar
kamnet
Moderator
Moderator
Posts: 8532
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: JGR's Patch Pack

Post by kamnet »

MagicBuzz wrote: 03 Mar 2022 10:30 I just noticed that OpenTTD is registered to the Microsoft's winget tool (but version is not up to date though).
There are two different versions on the store. The one you want is titled "OpenTTD (official)" and is currently at version 12.1. The other is "OpenTTD", it's priced at $1.99 and at version 1.7.2. We don't know who uploaded that one, there's no contact info for them.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: JGR's Patch Pack

Post by MagicBuzz »

Hello Kamnet,

On Windows store, you're right, there are two OpenTTD, and the official one is up to date.

But I'm talking about the commandline "winget" that allows to install and update any program : store and non-store programs as soon as they are registered in its repository.

And there, we find only "OpenTTD.OpenTTD" (it looks like to be the official one) but it's not up to date : version is 12.0 :
Capture d’écran 2022-03-07 173540.png
Capture d’écran 2022-03-07 173540.png (19.69 KiB) Viewed 7120 times
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: JGR's Patch Pack

Post by 3iff »

Ok, I now have a savegame showing the issues I'm having. I haven't yet seen the video from magicbuzz (above) but I'm happy to know someone else has the same problem...

Savegame and a short text file included. Savegame is JGR 46.1 with NO grfs.

Text file is as below.

Savegame to show truck through-bay inconsistencies. JGR 46.1, no grfs used.

The problems occur when there are more trucks than cargo, so they queue.
I am using far more trucks than usual to ensure queueing happens.

Test 1 shows a normal single-bay truck station where vehicles go either side and queue as expected.

Test 2 north shows a double bay approached from one road.
These trucks eventually enter the station clockwise and almost always use bay 1.
They rarely (if ever) use bay 2 or enter by going into the station anticlockwise.
(if the trucks stop queueing, they may behave 'correctly' for a while).

There's a 3rd bay. If that is connected, the trucks will eventually settle into a pattern
where they predominantly use bay 2, rarely using bay 1 or 3 and almost never enter the station anticlockwise.

If the 4th bay is connected, trucks seem to behave far better, using most of the bays and entering
anticlockwise.

My thoughts so far regarding the 2 or 3 bay situation is that the trucks are not aware of the 'end' bay
and I don't understand why they don't enter the station anticlockwise when bays are obviously available.

I haven't yet done any extensive testing if the bays are oriented differently or if the approach
comes from north, south or west (assuming the current example can be considered east).
Attachments
Frinningstone Transport, 20th Jun 1985.sav
(66.62 KiB) Downloaded 68 times
throughbays.txt
(1.31 KiB) Downloaded 67 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

MagicBuzz wrote: 07 Mar 2022 16:38 Hello Kamnet,

On Windows store, you're right, there are two OpenTTD, and the official one is up to date.

But I'm talking about the commandline "winget" that allows to install and update any program : store and non-store programs as soon as they are registered in its repository.

And there, we find only "OpenTTD.OpenTTD" (it looks like to be the official one) but it's not up to date : version is 12.0 :
Capture d’écran 2022-03-07 173540.png
To be honest I've never heard of this utility. I've got no objections to binaries of my branch being on there, but it's not something that I'm prepared to manage at present.
3iff wrote: 08 Mar 2022 10:13 Ok, I now have a savegame showing the issues I'm having. I haven't yet seen the video from magicbuzz (above) but I'm happy to know someone else has the same problem...

Savegame and a short text file included. Savegame is JGR 46.1 with NO grfs.

Text file is as below.

Savegame to show truck through-bay inconsistencies. JGR 46.1, no grfs used.

The problems occur when there are more trucks than cargo, so they queue.
I am using far more trucks than usual to ensure queueing happens.

Test 1 shows a normal single-bay truck station where vehicles go either side and queue as expected.

Test 2 north shows a double bay approached from one road.
These trucks eventually enter the station clockwise and almost always use bay 1.
They rarely (if ever) use bay 2 or enter by going into the station anticlockwise.
(if the trucks stop queueing, they may behave 'correctly' for a while).

There's a 3rd bay. If that is connected, the trucks will eventually settle into a pattern
where they predominantly use bay 2, rarely using bay 1 or 3 and almost never enter the station anticlockwise.

If the 4th bay is connected, trucks seem to behave far better, using most of the bays and entering
anticlockwise.

My thoughts so far regarding the 2 or 3 bay situation is that the trucks are not aware of the 'end' bay
and I don't understand why they don't enter the station anticlockwise when bays are obviously available.

I haven't yet done any extensive testing if the bays are oriented differently or if the approach
comes from north, south or west (assuming the current example can be considered east).
The issue in the save is that the lengths of the vehicles is such that at the instant when the decision whether to turn or not is made, the closest road stop is not full.
Some level of prediction of whether the stop will be filled by some other vehicle at the time the current vehicle arrives is theoretically possible, but difficult to achieve in the general case.
There is no central allocation of road vehicles to road stop positions and/or time slots.
I will take a look in due course but a general solution is unlikely to emerge soon.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: JGR's Patch Pack

Post by 3iff »

Appreciated. I accept it's not a straightforward fix (if ever!) As long as the issue is known about (by people who might have the expertise for solve it) then that's all I can expect.

I will leave it in your hands and hope a solution arrives eventually.

Continued gratitude for the work you put into this.
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: JGR's Patch Pack

Post by dasy2k1 »

HI all,
just went to pull the latest updates .
but getting this error from git...
any suggestions?

Code: Select all

    ~/Games/OpenTTD-patches    jgrpp  git pull                                                                                                                                                                                 1 ✘ 
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

dasy2k1 wrote: 19 Mar 2022 09:59 HI all,
just went to pull the latest updates .
but getting this error from git...
any suggestions?

Code: Select all

    ~/Games/OpenTTD-patches    jgrpp  git pull                                                                                                                                                                                 1 ✘ 
fatal: remote error: 
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
Take a look at https://github.blog/2021-09-01-improvin ... ty-github/, it includes a full explanation.
Ex TTDPatch Coder
Patch Pack, Github
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: JGR's Patch Pack

Post by dasy2k1 »

Yeh managed to fix it, needed to use the

Code: Select all

git remote set-url
to change to https:// from git:// and it worked fine
krokots
Engineer
Engineer
Posts: 1
Joined: 26 Mar 2022 16:14

Re: JGR's Patch Pack

Post by krokots »

I'm not sure if it's a bug, but when I set "show tooltips" to "right click", when I hover over industries it shows the tooltip anyway (without me pressing right click). It disappears when i press right click (it's inverted).
Attachments
Capture6.PNG
(232.2 KiB) Not downloaded yet
Last edited by krokots on 29 Mar 2022 20:27, edited 1 time in total.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

krokots wrote: 29 Mar 2022 20:25 I'm not sure if it's a bug, but when I set "show tooltips" to "right click", when I hover over industries it shows the tooltip anyway (without me pressing right click). It disappears when i press right click (it's inverted).
Thanks, this is fixed now.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7234
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: JGR's Patch Pack

Post by Redirect Left »

Come across an interesting glitch.

If you try to delete the road on this bit of tramway by clicking on road then bulldoze, the game will tell you there is no road here, inconvenient but not a big deal.
If you try to delete the road using the bulldoze option, that is, to destroy the tramway with the road on it, you'll be presented with a game crash of this error.
You can get around (not trigger the crash) if you draw over the tiles with an actual road, and then you can delete the road underneath as normal.

The savegame is attached, and i have saved it so the focus should be in the right area to start with, should you need to test this yourself. I've also attached the dump/crash report, in case it gives you a meaningfully different error to me. This is using 0.47.1 of the PP.
Attachments
DEC2021.sav
(6.22 MiB) Downloaded 50 times
dump.txt
(30.52 KiB) Downloaded 46 times
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Redirect Left wrote: 05 Apr 2022 14:50 Come across an interesting glitch.

If you try to delete the road on this bit of tramway by clicking on road then bulldoze, the game will tell you there is no road here, inconvenient but not a big deal.
If you try to delete the road using the bulldoze option, that is, to destroy the tramway with the road on it, you'll be presented with a game crash of this error.
You can get around (ie: not trigger the crash) if you draw over the tiles with an actual road, and then you can delete the road underneath as normal, it seems to have forgotten it is drawing road sprites when there isn't actually a road to draw anyway.

The savegame is attached, and i have saved it so the focus should be in the right area to start with, should you need to test this yourself. I've also attached the dump/crash report, in case it gives you a meaningfully different error to me. This is using 0.47.1 of the PP.
I have run into this type of issue before, where the tile is in an inconsistent state. I can't seem to find/remember the circumstances of the last time though.
It is a bit difficult to diagnose the source of the problem without knowing what caused the tile to end up like that.
Had you done anything else to those tiles recently before trying to remove the road?
If you have some older saves of the same game it might be worth seeing if the wrong tiles are present there too.

I'll do some more digging at my end. Thanks for letting me know about this.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: JGR's Patch Pack

Post by wallyweb »

JGR wrote: 05 Apr 2022 22:56
Redirect Left wrote: 05 Apr 2022 14:50 Come across an interesting glitch.
I have run into this type of issue before, where the tile is in an inconsistent state. I can't seem to find/remember the circumstances of the last time though.
It is a bit difficult to diagnose the source of the problem without knowing what caused the tile to end up like that.
Had you done anything else to those tiles recently before trying to remove the road?
If you have some older saves of the same game it might be worth seeing if the wrong tiles are present there too.

I'll do some more digging at my end. Thanks for letting me know about this.
Using the sprite aligner (NOT to align!), it will display a list of the sprite numbers in the order in which they are stacked on the tile.
I recently saw a similar problem (no crash though) and I was able to determine which sprite was the culprit.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

wallyweb wrote: 05 Apr 2022 23:13 Using the sprite aligner (NOT to align!), it will display a list of the sprite numbers in the order in which they are stacked on the tile.
I recently saw a similar problem (no crash though) and I was able to determine which sprite was the culprit.
It's not to do with sprites, the issue is that the road bits are inconsistent with the road type, in that the road bits are 0 but the road type is set as if the road bits were non-zero.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7234
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: JGR's Patch Pack

Post by Redirect Left »

JGR wrote: 05 Apr 2022 22:56 Had you done anything else to those tiles recently before trying to remove the road?
If you have some older saves of the same game it might be worth seeing if the wrong tiles are present there too.
As far as I am aware, I've not done anything tram wise for a week or so, and it occurs in all of the autosave at 1 year intervals. I tend to leave it running in the background and alt-tab into it every so often. Sorry I can't be more help in that regard, hopefully you manage to suss it out eventually though!
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
mak
Traffic Manager
Traffic Manager
Posts: 205
Joined: 30 Sep 2015 13:16

Re: JGR's Patch Pack

Post by mak »

Hi JGR
A little problem :wink: I am in the process of updating my 'Sultzer type 2' engines to 'English Electric type 3' and although the update takes place I get a notice that auto renew that the vehicle is unavailable. As can be seen in the screenshot both engine and container flat are available. My apoligies if this is me :cry:
I appreciate all the work you do on this and thank you
Attachments
Tradingbury Transport, 1990-02-03.png
(1.02 MiB) Not downloaded yet
Tradingbury Transport, 1990-02-03.sav
(890.71 KiB) Downloaded 45 times
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: JGR's Patch Pack

Post by Eddi »

you have to make sure that the depot is electrified. you can't buy electric engines in an unelectrified depot (it is "unavailable" there, so the upgrade will fail)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests