[OpenTTD] NuTracks - Dev Thread
Moderator: Graphics Moderators
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: [OpenTTD] NuTracks - Dev Thread
Thanks, that and more fixed. However, I've found an OpenTTD or NML bug now - if I have more than 16 track type definitions included in the code, there's always an "Attempt to use invalid ID" error, even if most of the definitions are skipped and some are sharing IDs (so no reason at all to count double). Code with full bug documentation in the attachment.
- Attachments
-
- nutracks.zip
- (3.51 MiB) Downloaded 278 times
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: [OpenTTD] NuTracks - Dev Thread
I'll try to reproduce it with a simpler code (just 15 tracks in the code, but let 14 and 15 depend on a parameter setting).
A note on your code: why do you use introduction dates for all tracks? Now tracks can become available without a train for it. It is better to use introduces_railtype_list, the moment a train then becomes available, the track becomes available and all other tracks that are in that list also become available. So if an electric train becomes available, ELRL is introduced, and by putting all other electric tracks for the different speeds in the introduces_railtype_list those also become available at that moment, instead of depending on introduction date.
[EDIT1]Tested, and there is a bug in your code, somewhere your code does result in more then 16 track definitions. In the attached archive is a simple NewGRF+code that introduces 12 tracks with the parameter set to off, 13 with the parameter set to on. Together with the 4 default tracks, setting the parameter to on will result in 17 track definitions, triggering the error upon starting a game, but when set to off no error occurs.[/EDIT1]
[EDIT2]I looked through your code, couldn't find where it went wrong yet, but another comment on it. You have a number of pieces like this:
And then later things like:
You can also use param_force_3rd_rail in the second statement and remove the first in which you define param[20]. So the result would then become:
This does exactly the same and I think it will increase readability of your code, or is there a specific reason why you do it the way you do it?[/EDIT2]
A note on your code: why do you use introduction dates for all tracks? Now tracks can become available without a train for it. It is better to use introduces_railtype_list, the moment a train then becomes available, the track becomes available and all other tracks that are in that list also become available. So if an electric train becomes available, ELRL is introduced, and by putting all other electric tracks for the different speeds in the introduces_railtype_list those also become available at that moment, instead of depending on introduction date.
[EDIT1]Tested, and there is a bug in your code, somewhere your code does result in more then 16 track definitions. In the attached archive is a simple NewGRF+code that introduces 12 tracks with the parameter set to off, 13 with the parameter set to on. Together with the 4 default tracks, setting the parameter to on will result in 17 track definitions, triggering the error upon starting a game, but when set to off no error occurs.[/EDIT1]
[EDIT2]I looked through your code, couldn't find where it went wrong yet, but another comment on it. You have a number of pieces like this:
Code: Select all
if(param_force_3rd_rail) {
param[20] = 1;
}
Code: Select all
if(param[20] == 1) {
Some code
}
Code: Select all
if(param_force_3rd_rail == 1) {
Some code
}
- Attachments
-
- Tracklimittest.zip
- Test
- (14.93 KiB) Downloaded 266 times
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
- coalroads artist
- Traffic Manager
- Posts: 254
- Joined: 29 Oct 2004 05:49
- Location: Australia
Re: [OpenTTD] NuTracks - Dev Thread
All done now, just have found one copy and paste alignment to fix but after that will forward it on and then I've done my part
I do have a working version using 1.1.2 though...

- Attachments
-
- finalnewtracks.PNG (152.11 KiB) Viewed 12003 times
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: [OpenTTD] NuTracks - Dev Thread
Current status: All code finished except for that one bug. One graphics set (the old graphics from 1.1.2, with narrow gauge taken from the Japan Set tracks) also coded. Planning on three more: 1. the narrow tracks by coalroads_artist, 2. OpenGFX style from the Japan Set, 3. OpenGFX style from the Japan Set (narrow).
Changing to automatic introduction of associated track types will be easy. About the second bit, I'll just give all parameters names.
The bug now: Even when I write the code as, it makes a difference whether the include is commented out or not.
Good news about the graphics, but have you thought of narrow gauge tracks?
They're now in too.
Changing to automatic introduction of associated track types will be easy. About the second bit, I'll just give all parameters names.
The bug now: Even when I write the code as
Code: Select all
if (0 == 1) {
#include track_type_X_code.pnml
}
Good news about the graphics, but have you thought of narrow gauge tracks?

