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

Argus
Traffic Manager
Traffic Manager
Posts: 208
Joined: 16 Oct 2018 08:31

Re: JGR's Patch Pack

Post by Argus »

What is wrong? I don't notice anything.
McZapkie
Tycoon
Tycoon
Posts: 1255
Joined: 18 Jan 2014 18:10

Re: JGR's Patch Pack

Post by McZapkie »

Maybe it is problem with my newgrf, I wanted to be sure if it is known general issue...

EDIT: There is a suspect:

Code: Select all

switch(FEAT_TRAINS, SELF, switch_steam_Russia_RZD_F_visual_effect, motion_counter % 2) {
	0: return visual_effect_and_powered(VISUAL_EFFECT_STEAM, -3, DISABLE_WAGON_POWER);
	return visual_effect_and_powered(VISUAL_EFFECT_STEAM, 3, DISABLE_WAGON_POWER);
}
It is my fault, not related to JGRPP, sorry for false alarm.
Eddi
Tycoon
Tycoon
Posts: 7583
Joined: 17 Jan 2007 00:14

Re: JGR's Patch Pack

Post by Eddi »

McZapkie wrote: 15 Jan 2021 11:45 Maybe it is problem with my newgrf, I wanted to be sure if it is known general issue...

EDIT: There is a suspect:

Code: Select all

switch(FEAT_TRAINS, SELF, switch_steam_Russia_RZD_F_visual_effect, motion_counter % 2) {
	0: return visual_effect_and_powered(VISUAL_EFFECT_STEAM, -3, DISABLE_WAGON_POWER);
	return visual_effect_and_powered(VISUAL_EFFECT_STEAM, 3, DISABLE_WAGON_POWER);
}
It is my fault, not related to JGRPP, sorry for false alarm.
i don't know if that is the cause of your issue, but NewGRF code should never cause desyncs, and if it does, it must be considered a bug in the game, not the NewGRF
You might not exactly be interested in Ferion, but if you are, have fun :)
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Eddi wrote: 15 Jan 2021 14:51 i don't know if that is the cause of your issue, but NewGRF code should never cause desyncs, and if it does, it must be considered a bug in the game, not the NewGRF
Unfortunately it is easy to write a NewGRF which cause desyncs, even by accident, and this is really a bug in large chunks of the NewGRF specifications.
It's nearly impossible for the game to prevent all desyncs given how lax and full of footguns the specification is.

I've got code to correct and/or mitigate some of the most common desync-inducing NewGRF patterns (and a few other issues), but this is only a small subset of the specification space.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
Eddi
Tycoon
Tycoon
Posts: 7583
Joined: 17 Jan 2007 00:14

Re: JGR's Patch Pack

Post by Eddi »

in this case, you could disable access to certain variables in the visual effects callback, similar to how access to variables is restricted in CB36

alternatively you can add data to the (network) savegame for additional synchronization
You might not exactly be interested in Ferion, but if you are, have fun :)
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Eddi wrote: 15 Jan 2021 15:27 in this case, you could disable access to certain variables in the visual effects callback, similar to how access to variables is restricted in CB36
I may be missing something, but I'm looking through the code for variables and that around CB36, and I don't see any such restricted access to variables.
The specification makes no mention of this either.

Which variables specifically are these?
Eddi wrote: 15 Jan 2021 15:27 alternatively you can add data to the (network) savegame for additional synchronization
That is what I have done already for vehicles.


I have not been able to reproduce any desync with the savegame here under normal conditions.
A look at the desync logs would be useful.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
Eddi
Tycoon
Tycoon
Posts: 7583
Joined: 17 Jan 2007 00:14

Re: JGR's Patch Pack

Post by Eddi »

i misremembered. it was var61 (trains) that is restricted for certain callbacks.
You might not exactly be interested in Ferion, but if you are, have fun :)
User avatar
Snail
Tycoon
Tycoon
Posts: 1258
Joined: 28 Apr 2003 18:52
Contact:

Re: JGR's Patch Pack

Post by Snail »

Eddi wrote: 15 Jan 2021 21:11 i misremembered. it was var61 (trains) that is restricted for certain callbacks.
Correct. And speaking as an newGRF developer, this is a total pain in the butt :P
The French Narrow Gauge Train Set is now released! Get it here
McZapkie
Tycoon
Tycoon
Posts: 1255
Joined: 18 Jan 2014 18:10

Re: JGR's Patch Pack

Post by McZapkie »

How this drive_through_train_depot particularly works? I enabled it, placed 2 depots back to back but thre are still 2 separate depots and train can't go trough.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension, V4 CEE train set.
Addicted to freeciv longturn.
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

