NML - a Newgrf Meta Language

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Here's a 2x3 set of tiles that 3iff designed and I coded it so can now be used with Industries.
test_1.png
test_1.png (3.77 KiB) Viewed 2878 times
2x3Industrysets.txt
(89.44 KiB) Downloaded 61 times
They make drawing your Industries so much easier and quicker.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
3iff
Tycoon
Tycoon
Posts: 1012
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: NML - a Newgrf Meta Language

Post by 3iff »

Thanks for the credit but I didn't do that. Was it Quast65??

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Actually got 3 people to credit for it. Quast65 did the 2x2 set. Silverx50 first brought to my attention the 2x3 and then 3iff you displayed the coding for it when you patched the error Silverx50 had.

So therefore you all deserve Credit.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

Eddi
Tycoon
Tycoon
Posts: 7468
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi »

might be worth splitting this in a separate topic, nobody is going to find this buried in here.
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Eddi wrote:might be worth splitting this in a separate topic, nobody is going to find this buried in here.
Good idea .. anyone suggest a heading for the Topic so easy to find?

The Joined Sprite Tiles I think would suit all types of coding not just NML.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
Quast65
Tycoon
Tycoon
Posts: 1684
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML - a Newgrf Meta Language

Post by Quast65 »

Eddi wrote:might be worth splitting this in a separate topic, nobody is going to find this buried in here.
Not a bad idea, maybe call it something like "my -insert name- coding examples/templates" and put links to various examples in the first post (with a short description).
Saves some time uploading examples if they are already somewhere in this forum and, if new are added, makes those also easy to find.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Quast65 wrote:
Eddi wrote:might be worth splitting this in a separate topic, nobody is going to find this buried in here.
Not a bad idea, maybe call it something like "my -insert name- coding examples/templates" and put links to various examples in the first post (with a short description).
Saves some time uploading examples if they are already somewhere in this forum and, if new are added, makes those also easy to find.
Your the one who first invented the joined sprites .. at least to my knowledge you are. So be nice if you started it by adding the 2x1, 2x2 and 2x3 sets for objects shown in this section earlier. Then I can add the Industry codes I done.

Cheers
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

frosch
OpenTTD Developer
OpenTTD Developer
Posts: 980
Joined: 20 Dec 2006 13:31
Location: Aschaffenburg

Re: NML - a Newgrf Meta Language

Post by frosch »

You could also add it to, or link it from:
https://www.tt-wiki.net/index.php?title=NMLTutorial
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁

User avatar
Quast65
Tycoon
Tycoon
Posts: 1684
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML - a Newgrf Meta Language

Post by Quast65 »

frosch wrote:You could also add it to, or link it from:
https://www.tt-wiki.net/index.php?title=NMLTutorial
I think that is the best way to go, create a page on the wiki where links can be added to various coding examples/templates.
Mainly so that everyone is able to add links to examples, not just the starter of the topic (so it can be maintained in the future by others if the original poster dissappears or edited if better examples are made).
And also because the wiki probably also will be visited by coders from other fora than this one, so it is usefull to them too.
I will start up a personal thread where I will post my various examples and link to that in my subscript under my posts (like I already did to my projects and screenshots) and recommend others to do that too.
That will make the first set up of that wiki-page a lot easier.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: NML - a Newgrf Meta Language

Post by Alberth »

Why not do it the other way around, make a wiki page and link to it here?

My guess is that making a wiki page is about the same amount of effort as making a post here, with the added advantage that the wiki stays writable, and can be improved by all
Being a retired OpenTTD developer does not mean I know what I am doing.

User avatar
Quast65
Tycoon
Tycoon
Posts: 1684
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML - a Newgrf Meta Language

Post by Quast65 »

True! And an extra wiki page with links is the best way to go.
However, I am also very unorganised. My file setup on my PC is sometimes a mess ;-)
So for my personal future reference I will also set up a thread here in the forum, with all of my examples. Even if it is just for me personally to find them again after some time ;-)
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Something I like to share with your fellas.

I made a 8 by 8 size Combined Sprite set for Industries with 2 views.
8x8with2views.png
8x8with2views.png (11.81 KiB) Viewed 2750 times
I cut the image so it would load better for viewing. The actual sprite also has tiles 65 to 128. Each sprite is 512 wide by 400 high so plenty of room what ever height tour industry going to be.

The actual sprite set is in the attached file along with NML file with all the codings.
Test8x8x2views.rar
(325.04 KiB) Downloaded 55 times
Tiles not used just use your rubber in your graphics editor to remove the unused ones.

