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

BW89
Engineer
Engineer
Posts: 105
Joined: 10 May 2015 11:42

Re: JGR's Patch Pack

Post by BW89 »

I had this problem with this Savegame (no GRFs only AIs)
When I load this the game crashes on 27 Dec 1951.
Attachments
Pitäjänharju Transport, 27. Dez 1950.sav
(4.82 MiB) Downloaded 80 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

BW89 wrote: 15 Apr 2020 06:52 I had this problem with this Savegame (no GRFs only AIs)
When I load this the game crashes on 27 Dec 1951.
The game does not crash.
The game script (City Founder GS v2) is wasting CPU time.
It is repeatedly trying to found a new town but failing to do so. It appears to be because the town names set does not have enough available names for a new town.
As the opcode limit is set very high, and attempting to found a town is quite expensive, the game becomes unplayable.

Probably attempting to found a town should be heavily rate limited to stop game scripts from doing this.
Ex TTDPatch Coder
Patch Pack, Github
BW89
Engineer
Engineer
Posts: 105
Joined: 10 May 2015 11:42

Re: JGR's Patch Pack

Post by BW89 »

Sorry I didn't say it correctly.
On my System (i7-4770, 12GB RAM) the game freezes on 27 Dec 1951 for at least 10 min ( I never waited longer)

I forgot about that Skript because I use it for years, sorry. I will try it without it.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

BW89 wrote: 15 Apr 2020 10:10 Sorry I didn't say it correctly.
On my System (i7-4770, 12GB RAM) the game freezes on 27 Dec 1951 for at least 10 min ( I never waited longer)

I forgot about that Skript because I use it for years, sorry. I will try it without it.
The mitigation for this is done and will be in the next release.
In the meantime you could remove/disable the script somehow, or rename a few towns so that the script can successfully create new ones.
Ex TTDPatch Coder
Patch Pack, Github
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: JGR's Patch Pack

Post by agentw4b »

I am the author of "City Founder GS v2". But I have no idea what is wrong there, so far there were no problems with the script. Should I edit it? And how? You can set how many cities to start in the script, but I didn't know it had any limits. What is the limit of the maximum number of cities to establish? How can the game script determine the maximum number of city names?

The game script only tests whether a city can be established, but does not address the reasons why it was not possible to start a city and then only looks for another suitable place.
Last edited by agentw4b on 15 Apr 2020 18:27, edited 1 time in total.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

agentw4b wrote: 15 Apr 2020 17:28 I am the author of "City Founder GS v2". But I have no idea what is wrong there, so far there were no problems with the script. Should I edit it? And how? You can set how many cities to start in the script, but I didn't know it had any limits. What is the limit of the maximum number of cities to establish?

The game script only tests whether a city can be established, but does not address the reasons why it was not possible to start a city and then only looks for another suitable place.

Code: Select all

    while (notfounded) {
      x = GSBase.RandRange(GSMap.GetMapSizeX());
      y = GSBase.RandRange(GSMap.GetMapSizeY());
      tileindex = GSMap.GetTileIndex(x,y);
      notfounded = GSTown.FoundTown (tileindex, c , bool, r , name);
      notfounded = !notfounded;
    }
If the user has selected a town names set with a limited number of names, once all of the names in the town set have been used it is not possible to create any more towns.
GSTown.FoundTown will always fail and the loop above will not terminate.
GSTown.FoundTown is very expensive to execute as it tries many town names, however the GS was not charged for calling it.
Therefore the loop above would consume all available CPU and prevent the user from interacting with the game.

This was resolved by charging a GS a reasonable amount for each call to GSTown.FoundTown which more closely reflects how much CPU time it actually costs. This prevents the GS from consuming excessive CPU time.

In terms of modifying the script, limiting the maximum number of loop iterations, checking for the ERR_NAME_IS_NOT_UNIQUE error, or inserting some sleeps could work.
Ex TTDPatch Coder
Patch Pack, Github
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: JGR's Patch Pack

Post by agentw4b »

If the user has selected a town names set with a limited number of names, once all of the names in the town set have been used it is not possible to create any more towns.
GSTown.FoundTown will always fail and the loop above will not terminate.
GSTown.FoundTown is very expensive to execute as it tries many town names, however the GS was not charged for calling it.
Therefore the loop above would consume all available CPU and prevent the user from interacting with the game.