McZapkie wrote: 16 Jan 2021 22:04 How this drive_through_train_depot particularly works? I enabled it, placed 2 depots back to back but thre are still 2 separate depots and train can't go trough.
Can you post a save of what you're trying to get working and I'll have a look.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
User avatar
piratescooby
Transport Coordinator
Transport Coordinator
Posts: 371
Joined: 21 Nov 2014 12:39
Location: The Granite City.

Re: JGR's Patch Pack

Post by piratescooby »

McZapkie wrote: 16 Jan 2021 22:04 How this drive_through_train_depot particularly works? I enabled it, placed 2 depots back to back but thre are still 2 separate depots and train can't go trough.
Have you activated the function in settings ? ... Vehicles routing Drive through train depots ....On
User avatar
Aegir
Tycoon
Tycoon
Posts: 2778
Joined: 09 Feb 2004 10:02
Contact:

Re: JGR's Patch Pack

Post by Aegir »

On the subject of depots, given any thought to integrating the Multitile Depot patch? It's been running pretty stable for me, and choosing between the Patchpack and the Multitile build atm is killing me 😭
Former NewGRF Coder and Sprite Artist.

Currently working under the name 'reldred' on Github, IRC and Discord.

14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
McZapkie
Tycoon
Tycoon
Posts: 1255
Joined: 18 Jan 2014 18:10

Re: JGR's Patch Pack

Post by McZapkie »

JGR wrote: 16 Jan 2021 22:09
McZapkie wrote: 16 Jan 2021 22:04 How this drive_through_train_depot particularly works? I enabled it, placed 2 depots back to back but thre are still 2 separate depots and train can't go trough.
Can you post a save of what you're trying to get working and I'll have a look.
Problem solved - these depot are still separate and I addressed wrong one (exit instead of entry, thus train lost its path)
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension, V4 CEE train set.
Addicted to freeciv longturn.
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Aegir wrote: 17 Jan 2021 03:04 On the subject of depots, given any thought to integrating the Multitile Depot patch? It's been running pretty stable for me, and choosing between the Patchpack and the Multitile build atm is killing me 😭
I haven't looked at it properly yet, at some point I'll get round to investigating it.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Eddi wrote: 15 Jan 2021 14:51
McZapkie wrote: 15 Jan 2021 11:45 Maybe it is problem with my newgrf, I wanted to be sure if it is known general issue...

EDIT: There is a suspect:

Code: Select all

switch(FEAT_TRAINS, SELF, switch_steam_Russia_RZD_F_visual_effect, motion_counter % 2) {
	0: return visual_effect_and_powered(VISUAL_EFFECT_STEAM, -3, DISABLE_WAGON_POWER);
	return visual_effect_and_powered(VISUAL_EFFECT_STEAM, 3, DISABLE_WAGON_POWER);
}
It is my fault, not related to JGRPP, sorry for false alarm.
i don't know if that is the cause of your issue, but NewGRF code should never cause desyncs, and if it does, it must be considered a bug in the game, not the NewGRF
After doing a bit of digging, it turns out that the motion counter is not saved in the savegame at all and is therefore reset to 0 on load, including for network clients.
This seems like a definite bug, as I can't see any reason for it to not be saved. NewGRFs using it for just about anything other than animations could cause desyncs.
I'll raise an issue about this upstream a bit later.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
Argus
Traffic Manager
Traffic Manager
Posts: 208
Joined: 16 Oct 2018 08:31

Re: JGR's Patch Pack

Post by Argus »

I just want to ask how many trains can intersect? I know there are no more than two in the Vanilla version.
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Argus wrote: 18 Jan 2021 18:31 I just want to ask how many trains can intersect? I know there are no more than two in the Vanilla version.
I'm not really sure what you mean by this. Could you please clarify?
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
Argus
Traffic Manager
Traffic Manager
Posts: 208
Joined: 16 Oct 2018 08:31

Re: JGR's Patch Pack

Post by Argus »

Google Translate errors ... Sorry. How many trains can safely share one route?
User avatar
JGR
Tycoon
Tycoon
Posts: 2240
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: JGR's Patch Pack

Post by JGR »

Argus wrote: 18 Jan 2021 19:01 Google Translate errors ... Sorry. How many trains can safely share one route?
Both in this patchpack and in vanilla you can have as many trains as you want in a block (using PBS) or on a route at the same time. There is not a limit of two.
Ex TTDPatch Coder
Patch Pack, Github
Dad-Coder since April 2018

Avatar by MoonsongWolf
Argus
Traffic Manager
Traffic Manager
Posts: 208
Joined: 16 Oct 2018 08:31

Re: JGR's Patch Pack

Post by Argus »

Thanks :)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 13 guests