NML - a Newgrf Meta Language

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

Moderator: Graphics Moderators

User avatar
PNDA_
Engineer
Engineer
Posts: 62
Joined: 18 Jul 2018 17:26
Location: Germany

Re: NML - a Newgrf Meta Language

Post by PNDA_ »

Eddi wrote:
  • property 08 is a 4 byte-ID (like GRF-ID, Cargo-Label, etc.), not a String
Ah, that makes sence, so it would work like Railtypelabels, just for stationtypelabels, I guess. For example, I think, that something like "STSP" (=Station Single Platforms) would work, right?
Eddi wrote:
  • where did you get 0xC5 from for "name"? couldn't find that anywhere
  • the action0 complains about C5 being unknown (see previous question)
I got 0xC5 from the nfo output of m4nfo. I saw the C5 in front of the Name in the shown code, so I thought that might be it. So what should be used instead of C5, I could not find reference on the wiki for the definition of the name of a station tile?

Code: Select all

10 * 21	 04 04 FF 01 01 C5 "Empty Platform" 00
Eddi wrote:
  • the action2 is completely ill-formed. as far as i understand stations, tile layout should be a property (action0), not "graphics" (action2). no clue what you were trying to achieve there
I took a look at the Airports and Airport tiles, and they worked like the code I showed, that it referred to graphics. Though you might be right, because 0x0E for Stations is a custom layout definition, so that might define the layout and the default is just a single tile.
Eddi wrote:
  • the two action4 complain that you're using language ID 7F (indicating byte-IDs) instead of FF (indicating word-IDs). what that means i have no clue.
Maybe that has to do with the size of the ID? As of output_base.py the size seems to switch between "bytex", "wordx" and "dwordx" according to the size of the value. Could also be because I used C5 for the Name, that those correspond.
planetmaker wrote:Do you happen to have a WIP git repo for your station code?
Well, kinda. Im currently just testing files and sometimes when I get something to work, I push it to this git repo.
Hello!
ImageImageImage
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi »

PNDA_ wrote:
Eddi wrote:
  • where did you get 0xC5 from for "name"? couldn't find that anywhere
  • the action0 complains about C5 being unknown (see previous question)
I got 0xC5 from the nfo output of m4nfo. I saw the C5 in front of the Name in the shown code, so I thought that might be it. So what should be used instead of C5, I could not find reference on the wiki for the definition of the name of a station tile?

Code: Select all

10 * 21	 04 04 FF 01 01 C5 "Empty Platform" 00
yeah, but that is in an action 4, not an action 0. let's dissect that:

Code: Select all

10 * 21 // sprite number and length
04 //action 4 (string)
04 //feature 4 (station)
FF //language ID (like i mentioned above, FF for Word-sized IDs instead of 7F)
01 //one string
01 //lower byte of the ID, which station
C5 //upper byte of the ID, indicating "station name"
"Empty Platform" //actual string
00 //terminating 0
nmlc likely will have a flag somewhere to define that action4 should be output with word-sized IDs instead of byte-sized, look at e.g. how houses do it differently to vehicles.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NML - a Newgrf Meta Language

Post by stefino_cz »

Hi all, is possible to code in NML houses what will be dependent on road possition? We need to rotate houses into right possition to do best vizual effect :) We found this function in NFO. Is there any way how to code it in NML? Thanks :)
nfo.png
nfo.png (43.27 KiB) Viewed 1256 times
Image
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML - a Newgrf Meta Language

Post by planetmaker »

Yes. Check the "nearby" variables, nearby_tile_class in particular and simply check for the presence of road. I believe FIRS uses similar for more than 5 years for the petrol pump.
Vanderbildt
Engineer
Engineer
Posts: 31
Joined: 24 Feb 2016 16:40

Re: NML - a Newgrf Meta Language

Post by Vanderbildt »

Hello
NML 4 need a update.
can someone help please.

Thank you

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

Re: NML - a Newgrf Meta Language

Post by GarryG »

I get my updates to NML from here https://bundles.openttdcoop.org/nml/?C=M&O=D
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
Auz Eyecandy TramTracks: viewtopic.php?t=89908
Vanderbildt
Engineer
Engineer
Posts: 31
Joined: 24 Feb 2016 16:40

Re: NML - a Newgrf Meta Language

Post by Vanderbildt »

Thank you.
SORRY my request was not precise.
NML needs a update for:https://github.com/OpenTTD/OpenTTD/pull/6867

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

Re: NML - a Newgrf Meta Language

Post by GarryG »

information I received before say it could be several months before that update is available .. I to is waiting for that update :D
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
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5649
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: NML - a Newgrf Meta Language

Post by andythenorth »

For 16-cargo-in-16-cargo-out, there's a set of updates from nielsm here https://github.com/PeterN/nml/commits/16-in-out

I'm testing them with FIRS, they work so far, but they may be incomplete.

If you know how to build NML yourself from the sources, you can try them, helping test will be very valuable.

https://github.com/OpenTTD/nml/
https://github.com/OpenTTD/nml/pull/15

Meanwhile...

NML has no regular maintainer or active contributors currently.

It has been kept on life support by frosch, planetmaker and me. But none of us are able to develop it or release it regularly.

To be quite precise then, it if newgrf authors wish to continue using NML, new contributors will need to emerge :)

Otherwise I think NML will die.

I am already evaluating the alternatives (nfo, m4nfo).
User avatar
GarryG
Tycoon
Tycoon
Posts: 5836
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: NML - a Newgrf Meta Language