You can split them as well like in this image.
8x8test.png
8x8test.png (130.77 KiB) Viewed 2750 times
If remove any tiles just delete reference to them in the the coding from these sections:

Like I done here:

Code: Select all

    switch(FEAT_INDUSTRYTILES, SELF, test8x8x2_industry_layout_2_graphics_switch, relative_pos) {

	relative_coord(0, 0): test8x8x2_spritelayout_65;
	relative_coord(0, 1): test8x8x2_spritelayout_66;
	relative_coord(0, 2): test8x8x2_spritelayout_67;
	relative_coord(0, 3): test8x8x2_spritelayout_68;
	relative_coord(0, 4): test8x8x2_spritelayout_69;
	relative_coord(0, 5): test8x8x2_spritelayout_70;
	relative_coord(0, 6): test8x8x2_spritelayout_71;
	relative_coord(0, 7): test8x8x2_spritelayout_72;
	relative_coord(1, 0): test8x8x2_spritelayout_73;
	relative_coord(1, 1): test8x8x2_spritelayout_74;
	relative_coord(1, 2): test8x8x2_spritelayout_75;
	relative_coord(1, 3): test8x8x2_spritelayout_76;
	relative_coord(1, 4): test8x8x2_spritelayout_77;
	relative_coord(1, 5): test8x8x2_spritelayout_78;
	relative_coord(1, 6): test8x8x2_spritelayout_79;
	relative_coord(1, 7): test8x8x2_spritelayout_80;
	relative_coord(2, 0): test8x8x2_spritelayout_81;
	relative_coord(2, 1): test8x8x2_spritelayout_82;
	relative_coord(2, 2): test8x8x2_spritelayout_83;
	relative_coord(2, 3): test8x8x2_spritelayout_84;
	relative_coord(2, 4): test8x8x2_spritelayout_85;
	relative_coord(2, 5): test8x8x2_spritelayout_86;
	relative_coord(2, 6): test8x8x2_spritelayout_87;
	relative_coord(2, 7): test8x8x2_spritelayout_88;



	relative_coord(5, 0): test8x8x2_spritelayout_105;
	relative_coord(5, 1): test8x8x2_spritelayout_106;
	relative_coord(5, 2): test8x8x2_spritelayout_107;
	relative_coord(5, 3): test8x8x2_spritelayout_108;
	relative_coord(5, 4): test8x8x2_spritelayout_109;
	relative_coord(5, 5): test8x8x2_spritelayout_110;
	relative_coord(5, 6): test8x8x2_spritelayout_111;
	relative_coord(5, 7): test8x8x2_spritelayout_112;
	relative_coord(6, 0): test8x8x2_spritelayout_113;
	relative_coord(6, 1): test8x8x2_spritelayout_114;
	relative_coord(6, 2): test8x8x2_spritelayout_115;
	relative_coord(6, 3): test8x8x2_spritelayout_116;
	relative_coord(6, 4): test8x8x2_spritelayout_117;
	relative_coord(6, 5): test8x8x2_spritelayout_118;
	relative_coord(6, 6): test8x8x2_spritelayout_119;
	relative_coord(6, 7): test8x8x2_spritelayout_120;
	relative_coord(7, 0): test8x8x2_spritelayout_121;
	relative_coord(7, 1): test8x8x2_spritelayout_122;
	relative_coord(7, 2): test8x8x2_spritelayout_123;
	relative_coord(7, 3): test8x8x2_spritelayout_124;
	relative_coord(7, 4): test8x8x2_spritelayout_125;
	relative_coord(7, 5): test8x8x2_spritelayout_126;
	relative_coord(7, 6): test8x8x2_spritelayout_127;
	relative_coord(7, 7): test8x8x2_spritelayout_128;


        test8x8x2_spritelayout_2; // a default is needed, but should never be reached, layout definitions are explicit
    }


    tilelayout test8x8x2_industry_layout_2_tilelayout {

		0, 0: test8x8x2_tile;
		0, 1: test8x8x2_tile;
		0, 2: test8x8x2_tile;
		0, 3: test8x8x2_tile;
		0, 4: test8x8x2_tile;
		0, 5: test8x8x2_tile;
		0, 6: test8x8x2_tile;
		0, 7: test8x8x2_tile;
		1, 0: test8x8x2_tile;
		1, 1: test8x8x2_tile;
		1, 2: test8x8x2_tile;
		1, 3: test8x8x2_tile;
		1, 4: test8x8x2_tile;
		1, 5: test8x8x2_tile;
		1, 6: test8x8x2_tile;
		1, 7: test8x8x2_tile;
		2, 0: test8x8x2_tile;
		2, 1: test8x8x2_tile;
		2, 2: test8x8x2_tile;
		2, 3: test8x8x2_tile;
		2, 4: test8x8x2_tile;
		2, 5: test8x8x2_tile;
		2, 6: test8x8x2_tile;
		2, 7: test8x8x2_tile;



		5, 0: test8x8x2_tile;
		5, 1: test8x8x2_tile;
		5, 2: test8x8x2_tile;
		5, 3: test8x8x2_tile;
		5, 4: test8x8x2_tile;
		5, 5: test8x8x2_tile;
		5, 6: test8x8x2_tile;
		5, 7: test8x8x2_tile;
		6, 0: test8x8x2_tile;
		6, 1: test8x8x2_tile;
		6, 2: test8x8x2_tile;
		6, 3: test8x8x2_tile;
		6, 4: test8x8x2_tile;
		6, 5: test8x8x2_tile;
		6, 6: test8x8x2_tile;
		6, 7: test8x8x2_tile;
		7, 0: test8x8x2_tile;
		7, 1: test8x8x2_tile;
		7, 2: test8x8x2_tile;
		7, 3: test8x8x2_tile;
		7, 4: test8x8x2_tile;
		7, 5: test8x8x2_tile;
		7, 6: test8x8x2_tile;
		7, 7: test8x8x2_tile;

    }
