Modular Locomotive Sheds Depot Set (MLSD)

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

Hello all,

So I have been wanting to release a set of depots to match my sheds (http://www.tt-forums.net/viewtopic.php?f=67&t=48681) for a while now. To be able to provide a variety of depots, I need to use rail types, so I had considered a rail NewGRF. While I would still like to release a rail set, it seems it would be easier to just release a a set of depots to override common rail types for now, using NML.
depot_sample.png
depot_sample.png (8.15 KiB) Viewed 7805 times
I created these 6 variations on my three shed types to use for now, and will gradually create more. So far, I have tried to assign a depot graphic to most of the commonly used railtype labels in major track sets, and I aim to broaden the compatibility with time.

I have written some NML with planetmaker's help that I think will do what I want, but I cannot figure out how to use python and NML. If someone could help me out be looking at my code and/or compiling this to test it out, I would really appreciate it.
MLSD01.nml
(8.36 KiB) Downloaded 155 times
Also attached are the .png files for the grf.

Best,
Attachments
MLSD_PNG.rar
(42.35 KiB) Downloaded 165 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by planetmaker »

Hi,

mostly it's syntactically correct; the only thing you need to mind is that you don't include strings directly in the NML file but in the language file as I supplied in the example (railtype labels or grfIDs in this context don't count as strings, they're labels and IDs).

Code: Select all

grf {
 grfid : "MLSD";
 name : string(STR_GRF_NAME);
 desc : string(STR_GRF_DESCRIPTION);
 version : 1; // must be numeric
 min_compatible_version : 1;
}
and:

Code: Select all

~/ottd/grfdev/example-depot> ls -1
depot_1A.png
depot_1B.png
depot_2A.png
depot_2B.png
depot_2C.png
depot_3A.png
lang
mlsd.grf
mlsd.nml
~/ottd/grfdev/example-depot> cat lang/english.lng
##grflangid 0x01
STR_GRF_NAME            :Example Depot GRF
STR_GRF_DESCRIPTION     :Example Depot description; coded by a super mob
~/ottd/grfdev/example-depot> nmlc mlsd.nml
"depot_1B.png" at [x: 118, y: 8]: 64 of 3648 pixels (1%) are pure white
"depot_1B.png" at [x: 118, y: 68]: 512 of 3648 pixels (14%) are pure white
Mind that you have a few white pixels in the grf which is - given the exact multiples of 64 - most probably a wrong offset somewhere in the alignment. Again, no ingame testing by me during working hours ;-)

So all you need for nml to work is basically install python and its modules PIL, PLY so that it is available in your path and the NML module as well:
http://hg.openttdcoop.org/nml/raw-file/ ... stallation

cheers,
pm
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

So all you need for nml to work is basically install python and its modules PIL, PLY so that it is available in your path and the NML module as well:
I know it probably seems straightforward to most people, but this is where I am stuck. I have Python installed now, and I think I got PIL installed, but I cannot figure out how to get PLY or NML installed.

I am now at work myself, so it will be awhile be fore I can take another shot at it.

Thanks!
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by Ammler »

Maybe you want to try the windows exe bundle: http://www.tt-forums.net/viewtopic.php?p=930849#p930849
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

So tonight I managed to create a NewGRF that seems to compile fine in NML, and does not seem to cause any errors when loaded in a game of OTTD. However, it also does not produce any effect either. I wrote this version to act just on the four default rail types, but as far as I can tell, they still use their standard depot graphics. I will post all of the files I used to create it here, along with the grf, if anyone wants to test. I have found that the NML documentation lists the appropriate features for switches, but I cannot find any list of valid <expression>s to use. Planetmaker was very kind to provide me with a snow aware depot example, which uses the expression "terrain_type" and the range "tiletype_snow", but I cannot find anything in the documentation that suggests that these are the terms to use to get this effect. It would seem to me, that someone wanting to write such a switch from scratch would have to guess those terms.


I also cannot figure out how to make my Grf ID string show up as is in game, instead of the 4 letter id I wrote, it shows up as a 8 digit number.

Best,
Attachments
MLSD Basic.rar
(50.02 KiB) Downloaded 143 times
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by planetmaker »