This was resolved by charging a GS a reasonable amount for each call to GSTown.FoundTown which more closely reflects how much CPU time it actually costs. This prevents the GS from consuming excessive CPU time.

In terms of modifying the script, limiting the maximum number of loop iterations, checking for the ERR_NAME_IS_NOT_UNIQUE error, or inserting some sleeps could work.

OK thanks. I will try to improve it.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
agentw4b
Traffic Manager
Traffic Manager
Posts: 216
Joined: 14 Apr 2017 15:51
Location: Czech Republic

Re: JGR's Patch Pack

Post by agentw4b »

agentw4b wrote: 15 Apr 2020 18:37
If the user has selected a town names set with a limited number of names, once all of the names in the town set have been used it is not possible to create any more towns.
GSTown.FoundTown will always fail and the loop above will not terminate.
GSTown.FoundTown is very expensive to execute as it tries many town names, however the GS was not charged for calling it.
Therefore the loop above would consume all available CPU and prevent the user from interacting with the game.

This was resolved by charging a GS a reasonable amount for each call to GSTown.FoundTown which more closely reflects how much CPU time it actually costs. This prevents the GS from consuming excessive CPU time.

In terms of modifying the script, limiting the maximum number of loop iterations, checking for the ERR_NAME_IS_NOT_UNIQUE error, or inserting some sleeps could work.

OK thanks. I will try to improve it.
But I do not understand why so few cities can be found in the file "Pitäjänharju Transport, 27. Dez 1950.sav". Are there so few existing Finnish cities? Normally my script can create thousands of new cities without problems, but it has failed here after 328 cities. That seems strange to me.
Owner and admin of servers with names "Experimental games" .
My heightmaps: Flat Earth Map and United nations logo
My scenarios: Game Fallout 1,2,3 Map scenario
My gamescripts: City Founder GS
stb
Engineer
Engineer
Posts: 40
Joined: 20 Sep 2013 20:26

Re: JGR's Patch Pack

Post by stb »

It seems Load by Cargo Type not working properly.
In the below scenario, the trains should leave the country station
as soon as livestocks fully collected. Goods are optional. But the trains
act like Full Load all Cargo.
P.S. The trains from Iron Horse.
On this picture, they left the station already because I changed the order to Full Load Any
and reversed before taking the screenshot.
Image
Attachments
load_cargo.png
load_cargo.png (946.99 KiB) Viewed 573 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

agentw4b wrote: 15 Apr 2020 20:04 But I do not understand why so few cities can be found in the file "Pitäjänharju Transport, 27. Dez 1950.sav". Are there so few existing Finnish cities? Normally my script can create thousands of new cities without problems, but it has failed here after 328 cities. That seems strange to me.
This could well be a bug in the Finnish town name generator. The code looks dubious and some of the available town name parts are never used.
stb wrote: 15 Apr 2020 21:51 It seems Load by Cargo Type not working properly.
In the below scenario, the trains should leave the country station
as soon as livestocks fully collected. Goods are optional. But the trains
act like Full Load all Cargo.
P.S. The trains from Iron Horse.
On this picture, they left the station already because I changed the order to Full Load Any
and reversed before taking the screenshot.
Image
A savegame which shows the problem would be useful.
Ex TTDPatch Coder
Patch Pack, Github
stb
Engineer
Engineer
Posts: 40
Joined: 20 Sep 2013 20:26

Re: JGR's Patch Pack

Post by stb »

here u are:
Attachments
TTT, May 22nd, 1941.sav
(256.34 KiB) Downloaded 77 times
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

stb wrote: 16 Apr 2020 01:06here u are:
Thanks, this is fixed and will be in the next release.
Ex TTDPatch Coder
Patch Pack, Github
ItzChaza
Engineer
Engineer
Posts: 2
Joined: 07 Sep 2017 19:15

Re: JGR's Patch Pack

Post by ItzChaza »

on the new 0.34.1 version i cant place stations under bridges... any reason why or have i missed something?
BW89
Engineer
Engineer
Posts: 105
Joined: 10 May 2015 11:42

Re: JGR's Patch Pack

Post by BW89 »

Check if the Setting, that allows placing stations under bridges is off. I had it one time already that some PatchPack Settings resetted themself after updates
ItzChaza
Engineer
Engineer
Posts: 2
Joined: 07 Sep 2017 19:15

Re: JGR's Patch Pack