No need to remove references from anywhere else if wish as they are ignored when you run the nmlc.

Simple to use (has to be for me to understand things) .. and the great part about is no more splitting buildings to put in single tiles.

Hope you make use of it.

Cheers
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
Quast65
Tycoon
Tycoon
Posts: 1684
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML - a Newgrf Meta Language

Post by Quast65 »

GarryG wrote: Simple to use (has to be for me to understand things) .. and the great part about is no more splitting buildings to put in single tiles.

Hope you make use of it.

Cheers
So... Is this the trick used to keep room in industries for roads/tracks/waterways?? If so, very very interesting!! :bow: I have always been curious about how that was done in some industry sets.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: NML - a Newgrf Meta Language

Post by Leanden »

If you change the colours of the numbers in the graphic template to transparent blue, then the unused tiles will be easier to edit out by just using fill tool and transparent blue :)
Image

User avatar
Quast65
Tycoon
Tycoon
Posts: 1684
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: NML - a Newgrf Meta Language

Post by Quast65 »

Leanden wrote:If you change the colours of the numbers in the graphic template to transparent blue, then the unused tiles will be easier to edit out by just using fill tool and transparent blue :)
But that can make the numbers harder to see for some people (also with regard to some colors of the tiles, blue can be difficult to see then, or ingame the blue will get the color of the ground and then also harder to see), I would then advise to make some templates with rows/lines of tiles in transparent blue and just copy paste those over the graphic template.
That way you also dont accidentaly change some other tiles to blue (as some of the tiles have the same color) ;-)
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Leanden wrote:If you change the colours of the numbers in the graphic template to transparent blue, then the unused tiles will be easier to edit out by just using fill tool and transparent blue :)
I just tried that idea and I think be ok

Here's a sample.
new-1.png
new-1.png (4.75 KiB) Viewed 2719 times
The numbers are there solely to help a person see where things are referenced to. Save them counting them.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

Found a fault when splitting the tile set for roads and rail to go in the middle .. Vehicle and trains pass through fine .. not a problem.

But when I put a station in middle have a problem as can be seen by these images.
Spliting problem.PNG
Spliting problem.PNG (364.73 KiB) Viewed 2712 times
Maybe I missing something in the code. Some Industry sets in FIRS has the space in middle and stations build there ok.

Hope to figure out why eventually.

Cheers
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: NML - a Newgrf Meta Language

Post by Leanden »

Ive sent you a pm about this, but the fix is easy, wherever you intend to split the tiles, seperate this into 2 spritesheets and then update the spriteset references for those tiles on the other side of the split to the second spritesheet. Then it wont try drawing the more northern tiles as overlays :)
Image

User avatar
GarryG
Tycoon
Tycoon
Posts: 3599
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

What I will do is make a few different sizes all with 4 views. That way people can have a variety of choices.

The 4x4 for instance can be used singly, 4x8, and 8x8 with or without spaces between them for roads etc.

I will do a 6x6 set and I think make the 8x8 to have 4 views.

Shall see what I come up with.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335

User avatar
Leanden
Tycoon
Tycoon
Posts: 2620
Joined: 19 Mar 2009 19:25
Location: Kent

Re: NML - a Newgrf Meta Language

Post by Leanden »

I still think the 12x12 will be useful and still as easy to use, pm me the source code and the 8x8 Split gfx and ill show you what i mean :)
Image

Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 2 guests