supermop wrote:I also cannot figure out how to make my Grf ID string show up as is in game, instead of the 4 letter id I wrote, it shows up as a 8 digit number.
That's usual and intended; it's the hex interpretation of your string.
supermop wrote:I have found that the NML documentation lists the appropriate features for switches, but I cannot find any list of valid <expression>s to use. Planetmaker was very kind to provide me with a snow aware depot example, which uses the expression "terrain_type" and the range "tiletype_snow", but I cannot find anything in the documentation that suggests that these are the terms to use to get this effect. It would seem to me, that someone wanting to write such a switch from scratch would have to guess those terms.
It's the first thing described under 'railtype variables' ;-) The acceptable variables for railtypes are listed here: http://hg.openttdcoop.org/nml/raw-file/ ... types-vars - additonally also all global variables are permissible, of course: http://hg.openttdcoop.org/nml/raw-file/ ... neral-vars

EDIT: good and bad news:
The good: you NewGRF works fine
The bad: With the current way OpenTTD works, you or another railtype newgrf need to supply the ground tile graphics (tracks) as well. Your depots can only replace the existing depots currently when some railtypes newgrf (yours or another) re-defines the ground tiles for the railtype labels you want to provide the depots for.
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

Well, as of last night, i tried to just make a version that would work with NuTracks rail types. I am including it here if anyone is curious, but it doesn't work for me, not sure why.

Best,
MLSD04.zip
(51.56 KiB) Downloaded 152 times
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

Unless you want different depots for the different tracktypes, all you need is to 'Action A' the default depot(s):
All 'normal' rails use the default 'normal' depot
The metros use the monorail depot
Maglev use maglev
Member of the
ImageImage
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by planetmaker »

DJ Nekkid wrote:Unless you want different depots for the different tracktypes
Given the source, that's the purpose of this newgrf, though.

It works for me somewhat but not consistently and not for all railtypes. It'll need investigation when and how and why.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

possible typos in the railtype labels?

check this file, line 215 and onward:
http://dev.openttdcoop.org/projects/nut ... eader.pnfo
Member of the
ImageImage
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

Looking over the NML file and your code Nekkid, I don't see any mistakes other than my inclusion of a "CMED" type, which you do not seem to have, so I don't think that typos are the problem.

I am curious as to why this grf seems to do absolutely nothing for me, but does do something, if limited for Planetmaker. Did you use my .grf, or did you compile it from the .nml yourself?

I don't see any change whether I use stable trunk, or a recent patchpack, so not sure what could be the variable factor here.

Best,
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

use .nfo and i could help :P
Member of the
ImageImage
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

I would if I could! I was never able to figure out how to replace depots in nfo, so I tried to learn how to do in it NML instead. Clearly I have yet to learn that as well.


Edit:

This might do something (maybe), I will not be able to test until after work.
MLSD04B.nml
(5.63 KiB) Downloaded 141 times
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

Well, if I think .nfo I think that you might need an action0 to 'set the slot' of the particular railtype, but i bet that you could have 0 properties. Then you need to use the same slot in the Action3.
If so do you need to check what parameter20 (iirc) is in nutracks, so that you dont add more railtypes that what is already in (as i see you had defined 3rdr and 3rdc)

Did that help?

@Openttd-devs: Or is the slot in the railtype translation table (RTT) good enough?

if so, do you need to add a RTT to your grf :)
Member of the
ImageImage
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by Yexo »

You don't need a RTT at all. Also the action0/action3 is implicitly set by nml (you can chose them manually, but you don't have to). The problem was that supermop used "depot_1B.png" several times, instead of one time "depot_1B.png", one time "depot_1C.png", one time "depot_2A.png" etc.
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

then he stills needs to check for what value Parameter20 has set in NuTracks, so that it dont 'flood' the game with railtypes that isnt used :)
Member of the
ImageImage
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

Thanks Yexo for catching that error but I am wondering if the action 0 error I get (and others do not) when loading these two grfs at the same time is perhaps unrelated. I will not be able to find out for myself until later tonight.

Thanks,
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

supermop: try to 'override' the first parameter to '3rd rail' and see what happens *guessing*
Member of the
ImageImage
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by supermop »

Is that something I do in my code, or when I configure nutracks in game?
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Modular Locomotive Sheds Depot Set (MLSD)

Post by DJ Nekkid »

something you do with your grf.

point is:

Nutracks define about 25 (rough estimate) different tracktypes, but only use a handfull (between 10ish and 16), but the game can only use 16 at once, and if nutracks with metrotrackset is loaded, and you add, say, 3rdr to your set, then you have 17 ones, and the game complains.
Member of the
ImageImage
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 5 guests