NML - a Newgrf Meta Language
Moderator: Graphics Moderators
Re: NML - a Newgrf Meta Language
I have some first basic code for that that can decode very simple newgrfs, but I won't commit that before 0.1 is out. For 0.1 we want support for all action0 properties and varaction2 variables first, which is still a lot of work. On the other hand we're getting closer and closer to the 0.1 release, but I can't really give a timeframe.
Re: NML - a Newgrf Meta Language
Ok, thank you. I never coded grf's until now, but was thinking about making some, in a near future. But obviously, if I can use a "human" language, instead of learning some asm-simili-code, it is really better.Yexo wrote:I have some first basic code for that that can decode very simple newgrfs, but I won't commit that before 0.1 is out. For 0.1 we want support for all action0 properties and varaction2 variables first, which is still a lot of work. On the other hand we're getting closer and closer to the 0.1 release, but I can't really give a timeframe.
Patch - Let's timetable depot waiting time with the Wait in depot patch.
GameScript - Searching a new way to make your cities growing ? Try the Renewed City Growth GameScript.
My screenshots thread.
GameScript - Searching a new way to make your cities growing ? Try the Renewed City Growth GameScript.
My screenshots thread.
Re: NML - a Newgrf Meta Language
What scope is there with the language currently in terms of coding stations please?
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
I fear that stations are a missing feature so far... 
Implemented are features so far: 0,1,2,3,9,A,D,10 and 11 (=vehicles,industries and industry tiles, airports and airport tiles and railtypes)

Implemented are features so far: 0,1,2,3,9,A,D,10 and 11 (=vehicles,industries and industry tiles, airports and airport tiles and railtypes)
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
afaik, "they" implement that first, what someone is asking them, so if you "signal" to code stations with nml, they might move the priority for it 
just join #openttdcoop.devzone and speak to one of the devs
BTW. I am no nml dev, so my words are just guesses, no warranty
Greets
Ammler

just join #openttdcoop.devzone and speak to one of the devs
BTW. I am no nml dev, so my words are just guesses, no warranty

Greets
Ammler
Town Names:


Still work in progress: OpenGFX or/and OpenSFX - Please help!
Re: NML - a Newgrf Meta Language
That is true to a certain extend, which area is the most interesting also has influence
. For stations I first have to figure out how they work exactly in nfo, especially when dealing with multi-tile stations.

Re: NML - a Newgrf Meta Language
NML is awesome 
Really good work!

Code: Select all
grf {
grfid : "MAF0";
name : string(STR_GRF_NAME);
desc : string(STR_GRF_DESCRIPTION);
}
spriteblock(FEAT_INDUSTRYTILES) {
spritegroup forrest_tree_1_normal {
ground { ttdsprite: 2077; }
building {
ttdsprite: 2072;
}
}
spritegroup forrest_tree_2_normal {
ground { ttdsprite: 2077; }
building {
ttdsprite: 2073;
}
}
spritegroup forrest_tree_3_normal {
ground { ttdsprite: 2077; }
building {
ttdsprite: 2074;
}
}
spritegroup forrest_tree_4_normal {
ground { ttdsprite: 2077; }
building {
ttdsprite: 2075;
}
}
spriteset(forrest_tree_1_snow_set, "sprites/ogfxc_arctic.png") {
[466, 1832, 51, 39, -24, -13]
}
spritegroup forrest_tree_1_snow {
ground { ttdsprite: GROUNDSPRITE_SNOW; }
building {
sprite: forrest_tree_1_snow_set;
}
}
spriteset(forrest_tree_2_snow_set, "sprites/ogfxc_arctic.png") {
[530, 1832, 56, 52, -28, -24]
}
spritegroup forrest_tree_2_snow {
ground { ttdsprite: GROUNDSPRITE_SNOW; }
building {
sprite: forrest_tree_2_snow_set;
}
}
spriteset(forrest_tree_3_snow_set, "sprites/ogfxc_arctic.png") {
[594, 1832, 62, 61, -30, -33]
}
spritegroup forrest_tree_3_snow {
ground { ttdsprite: GROUNDSPRITE_SNOW; }
building {
sprite: forrest_tree_3_snow_set;
}
}
spriteset(forrest_tree_4_snow_set, "sprites/ogfxc_arctic.png") {
[674, 1832, 60, 72, -28, -44]
}
spritegroup forrest_tree_4_snow {
ground { ttdsprite: GROUNDSPRITE_SNOW; }
building {
sprite: forrest_tree_4_snow_set;
}
}
}
// No idea how to make original forrest animation (growing trees), so it's just a test xD
random_switch(FEAT_INDUSTRYTILES, SELF, forrest_trees_normal, TRIGGER_INDUSTRYTILE_256_TICKS) {
1: forrest_tree_1_normal;
1: forrest_tree_2_normal;
1: forrest_tree_3_normal;
6: forrest_tree_4_normal;
}
random_switch(FEAT_INDUSTRYTILES, SELF, forrest_trees_snow, TRIGGER_INDUSTRYTILE_256_TICKS) {
1: forrest_tree_1_snow;
1: forrest_tree_2_snow;
1: forrest_tree_3_snow;
6: forrest_tree_4_snow;
}
// Decide whether to use normal or snow sprites
switch(FEAT_INDUSTRYTILES, SELF, forrest, terrain_type) {
0..3: forrest_trees_normal;
forrest_trees_snow;
}
item(FEAT_INDUSTRYTILES, forrest_tiles, 0x10) {
property {
substitute: 16;
override: 16;
}
graphics {
forrest;
}
}
Re: NML - a Newgrf Meta Language
maybe people would like to see the result? 

