Page 1 of 2

Japanese Town Names

Posted: 22 Jan 2007 23:34
by ickoonite
Now that OpenTTD has Unicode support and a Japanese localisation, Japanese town names seem appropriate. I have produced a patch, using real town names sourced from Wikipedia, which should be attached to this post.

Note that you'll need to have fonts working properly in OpenTTD for this to work.

Questions, comments, feedback, etc. more than welcome :D

Screenshot

Posted: 22 Jan 2007 23:52
by ickoonite
A screenshot of the patch in action:
Image

Posted: 23 Jan 2007 14:39
by Darkvater
Any language with only real town-names will not be expected. On big maps you can run out of town names and OpenTTD would crash. Would be great if you could make some random townname generator in Japanese :)

Posted: 23 Jan 2007 14:50
by MagicBuzz
About amount of town names...

I found playing a 2048x2048 map with "many" or "few" cities just produce the same amount of cities.
After some investigation, I just found it's because there is not enought cities names.

I found a list of the 400 biggest cities in France on Wiki. I think you'll find the same for most countries. Can't we use these names instead of the current small list ?

I did a patch on my PC and added these cities. I can get maps with many many cities. And it works fine. The only matter is that UTF-8 doesn't support a french character " œ ". ( œ ) so it must be replaced manualy by "oe" in the file...

Also, can't these town names be in a separat file ? Currenty it's an enum in C code. So we can't add/fix city names without compiling the game... It should be better if it was provided like the translation files.

