New town names
Moderator: OpenTTD Developers
New town names
So I downloaded Erato's DPRK Town Names file (download/file.php?id=203852) and I edited the names.nml file to expand it. However, I've been searching for a couple days now but I can't for the life of me figure out how to compile it to make a grf... can someone please help? Thanks!
- Redirect Left
- Tycoon
- Posts: 7277
- Joined: 22 Jan 2005 19:31
- Location: Wakefield, West Yorkshire
Re: New town names
Have you looked on OpenTTD wiki?
One of these pages may have what you're searching for;
https://dev.openttdcoop.org/projects/nml - NML is I beleive what most people use for GRFs these days.
https://wiki.openttd.org/NewGRF_development_tools
One of these pages may have what you're searching for;
https://dev.openttdcoop.org/projects/nml - NML is I beleive what most people use for GRFs these days.
https://wiki.openttd.org/NewGRF_development_tools
Re: New town names
I've downloaded the NML but the documentation is kinda opaque (or I'm just dense?)... when I try to run (Windows) it a command line window comes up, there's some writing for an instant that I then can't see because it closes at once...Redirect Left wrote:Have you looked on OpenTTD wiki?
One of these pages may have what you're searching for;
https://dev.openttdcoop.org/projects/nml - NML is I beleive what most people use for GRFs these days.
https://wiki.openttd.org/NewGRF_development_tools
I've also looked around on the wiki but I couldn't find anything obvious about how to compile NML source into a usable GRF...
Re: New town names
This should help: https://www.tt-wiki.net/wiki/NMLTutorial
Quickest way for one time use (imo) is shove everything in appropriate NML folder; navigate there with CMD, type in nml command; done. Tutorial should explain the details
Quickest way for one time use (imo) is shove everything in appropriate NML folder; navigate there with CMD, type in nml command; done. Tutorial should explain the details
Re: New town names
NML is not a Windows GUI executable, it is a command line executable.kokutetsu wrote:... when I try to run (Windows) it a command line window comes up...
Do you like drones, quadcopters & flying toys? Check out Drone Strike Force!
Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Re: New town names
Thanks for the replies! They've been a help - I've got NML installed.
But when I tried to run
But when I tried to run
It returnednmlc -c --grf dprknames2.grf dprknames.pnml
The entire body of said pnml file isIllegal character '#' (character code 0x23) at "dprknames.pnml", line 2, column 1
I didn't write this part, this was part of the original source I downloaded that (I imagine) works properly... the only thing I changed anywhere was the stuff in the names.pnml file.// Define GRF
#include "src/header.pnml"
#include "src/names.pnml"
//cd /mnt/c/Temp/MMT
//make -B
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: New town names
That is the correct way to call it - on an nml file.nmlc -c --grf dprknames2.grf dprknames.pnml
The filename already gives it away, it ends with pnml:
the "p" indicates that the file still needs pre-processing. The #include statements and similar are not part of the nml syntax itself. That file still needs pre-processing so that the files mentioned there are included at the given point, in this case by the cpp pre-processor (that is of the gcc). Maybe you can get away with simply copy & pasting the mentioned files in place of the #include "filename".// Define GRF
#include "src/header.pnml"
#include "src/names.pnml"
//cd /mnt/c/Temp/MMT
//make -B
Usually such filenames are used to easier separate different parts of projects and then they are built using make and cpp as suggested by the last commented line in your quote. Those commands could be available also on windows when you install them in the linux subsystem.
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: New town names
I'm not sure I get what you mean - do you mean to copy & paste the actual contents of the two .pnml files in place of the #include lines?planetmaker wrote:Maybe you can get away with simply copy & pasting the mentioned files in place of the #include "filename".
Hmm, that sounds like a lot of reading and learning for me before I dare take a stab at that... I'm not even entirely sure I understood it right, so for now I'll just give your first suggestion a try and hope for the best.Usually such filenames are used to easier separate different parts of projects and then they are built using make and cpp as suggested by the last commented line in your quote. Those commands could be available also on windows when you install them in the linux subsystem.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: New town names
You could simply start with something where it is already in one file (+ lang files):
https://dev.openttdcoop.org/projects/du ... tnames.nml
https://dev.openttdcoop.org/projects/du ... tnames.nml
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: New town names
Oh, well that's an idea too! I think I'll do that for now with real town names, and then save the thing I've written with pre and post sections for generating fake town names, for later...planetmaker wrote:You could simply start with something where it is already in one file (+ lang files):
https://dev.openttdcoop.org/projects/du ... tnames.nml
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: New town names
http://bundles.openttdcoop.org/german-t ... es/LATEST/ is a more complex example, including real and fantasy names composed from parts. Its original is also in a format which needs a pre-compiler, but for convenience there's the pre-compiled NML as well on the build artefacts server.
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: New town names
I'm going ahead with doing just a simple grf with real place names for the moment, so I tried to test-compile that dtnames.nml file, but when I tried to run the nmlc etc command, it returned this:
To take a little step back, I decided to do this test-compile of the original dtnames.nml because when I tried compiling the .nml file I made based on it, I got a return of:
I made no changes at all to the file, just tried to compile it as I got it from the link...nmlc ERROR: "dtnames.nml", line 16: Unknown string "STR_GRF_DESCRIPTION"
To take a little step back, I decided to do this test-compile of the original dtnames.nml because when I tried compiling the .nml file I made based on it, I got a return of:
This surprised me, because the first line of the file contains onlynmlc ERROR: "dprknames2.nml", line 1: Syntax error, unexpected token "{"
//
Re: New town names
You need the lang folder of the project too.
The tutorial explains this, but GRFs are basically made of
a) a .nml file where all the code goes
b) a lang folder where all the strings are defined for different game languages (like STR_GRF_DESCRIPTION)
c) a grf folder where all the graphics go; typically not needed for town names
The tutorial explains this, but GRFs are basically made of
a) a .nml file where all the code goes
b) a lang folder where all the strings are defined for different game languages (like STR_GRF_DESCRIPTION)
c) a grf folder where all the graphics go; typically not needed for town names
Re: New town names
just grab the source archive from the nightlies (german-townnames-nightly-r35-source.tar.gz)
simplest is to drop the nml file in the 'german-townnames-nightly-r35-source' directory, change the directory of the shell to it ('cd german-townnames-nightly-r35-source') and run nmlc.
Otherwise, you need the 'lang' directory next to the nml file. The language files contain the texts describing the content of the grf, and setting parameters. (they are utf-8 text files, you can open them with a somewhat sane text editor.)
As for error messages, line numbers are not absolutely correct for several reasons. They do give a good rough indication of the point of where the compiler gives up though (which is not always the same as the point of the error), especially if your file is longer than about 5 lines. Off by 1 is quite comon, especially around white space (comment doesn't exist for the compiler, line 1 is "" to it rather than the "//" that you see.)
simplest is to drop the nml file in the 'german-townnames-nightly-r35-source' directory, change the directory of the shell to it ('cd german-townnames-nightly-r35-source') and run nmlc.
Otherwise, you need the 'lang' directory next to the nml file. The language files contain the texts describing the content of the grf, and setting parameters. (they are utf-8 text files, you can open them with a somewhat sane text editor.)
As for error messages, line numbers are not absolutely correct for several reasons. They do give a good rough indication of the point of where the compiler gives up though (which is not always the same as the point of the error), especially if your file is longer than about 5 lines. Off by 1 is quite comon, especially around white space (comment doesn't exist for the compiler, line 1 is "" to it rather than the "//" that you see.)
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: New town names
Well, progress - I figured out what the issue about the "token {" was... well now I've installed notepad++ and that issue is settled!
I've got my new grf successfully compiled, started a new game to test, and (naturally!) noticed an issue... as you can see in the picture, a town was generated with a blank name. If you look at the names in the town directory list, you'll see that all the UTF-8 characters show up just fine, so that's not the issue.
I started three new games, and one blank-name town turned up in each of the three games... but in the nml body there isn't a line that's text(" ", 1), of course...
I've got my new grf successfully compiled, started a new game to test, and (naturally!) noticed an issue... as you can see in the picture, a town was generated with a blank name. If you look at the names in the town directory list, you'll see that all the UTF-8 characters show up just fine, so that's not the issue.
I started three new games, and one blank-name town turned up in each of the three games... but in the nml body there isn't a line that's text(" ", 1), of course...
- Attachments
-
- nameissue.png (680.3 KiB) Viewed 2194 times
Re: New town names
First of all, congrats, you got stuff running, and it worked (mostly).I started three new games, and one blank-name town turned up in each of the three games... but in the nml body there isn't a line that's text(" ", 1), of course...
I fully agree with you that the name of the town is not visible. Having a name consisting of a single space is one form of an 'empty' name (technically it's not empty, it's a non-visible non-empty name, since the string has one space character in it). Other options are of course
Code: Select all
text("", 1)
Code: Select all
text(" ", 1)
Iirc, a town name may consist of several parts, where parts can be optional, so another way to construct an empty name, is to have all parts optional, so the computer can skip all parts, leaving you with 'nothing' as a name.
As for how to find what happens, you can debug it. Make a copy of the source code and store it somewhere out of the way. Then start hacking the source code. Make it smaller/simpler while you check if the problem continues to exist. If you have 15 choices somewhere, 2 are sufficient, etc. At some point the problem will go away. Then you know the crucial change was in the edits that you did since the last test. Eventually, you will find the edit that makes the problem disappear. At that point, try to understand why the behavior changes (computer use rules for deciding something, understand that rule).
Once you understand the rule, go back to your stored copy (and make a copy of your copy, just in case the fix doesn't work out as you expect), and fix the problem.
Another way is to get external help, like here at the forum, or at the #openttd IRC channel. You will need to supply the source code, so others can read it, look for errors, or even debug it like described above. Generally, you'll get pointed to the problem spot, so you can fix it.
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: New town names
Thanks! It's a small thing, to be sure, but it does boost one's confidence...Alberth wrote:First of all, congrats, you got stuff running, and it worked (mostly).
Well, this one is using only a single group of names - so unlike the town name grfs that call a "prefix" and a "suffix" to create random names by combining two elements, this is just calling a single element, without making any combinations.I fully agree with you that the name of the town is not visible. Having a name consisting of a single space is one form of an 'empty' name (technically it's not empty, it's a non-visible non-empty name, since the string has one space character in it). Other options are of course(0 spaces, ie the really empty string) orCode: Select all
text("", 1)
(with 2 spaces), etc.Code: Select all
text(" ", 1)
Iirc, a town name may consist of several parts, where parts can be optional, so another way to construct an empty name, is to have all parts optional, so the computer can skip all parts, leaving you with 'nothing' as a name.
And in that single group, there are no elements like
Code: Select all
text("", 1)
Code: Select all
text(" ", 1)
Here is the entire nml: https://pastebin.com/vek7dx6a
In the meantime I'm going to go through the code chunk by chunk as you suggest.
I've been connected there for a week now and have seen no activity at all apart from some automated (?) stuff from DevZone...at the #openttd IRC channel
Re: New town names
There are several #openttd channels, You're in #openttdcoop.devzone ?
Try the #openttd channel (without "coop" and without ".<something>")
EDIT: Ah, a pastebin, thanks.
So, what do you thinkdoes, in particular the 'text("", 5),' line ?
Just to be sure we're on the same page, I'll tell you any way
This is the main entry point. It makes a random selection between "", and a name in 'prefix' (the long list above), with a ratio 5:1. Since OpenTTD discards double names, you'll get only one "" name in the game.
The solution is to delete that line of course. But then this code makes a selection from 1 option only, which is a bit silly. Instead move the long list of names to here, and drop the 'prefix' block.
For more extensive documentation, see https://newgrf-specs.tt-wiki.net/wiki/NML:Town_names
Try the #openttd channel (without "coop" and without ".<something>")
EDIT: Ah, a pastebin, thanks.
So, what do you think
Code: Select all
town_names {
styles : string(STR_STYLES);
{
text("", 5),
town_names(prefix, 1),
}
}
Just to be sure we're on the same page, I'll tell you any way
This is the main entry point. It makes a random selection between "", and a name in 'prefix' (the long list above), with a ratio 5:1. Since OpenTTD discards double names, you'll get only one "" name in the game.
The solution is to delete that line of course. But then this code makes a selection from 1 option only, which is a bit silly. Instead move the long list of names to here, and drop the 'prefix' block.
For more extensive documentation, see https://newgrf-specs.tt-wiki.net/wiki/NML:Town_names
Being a retired OpenTTD developer does not mean I know what I am doing.
Re: New town names
Ohhhhh well now I feel silly for not having thought of that!
I went ahead and changed it as you suggested, so that now it's like
and it's working just fine! Thank you!!
And yeah, I've now joined #openttdcoop... I've been sitting on #openttdcoop.devzone all this time...
Well, now time to start learning the less easy stuff!
I went ahead and changed it as you suggested, so that now it's like
Code: Select all
town_names {
styles : string(STR_STYLES);
{
text("foo", 5),
text("bar", 5),
text("baz", 5),
}
}
And yeah, I've now joined #openttdcoop... I've been sitting on #openttdcoop.devzone all this time...
Well, now time to start learning the less easy stuff!
Who is online
Users browsing this forum: No registered users and 5 guests