Town Names:


Still work in progress: OpenGFX or/and OpenSFX - Please help!
Re: NML - a Newgrf Meta Language
Oki doki^^
Two screens and the .grf should be enough to see it in action
Oh, I had to add these lines to actions/action2var_variables.py:
Two screens and the .grf should be enough to see it in action

Oh, I had to add these lines to actions/action2var_variables.py:
Code: Select all
varact2vars_industrytiles = {
'terrain_type' : {'var': 0x41, 'start': 0, 'size': 8},
'town_radius_group': {'var': 0x42, 'start': 0, 'size': 3},
'relative_pos': {'var': 0x43, 'start': 0, 'size': 24},
'animation_frame': {'var': 0x44, 'start': 0, 'size': 8},
}
...
varact2vars[0x09] = varact2vars_industrytiles
- Attachments
-
- snowy-forest.grf
- (6.52 KiB) Downloaded 381 times
-
- Unbenannt, 7. Apr 1950.png (133.69 KiB) Viewed 2953 times
-
- Unbenannt, 8. Okt 1950.png (134.46 KiB) Viewed 2953 times
Re: NML - a Newgrf Meta Language
Morning all!
I have decided to see if i can give NewGRF-ing a go, but am struggling to install it properly
Is there a guide or even just a list of packages needed to install?
I'm on ubuntu 10.04 (10.10 coming soon!
)
PS i have read the reference.htm
I have decided to see if i can give NewGRF-ing a go, but am struggling to install it properly
Is there a guide or even just a list of packages needed to install?
I'm on ubuntu 10.04 (10.10 coming soon!

PS i have read the reference.htm

AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Re: NML - a Newgrf Meta Language
Been looking over nml for objects support, I've noticed two things that stop basic objects compiling:
~ Lakie
- Action2 layouts are not allowed for them,
- Action0's size property function's return is incorrect, it should be "<< 4" and not "<< 8".
~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
Re: NML - a Newgrf Meta Language
All three done, I hope it works now.
Re: NML - a Newgrf Meta Language
Yup, working quite nicely now, however, I have a few observations about the nfo code it generates;
~ Lakie
- It generates multiple Action14s when surely it only needs one?
- Similarly it generates multiple Action4's when they could be merged.
- It outputs an Action1 even though no new sprites are loaded.
- Is there any particular reason that switch blocks will always use dword action2var sizes (89/8A)?
- It appears not support the first format of Action2 Tile Layouts, which has the option of no building sprite.
~ Lakie
TTDpatch Developer 2005 - 2010 ~ It all started because of shortened vehicle not loading correctly, now look where I've gone with it!
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
Grfs coded ~ Finnish Train Set (Teaser) | Bm73 (Release 3) | Emu 680 (Release 3)| Glass Station (Release 1) | UK Roadset (Version 1.1a) | New Water Coasts (Version 7)
Pikka: "Lakie's a good coder, but before he'll add any feature to TTDP you have to convince him that you're not going to use it to destroy the world as we know it."
Re: NML - a Newgrf Meta Language
Thanks for your comments, it's information like this that helps us build a better compiler.
Fixed in r859/859.Lakie wrote:
- It outputs an Action1 even though no new sprites are loaded.
- It appears not support the first format of Action2 Tile Layouts, which has the option of no building sprite.
The main reason is that it required the least amount of thinking / coding. For switch blocks with only single byte/word variable accesses a smaller size would do, but that's currently not implemented. Is there any specific reason to use byte/word sizes for TTDPatch?Lakie wrote:
- Is there any particular reason that switch blocks will always use dword action2var sizes (89/8A)?
I opened a ticket about this.Lakie wrote:
- It generates multiple Action14s when surely it only needs one?
- Similarly it generates multiple Action4's when they could be merged.
Create your own NewGRF? Check out this tutorial!
Re: NML - a Newgrf Meta Language
I have started to do a bit of coding in NML a few days ago. I really have to congratulate you guys. Outstanding work, I am very impressed. I have had a lot of fun with NFO, but for new projects I will definitely switch to NML. Well done!
I have only one little question so far, but decided to put that directly on the bug tracker
I have only one little question so far, but decided to put that directly on the bug tracker

- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NML - a Newgrf Meta Language
EDIT: removed code which only works for some corner cases. See Yexo's posting below for a proper solution.
Last edited by planetmaker on 27 Oct 2010 09:23, edited 1 time in total.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: NML - a Newgrf Meta Language
While that works, it's a hack and the proper code also works:
Code from ogfx-trains, modified to always use the toyland graphics in the menu.
Code: Select all
graphics {
0xFF: toyland_passenger_rail_group;
normal_passenger_switch;
}
Re: NML - a Newgrf Meta Language
I would have sworn I tried that and it did not work, but of course it does.
Thank you both.

Thank you both.
Re: NML - a Newgrf Meta Language
how to install it???



Who is online
Users browsing this forum: Ahrefs [Bot] and 13 guests