You can find the patch here :
http://www.tt-forums.net/viewtopic.php?t=29578
PS : The diff contains another patch also. Keep defaut value then it will work as before (so you'll get only new cities).

Regards,
Sylvain

Posted: 23 Jan 2007 16:28
by peter1138
MagicBuzz wrote:The only matter is that UTF-8 doesn't support a french character " œ ". ( œ ) so it must be replaced manualy by "oe" in the file...
What? œ is code point U+0153...

Posted: 23 Jan 2007 16:30
by DaleStan
What Peter said (encoding is C5 93) If you want to generate UTF-8, one very easy way is to open Firefox and type "data:," in the address bar, followed by the text you want encoded. Eg: data:,œ or data:,This string contains "œ". (phpBB refuses to turn these into links.)
MagicBuzz wrote:I found a list of the 400 biggest cities in France on Wiki. I think you'll find the same for most countries. Can't we use these names instead of the current small list ?
400 is not nearly enough. I just started a random 2048x2048 game and Open generated 3136 towns.
MagicBuzz wrote:Also, can't these town names be in a separat file ?
Yes, they can, through the magic of NFO.
MagicBuzz wrote:The diff contains another patch also.
If you want any hope at all of this being committed, remove the other patch.

Posted: 23 Jan 2007 17:00
by ickoonite
Darkvater wrote:Any language with only real town-names will not be expected. On big maps you can run out of town names and OpenTTD would crash.
Then why is it OK for French, Spanish, Swiss, Romanian and Slovakian names, all of whose name pools (in namegen.h) are far smaller than the one I have created for Japanese?

Posted: 23 Jan 2007 18:05
by Bjarni
ickoonite wrote:
Darkvater wrote:Any language with only real town-names will not be expected. On big maps you can run out of town names and OpenTTD would crash.
Then why is it OK for French, Spanish, Swiss, Romanian and Slovakian names, all of whose name pools (in namegen.h) are far smaller than the one I have created for Japanese?
That is a really good question. One possible reason could be that they got added before variable sized maps. Maybe it would be advisable to look into this.

Posted: 23 Jan 2007 19:31
by MagicBuzz
peter1138 wrote:
MagicBuzz wrote:The only matter is that UTF-8 doesn't support a french character " œ ". ( œ ) so it must be replaced manualy by "oe" in the file...
What? œ is code point U+0153...
I can't find the RFC again. But I'm sure I read in the past in the UTF-8 RFC oelig was forgot, as they too latin-1 ISO charset for latin charset instead of latin-15 that fixed this bug.

May be it's fixed now, don't know...

Posted: 23 Jan 2007 21:05
by DaleStan
Did you know that the word "gullible" isn't in the dictionary?

(And, on a completely unrelated subject, you are aware that 153 is about 32% larger than 100, right?)

Posted: 23 Jan 2007 21:06
by MagicBuzz
Here is a patch with the COMPLETE list of the 36571 French cities (communes) including corsica but not off shore territories.

This is the list of all cities with a mayor. Small cities (hameaux) are not included in this list.

I removed double values (in fact, several cities uses the same name but in different locations...). I kept "only" 33689 names.

Source : http://fr.wikipedia.org/wiki/Listes_des ... _de_France

PS : Yes, it's not a mistake, a city is really named "Y" in France http://fr.wikipedia.org/wiki/Y_%28Somme%29 ;)

Working file (contains raw data and formulas from Wiki)
http://magicsite.manga-torii.com/files/villes.zip (Excel 2007 XLSX file)

Patch
http://magicsite.manga-torii.com/files/ ... cities.zip

Posted: 23 Jan 2007 21:08
by MagicBuzz
DaleStan wrote:Did you know that the word "gullible" isn't in the dictionary?

(And, on a completely unrelated subject, you are aware that 153 is about 32% larger than 100, right?)
I can't understand your humor. Sorry :roll:

Posted: 23 Jan 2007 21:15
by DaleStan
Translations:
First line: "I have no clue where you heard that oelig wasn't part of Unicode, but some sort of warning indicators REALLY should have gone off at that point, if not made you both blind and deaf."

Second line: "oelig is not in Latin-1. It also doesn't appear in Unicode's Latin-1 block. This might not be a coincidence."

Posted: 23 Jan 2007 21:21
by MagicBuzz
Just look at this :

Image

In Visual Studio 2005, I saved the namegen.h in UTF8 charset.
As you can see in the source code, the "œ" char is just fine.

Now, in game, after compilation with VS2005 :

Image

Maybe "œ" is correctly handled by UTF8... But OTTD using UTF8 can't. May be a simple font problem so.

Posted: 23 Jan 2007 21:25
by glx
Did you set a font in openttd.cfg?

Edit: added a screenshot (compiled with your patch)

Posted: 23 Jan 2007 21:25
by Bjarni
the problem is not UTF-8, but the available sprites in OpenTTD. It appears that we lack this particular letter. Try to use freetype and set a font that you konw got this letter and it should turn up.

Posted: 23 Jan 2007 21:48
by MagicBuzz
glx wrote:Did you set a font in openttd.cfg?

Edit: added a screenshot (compiled with your patch)
No, I didn't changed anything in the config file :?:

I'll try to use another font then.

-- Edit : You're right. I tested with Arial and it's OK. I just have to find a nice font now :D

Posted: 23 Jan 2007 21:52
by Darkvater
MagicBuzz wrote:
glx wrote:Did you set a font in openttd.cfg?

Edit: added a screenshot (compiled with your patch)
No, I didn't changed anything in the config file :?:

I'll try to use another font then.
Well, there you go, you need to set a font in the config file. /me points in the general direction of the readme :)

Posted: 23 Jan 2007 23:41
by MagicBuzz
It works fine with the new cities.
The only matter is that is nearly impossible for the game engine to find valid paths to create subsidies.

If I read the code, it choose a random city.

Then try 1000 times to pick up random city, then check if distance between cities is less than a defined valide (70 tiles).

On huge maps, as we can now have thousands cities, it's just near to be impossible to get it work.

I'm working on a patch to allow a number of tries based on the count of cities.

http://www.tt-forums.net/viewtopic.php?t=29578

I merged this fix in my subsidies range patch.

Posted: 24 Feb 2007 00:21
by ickoonite
I've finally got around to making a version which generates random names as well as reading from the list from Wikipedia, so we have a mix of both real and random names.

It would be nice, though, if the same scrutiny that is being imposed on this contribution would be imposed on those which I referred to in my previous post (French, Spanish, Swiss, Romanian and Slovakian), which, as of the current trunk, are still generating town names from a relatively small town list.

On that point, and in response to a point Darkvater made further up this thread, running out of town names does not actually cause OpenTTD to crash - well, at least it doesn't on the Mac OS X/PPC builds. Instead, it just means that town generation (once the list of towns is exhausted) is really, really slow.

Anyway, apply the patch (patch -p1) and try it out - questions, comments, feedback, etc. welcome. Remember you'll need Unicode font support in your openttd.cfg file!