--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: [OpenTTD] NuTracks - Dev Thread
The if-statement is only checked by OpenTTD, so the final grf-file will contain the code you include through track_type_X_code.pnml, even if the if-statement can never be true.oberhümer wrote:The bug now: Even when I write the code as, it makes a difference whether the include is commented out or not.Code: Select all
if (0 == 1) { #include track_type_X_code.pnml }
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
Re: [OpenTTD] NuTracks - Dev Thread
something that kinda disturbs me: the "narrow" trackbase under straight tracks vs. the "broad" trackbase under crossings...
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: [OpenTTD] NuTracks - Dev Thread
The whole point is that if everything inside the statement is skipped, what actually is there or not there shouldn't make a difference in-game - but it does!Transportman wrote:The if-statement is only checked by OpenTTD, so the final grf-file will contain the code you include through track_type_X_code.pnml, even if the if-statement can never be true.oberhümer wrote:The bug now: Even when I write the code as, it makes a difference whether the include is commented out or not.Code: Select all
if (0 == 1) { #include track_type_X_code.pnml }
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
-
- Tycoon
- Posts: 2792
- Joined: 22 Feb 2011 18:34
Re: [OpenTTD] NuTracks - Dev Thread
IIRC the content of an if-statement is loaded, but are only considered when it evaluates to that section. So the spriteviewer contains the sprites that should be loaded according to the code in the if-statement, but the label is not loaded, since the if-statement does not evaluate to that part of the code. But I'm not 100% sure about it, a dev should confirm it (or correct me).
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
- coalroads artist
- Traffic Manager
- Posts: 254
- Joined: 29 Oct 2004 05:49
- Location: Australia
Re: [OpenTTD] NuTracks - Dev Thread
I could do some narrow gauge tracks but probably only three versions - wooden/dirt, wooden/ballast and concrete. Just can't commit to another 5 different tracks.. I would then be able to play an Australian scenario 

Re: [OpenTTD] NuTracks - Dev Thread
Very very nice tracks... very much like them!coalroads artist wrote:All done now
As most of my time is spent in arctic can I/or we see arctic shot too?
Thank You!
Last edited by ISA on 28 Dec 2012 01:01, edited 1 time in total.
TT-Screenshot Of The Month - 2012 July, winner!
TT-Screenshot Of The Month - 2013 May, winner tie with Purno!
TT-Screenshot Of The Month - 2014 February, winner!
TT-Screenshot Of The Month - 2014 June, winner tie with alluke!
TT-Screenshot Of The Month - 2014 April, winner!
My screen shot thread ---> Have a look
TT-Screenshot Of The Month - 2013 May, winner tie with Purno!
TT-Screenshot Of The Month - 2014 February, winner!
TT-Screenshot Of The Month - 2014 June, winner tie with alluke!
TT-Screenshot Of The Month - 2014 April, winner!
My screen shot thread ---> Have a look
- coalroads artist
- Traffic Manager
- Posts: 254
- Joined: 29 Oct 2004 05:49
- Location: Australia
Re: [OpenTTD] NuTracks - Dev Thread
Thanks! Sure.
- Attachments
-
- artictracks.PNG (82.33 KiB) Viewed 11858 times
Re: [OpenTTD] NuTracks - Dev Thread
Also very nice!
TT-Screenshot Of The Month - 2012 July, winner!
TT-Screenshot Of The Month - 2013 May, winner tie with Purno!
TT-Screenshot Of The Month - 2014 February, winner!
TT-Screenshot Of The Month - 2014 June, winner tie with alluke!
TT-Screenshot Of The Month - 2014 April, winner!
My screen shot thread ---> Have a look
TT-Screenshot Of The Month - 2013 May, winner tie with Purno!
TT-Screenshot Of The Month - 2014 February, winner!
TT-Screenshot Of The Month - 2014 June, winner tie with alluke!
TT-Screenshot Of The Month - 2014 April, winner!
My screen shot thread ---> Have a look
Re: [OpenTTD] NuTracks - Dev Thread
The only thing that catch my eyes at first too - any planning to correct this ?Eddi wrote:something that kinda disturbs me: the "narrow" trackbase under straight tracks vs. the "broad" trackbase under crossings...
At least, good graphics, it'll match pikka's finescale track - nice small thing !!
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
「ヨーッスノットマイン」もと申します。
- coalroads artist
- Traffic Manager
- Posts: 254
- Joined: 29 Oct 2004 05:49
- Location: Australia
Re: [OpenTTD] NuTracks - Dev Thread
I don't plan on changing the ballasted areas for junctions as in real life ballast is often dumped and spread over a large area around junctions so works for me.
Re: [OpenTTD] NuTracks - Dev Thread
Hmm, I thinks its a bit too excessive in your case...coalroads artist wrote:I don't plan on changing the ballasted areas for junctions as in real life ballast is often dumped and spread over a large area around junctions so works for me.
YNM = yoursNotMine - Don't get it ?
「ヨーッスノットマイン」もと申します。
「ヨーッスノットマイン」もと申します。
- coalroads artist
- Traffic Manager
- Posts: 254
- Joined: 29 Oct 2004 05:49
- Location: Australia
Re: [OpenTTD] NuTracks - Dev Thread
Well I'm sorry if they're not to your taste.. Well considering it's TT scale graphics we're talking about and the fact that real life junctions have ballast cast between makes it just your personal opinion on judgement of sizes, and since you've already stated what you think of the size, you don't need to keep reiterating, it won't make me (or indeed anyone here) want to spend hours of their own time to remove those blue outlined areas just to please a few. You'll be left with 'unsightly' ballasted areas anyway due to the base sprites allowing for extra tracksYoursnotmine wrote:Hmm, I thinks its a bit too excessive in your case...coalroads artist wrote:I don't plan on changing the ballasted areas for junctions as in real life ballast is often dumped and spread over a large area around junctions so works for me.

Random google image of junction ballasting :http://www.masterfile.com/stock-photogr ... ad%20track
Narrow gauge sprites will come after some well earned game play

- Attachments
-
- junctions.PNG (43.33 KiB) Viewed 6553 times
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: [OpenTTD] NuTracks - Dev Thread
Only two are needed.coalroads artist wrote:I could do some narrow gauge tracks but probably only three versions
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
- coalroads artist
- Traffic Manager
- Posts: 254
- Joined: 29 Oct 2004 05:49
- Location: Australia
Re: [OpenTTD] NuTracks - Dev Thread
So timber and concrete then?
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: [OpenTTD] NuTracks - Dev Thread
Fine. Anyway, nailed down the bug, will report it to the NML developers in a minute.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: [OpenTTD] NuTracks - Dev Thread
Tried to work around the bug and failed, so it's all up to the NML developers for the time being.
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---
--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
Who is online
Users browsing this forum: Ahrefs [Bot], Baidu [Spider] and 21 guests