Post by GarryG »

andythenorth wrote:For 16-cargo-in-16-cargo-out,
Wish I could help but my knowledge of coding is limited.

Even visiting those sites you provided links to I get lost looking at what you have there.

If can PM what I need, happy to test with my Industry or with you fires and see what I can find any problems.

Cheers

Garry
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
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
jfs
Tycoon
Tycoon
Posts: 1743
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NML - a Newgrf Meta Language

Post by jfs »

I'm trying to splice together support for the 16-in-16-out feature, it works on the basic level, but yes it still needs a lot of care to be good.

Some tasks that aren't (as) dependent on grokking Python, parsers, and their combination:
- Writing better examples and test cases (NML code)
- Writing documentation and a migration guide for going from the old syntax and variables to the new
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: NML - a Newgrf Meta Language

Post by Wahazar »

I los my laptop together with all openttd dev environmen and, what is worse, together with command history.
Now I don't remeber, how to set-up properly nmlc on my new computer.
I have nmlc installed, nmlc dir added to the path, ply dir from ply-3.11 copied to nml-master dir,
now I'm trying to perform command
import ply.lex as lex
then computer is stalled for while, later I got message:
import: not authorized `lex' @ error/constitute.c/WriteImage/1028.
(even with sudo).
Any clue what goes wrong?
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi »

i would guess it's trying to write a temp file somewhere it shouldn't.

have you tried using pip to install ply, instead of manually copying?
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: NML - a Newgrf Meta Language

Post by Wahazar »

Eddi wrote: have you tried using pip to install ply, instead of manually copying?
Thanks, sudo apt-get install python-ply works well and is much more simply than generic method desrcibed on ply page.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: NML - a Newgrf Meta Language

Post by 3iff »

andythenorth wrote:For 16-cargo-in-16-cargo-out, there's a set of updates from nielsm here https://github.com/PeterN/nml/commits/16-in-out

I'm testing them with FIRS, they work so far, but they may be incomplete.

If you know how to build NML yourself from the sources, you can try them, helping test will be very valuable.

https://github.com/OpenTTD/nml/
https://github.com/OpenTTD/nml/pull/15

Meanwhile...

NML has no regular maintainer or active contributors currently.

It has been kept on life support by frosch, planetmaker and me. But none of us are able to develop it or release it regularly.

To be quite precise then, it if newgrf authors wish to continue using NML, new contributors will need to emerge :)

Otherwise I think NML will die.

I am already evaluating the alternatives (nfo, m4nfo).
I'd love to help...BUT... I don't have regular internet access, I'm unable to compile anything at the moment, and barely know how to do it anyway.

I am very good at testing existing/new code and wrangling out bugs, so I'm very happy to assist with those tasks.

If there's anyone who has compiled this forked-nml and can send me a copy, then I'd love to give it a go. (via PM is fine)
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: NML - a Newgrf Meta Language

Post by Eddi »

you don't have to compile nmlc, it's a python program that you can just run with an installed version of python

the .exe is just provided for convenience, and is basically just python and nmlc wrapped up in one bundle
User avatar
3iff
Tycoon
Tycoon
Posts: 1093
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: NML - a Newgrf Meta Language

Post by 3iff »

Ah, didn't know that. I'll give it a go. I can do some python programming, My skill level is about 5 out of 100 (so not exactly brilliant!)
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: NML - a Newgrf Meta Language

Post by stefino_cz »

Hi. I have a question about houses graphics. Is possible to have a house graphics dependent at population of the city? I know that way how to classify houses or city object generaly is due to city zones. But there is still a lot of objects what could be dependent at population. For example housing estates in the cities are in outskirts. Village has outskirt too but there are no housing estates. In case of population depndency I can for example say that this and this bulding will show in outskirt but the first building will be build in the cities under 1500 population and second in the cities above 1501. This will make cities more different - we will get smaller cities with "older" village's elements and bigger cities with modern elements.

Stefino_cz
Image
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: NML - a Newgrf Meta Language

Post by PikkaBird »

stefino_cz wrote:Hi. I have a question about houses graphics. Is possible to have a house graphics dependent at population of the city?
Short answer: Yes. Long answer: Yeeees. Check the town variables.

You're probably better off having two different buildings (unless you want "old village" to become "modern city" instantly when the population hits 1501), and either gradually supplanting one with the other once a city reaches the size limit, having some buildings reserved for OpenTTD "Cities", or finding some other mechanism to decide when each is built.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NML - a Newgrf Meta Language

Post by planetmaker »

PikkaBird wrote: You're probably better off having two different buildings (unless you want "old village" to become "modern city" instantly when the population hits 1501), and either gradually supplanting one with the other once a city reaches the size limit, having some buildings reserved for OpenTTD "Cities", or finding some other mechanism to decide when each is built.
Indeed. Don't make your lief needlessly complicated: use different houses / houseIDs for different looks.
Use placement rules for (dis)allowing construction instead of (ab)using animation for a single house.
As additional benefit you gain the advantage of the houses being constructed (constuction stages shown) when they change as a town grows beyond a size threshold instead of changing view in an instant.

https://newgrf-specs.tt-wiki.net/wiki/NML:Towns and https://newgrf-specs.tt-wiki.net/wiki/NML:Houses
Especially interesting might be the town variables is_city and population. And the house variables other_class_count_town (if you define house classes (property building_class) and use different for different towns). Use these variables in the houses construction_check callback.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 5 guests