Post by ItzChaza »

your a star mate, cheers
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7238
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: JGR's Patch Pack

Post by Redirect Left »

Has there been any changes to rendering? I am noticing a lot more graphic glitches currently. I know these are GRFs, but the issue was not this obvious in the past.
Taylors Transport, 32217-05-30.png
(98.45 KiB) Not downloaded yet
I've not noticed an increase in rendering issues outside of bridges, demonstrated above, this is v0.34.1
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: 18 Apr 2020 19:08 Has there been any changes to rendering? I am noticing a lot more graphic glitches currently. I know these are GRFs, but the issue was not this obvious in the past.

Taylors Transport, 32217-05-30.png

I've not noticed an increase in rendering issues outside of bridges, demonstrated above, this is v0.34.1
Thanks for reporting this.
There were several changes between 0.33.2 and 0.34-rc1, mostly performance focused.
I've reproduced the issue above, which I hadn't noticed previously. I've reverted the change in question, which was only a minor one.

Edit:
I've been able to get level crossings under bridges like in the picture to glitch in 0.33.2 as well.
That issue is still partially here for now, in that it can be made to show up if the conditions are just right.
(The joys of the sprite sorter are never-ending, it seems).
Ex TTDPatch Coder
Patch Pack, Github
LiiNaRuu
Engineer
Engineer
Posts: 12
Joined: 07 May 2009 08:20
Location: Munich, Germany

Re: JGR's Patch Pack

Post by LiiNaRuu »

Got a minor glinch:
There is a filter problem only on liquids for conditional order jump "waiting cargo amount". Enter more than four digits it not possible.
FilterProblem_WaitingCargoAmount.PNG
(277.34 KiB) Not downloaded yet
However there is an workarround to enter an appropriate amount on an non liquid cargo e.g. Food and then change it to Oil afterwards.
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: 18 Apr 2020 19:08 Has there been any changes to rendering? I am noticing a lot more graphic glitches currently. I know these are GRFs, but the issue was not this obvious in the past.

Taylors Transport, 32217-05-30.png

I've not noticed an increase in rendering issues outside of bridges, demonstrated above, this is v0.34.1
I've made another change to remove another edge case.
With that done I haven't been able to reproduce further issues with that setup.
LiiNaRuu wrote: 19 Apr 2020 05:31 Got a minor glinch:
There is a filter problem only on liquids for conditional order jump "waiting cargo amount". Enter more than four digits it not possible.
FilterProblem_WaitingCargoAmount.PNG
However there is an workarround to enter an appropriate amount on an non liquid cargo e.g. Food and then change it to Oil afterwards.
Thanks, this is fixed and will be in the next release.
Ex TTDPatch Coder
Patch Pack, Github
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: JGR's Patch Pack

Post by ColdIce »

Hy, I have an issue with cargo distribution.
Passengers from Bucuresti Grand Station to Comarnic West are plenty, but there is none from Comarnic West to Bucuresti Grand Station. The cities are fully served and all stations linked. I have 4 long trains from Bucuresti to Comarnic. I have give them full load option for Comarnic to see what happens. In two months, only 19% of a train was loaded with passengers from Comarnic to Bucuresti. I use day lenght factor 125 and 4.6 town cargo generation.


LE: I changed the settings from asymmetric (equal distribution) to symmetric and now i have passengers from Comarnic to Bucuresti. Before this, I changed the settings to day lenght factor to 1 and the cargo generation to 8 with no results in asymmetric (equal distribution) cargo distribution.
LLE: Changed from asymmetric (equal distribution) to asymmetric (simple). Got positive results.
LLLE: Changed in Settings/Cargo Distribution/per cargo overrides to Asymmetric (equal distribution). No results. So it seems to be an issue (if there is one) in assymetric (equal distribution) cargo distribution. Also, when i change to other setting (symmetric or simple asymmetric), the passengers pile up waiting in stations. The best passenger flow I got with asymmetric (equal distribution) and small tweaks on town cargo generation.
Attachments
1.jpg
(586.07 KiB) Not downloaded yet
2.jpg
2.jpg (186.33 KiB) Viewed 573 times
YOGI & CO., Sep 5th, 1918.sav
(3.03 MiB) Downloaded 62 times
Last edited by ColdIce on 19 Apr 2020 18:52, edited 1 time in total.
The rest is confetti!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests