Japanese Town Names

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

ickoonite
Engineer
Engineer
Posts: 21
Joined: 19 Jan 2007 02:38
Location: Cambridge, UK

Japanese Town Names

Post 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
Attachments
japanese_town_names.patch.gz
Japanese town names patch for OpenTTD
(9.17 KiB) Downloaded 233 times
ickoonite
Engineer
Engineer
Posts: 21
Joined: 19 Jan 2007 02:38
Location: Cambridge, UK

Screenshot

Post by ickoonite »

A screenshot of the patch in action:
Image
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post 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 :)
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post 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 " &oelig; ". ( œ ) 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
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1659
Joined: 30 Mar 2005 09:43

Post by peter1138 »

MagicBuzz wrote:The only matter is that UTF-8 doesn't support a french character " &oelig; ". ( œ ) so it must be replaced manualy by "oe" in the file...
What? œ is code point U+0153...
He's like, some kind of OpenTTD developer.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
ickoonite
Engineer
Engineer
Posts: 21
Joined: 19 Jan 2007 02:38
Location: Cambridge, UK

Post 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?
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post 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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

peter1138 wrote:
MagicBuzz wrote:The only matter is that UTF-8 doesn't support a french character " &oelig; ". ( œ ) 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...
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post 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?)
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post 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
Last edited by MagicBuzz on 23 Jan 2007 21:09, edited 1 time in total.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post 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:
Last edited by MagicBuzz on 23 Jan 2007 21:21, edited 3 times in total.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post 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."
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post 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.
User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 621
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Post by glx »

Did you set a font in openttd.cfg?

Edit: added a screenshot (compiled with your patch)
Attachments
As you can see, it works :) (using tahoma bold font)
As you can see, it works :) (using tahoma bold font)
Non nommé, 2 Jan 1950.png (81.71 KiB) Viewed 4639 times
Last edited by glx on 23 Jan 2007 21:37, edited 2 times in total.
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post 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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post 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
Last edited by MagicBuzz on 23 Jan 2007 21:55, edited 1 time in total.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post 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 :)
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1286
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post 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.
ickoonite
Engineer
Engineer
Posts: 21
Joined: 19 Jan 2007 02:38
Location: Cambridge, UK

Post 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!
Attachments
japanese_town_names_20070224.patch.gz
Updated version of the Japanese town names patch, which now generates random names too.
(11.48 KiB) Downloaded 191 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 0 guests