Town Name Sets - Scenario Opportunity

Got an idea for a new feature in TTDPatch? Post it here.

Moderator: TTDPatch Moderators

User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Town Name Sets - Scenario Opportunity

Post by wallyweb »

There are now many Town Name Sets available.
The desired Town Name Set must be selected before starting a new game or starting a new scenario.
Once a game has been started, it has towns and the Town Name Set cannot be changed. This is logical and expected.
Once a new scenario has been created and towns have been built, the Town Name Set can not be changed. This is logical and expected.
However, what about before towns have been built? Unfortunately the Town Name Set cannot be changed.
Normally, this would not be an issue as the theme for the scenario has already been decided and the appropriate Town Name Set already selected.
Here is the problem ... When using an outside application, such as Michael Udaltsov's (aka CCCP) sv0creator, to create a TTD map from an image, that new map gets the default TTD Town Names, even though new towns have yet to be built.
Here are the opportunities:
1. Add a parameter to sv0creator to specify a Town Name Set to be used. Unfortunately Michael created his application some five years ago and has not looked at it since then. Real life obligations leave him little time to revisit his code and look into this feature. His source code is published on his web site and is available for anyone who wishes to look into it. However, In Michael's own words:
The source code to sv0creator is available, but I'm assuming you don't want to try modifying it yourself... it's not even something I want to do. I was fairly new to programming back then, so the code is somewhat over-complicated. From what I remember, it uses pieces of binary data taken from a blank scenario file and adds in the lanscape data. I'm not sure how TTD saves the language settings, but I think it would require changing the entire block of data that's used as the template. This would be difficult to change in the sv0creator source, since the data is already compressed in the RLE format that TTD expects, with the landscape data cut out of it. There are actually several landscape pieces, some of which are not modified (they are default for a blank map).
2. Via TTDPatch, add an option to the scenario editor to allow the Town Name Set to be changed while in the editor and before towns have been built.
3. Or a suggestion from Michael:
However, I think it would be almost trivial to copy map data from one file to another (with the proper language or other settings you want). You'd need to first decompress the file data - sv1codec from http://marcin.ttdpatch.net/sv1codec/ should do it. There's a page on that site too that describes the uncompressed file format. I think that as long as the scenario just has a heightmap (no players, towns, industries, etc), it should be possible to just copy all the landscape blocks from one file to another with a hex editor. Then re-compress the result with sv1codec and load it as a scenario.
I am neither a dev nor a coder, so these options are beyond my abilities, but perhaps some qualified individual would like to take this on. I have cookies ... :wink:
NOTE to OpenTTD fans, I'm not an OTTD player, so I don't know if this is possible in OTTD, but please feel free to contribute to the discussion that I hope follows below. This is something that I think we all could use. :mrgreen:
Last edited by wallyweb on 03 Dec 2008 15:52, edited 1 time in total.
User avatar
Hamilton2007
Transport Coordinator
Transport Coordinator
Posts: 289
Joined: 16 Nov 2008 10:57
Location: Belgium

Re: Town Name Sets - Scenario Opportunity

Post by Hamilton2007 »

How do you make Town name sets, does anybody know that ?

sorry if it's not 100% on topic here.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

To be honest, it would be easier to add the functionality to a load pixel raw datafile (heightmap) into TTDPatch then trying to change town names...
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

Hamilton2007 wrote:How do you make Town name sets, does anybody know that ?

sorry if it's not 100% on topic here.
A good question ... follow the link in my signature to see how it was done for the Canadian Town Names Set. Also, you can do a forum search using the key words town name.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

Can you post a sample image for loading?
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

eis_os wrote:Can you post a sample image for loading?
How is this?
saintjohn.png
saintjohn.png (16.99 KiB) Viewed 5230 times
or is this type better?
nb.png
nb.png (399.03 KiB) Viewed 5235 times
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by michael blunck »

wallyweb wrote:[...] or is this type better?
OK, I know you guys are bi-lingual there, but why is the province called New Brunswick / Nouveau-Brunswick at all?

regards
Michael
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

michael blunck wrote:
wallyweb wrote:[...] or is this type better?
OK, I know you guys are bi-lingual there, but why is the province called New Brunswick / Nouveau-Brunswick at all?

regards
Michael
That's a good question. Federally, Canada is officially bilingual English/French and all federal documentation must be bilingual. Add to this that New Brunswick is the only officially bilingual province in Canada.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Town Name Sets - Scenario Opportunity

Post by Rubidium »

I'd say it's probably best to support OpenTTD's system; in case an image has exactly 16 colours use the colour indices as heightlevel and otherwise use the "grey value" linearly mapped to 16 heightlevels. After loading the heightmap we loop over the map making sure all height changes are within the limits of (Open)TTD.

The how to make a heightmap thread (http://www.tt-forums.net/viewtopic.php?t=27052) shows quite a few examples of the "grey value" type of map. TrueBrain's post at http://www.tt-forums.net/viewtopic.php?p=540618#p540618 shows a heightmap image with exactly 16 colours.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

Rubidium wrote: ...
Well, the problem isn't one of how to make a height map. The problem is how to get the imported map to accept new Town Names instead of the default ones. Does OTTD have a handle on this?
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Town Name Sets - Scenario Opportunity

Post by Rubidium »

wallyweb wrote:The problem is how to get the imported map to accept new Town Names instead of the default ones. Does OTTD have a handle on this?
OpenTTD does take the language selected in the main menu, which can be any of the town name GRFs it has found during the scan of the NewGRFs during start up.
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

Note: you don't need to create a broken savegame, when you are able to load a heightmap directly into TTDPatch,
while loading works, the fixing of slopes isn't trival. I only get a) broken maps or b) fully flat ones :(
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Town Name Sets - Scenario Opportunity

Post by Rubidium »

eis_os wrote:...while loading works, the fixing of slopes isn't trival...
You might be interested in reading OpenTTD's code to fix the slopes at http://vcs.openttd.org/svn/browser/trun ... p.cpp#L361
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: Town Name Sets - Scenario Opportunity

Post by eis_os »

Yes, that looks quite similar

Code: Select all


	mov esi, 0x0101
.loop:
	push esi
	dec esi
	mov dx, [landscape4(si)]	// left edge
	and dx, 0xF
	pop esi

	mov bx, dx
	
	push esi
	sub esi, 0x100
	mov dx, [landscape4(si)]	// top edge
	and dx, 0xF
	pop esi

	cmp bx, dx
	jg .topedge
	mov bx, dx	
.topedge:

	push esi
	mov dx, [landscape4(si)]	// the tile
	and dx, 0xF
	pop esi
	
	cmp dx, bx
	jle .nocorrection
	mov [landscape4(si)], bl
 .nocorrection:
	
	inc esi
	cmp esi, 0xFEFF
	jbe .loop
	
	
	nop
	nop
	nop

	
	mov esi, 0xFEFE
.loop2:
	push esi
	inc esi
	mov dx, [landscape4(si)]	// right edge
	and dx, 0xF
	pop esi

	mov bx, dx
	
	push esi
	add esi, 0x100
	mov dx, [landscape4(si)]	// bottom edge
	and dx, 0xF
	pop esi

	cmp bx, dx
	jg .bottomedge
	mov bx, dx	
.bottomedge:

	push esi
	mov dx, [landscape4(si)]	// the tile
	and dx, 0xF
	pop esi
	
	cmp dx, bx
	jle .nocorrection2
	mov [landscape4(si)], bl
 .nocorrection2:
	
	dec esi
	jnz .loop2
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

Rubidium wrote:
wallyweb wrote:The problem is how to get the imported map to accept new Town Names instead of the default ones. Does OTTD have a handle on this?
OpenTTD does take the language selected in the main menu, which can be any of the town name GRFs it has found during the scan of the NewGRFs during start up.
So if I understand you correctly, if I use sv0creator to create a map and then open it in OTTD's scenario editor, I will be able to build towns with a Town Name Set selected when starting OTTD?
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Town Name Sets - Scenario Opportunity

Post by Rubidium »

wallyweb wrote:So if I understand you correctly, if I use sv0creator to create a map and then open it in OTTD's scenario editor, I will be able to build towns with a Town Name Set selected when starting OTTD?
That I'm not sure of, but looking at the functionality of sv0creator OpenTTD can do that out-of-the-box and then it uses the selected town name set. And since a few minutes you can also change the town name set in the scenario editor when there are no towns on the map.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

Rubidium wrote:
wallyweb wrote:So if I understand you correctly, if I use sv0creator to create a map and then open it in OTTD's scenario editor, I will be able to build towns with a Town Name Set selected when starting OTTD?
That I'm not sure of, but looking at the functionality of sv0creator OpenTTD can do that out-of-the-box and then it uses the selected town name set. And since a few minutes you can also change the town name set in the scenario editor when there are no towns on the map.
You are fast! :D
Now if we can get that functionality into TTDPatch I would be a very happy player. :wink:

Hmm ... an interesting thought ... Can a 256x256 map created in OTTD be imported into TTD or TTDPatch?
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Town Name Sets - Scenario Opportunity

Post by Rubidium »

wallyweb wrote:Hmm ... an interesting thought ... Can a 256x256 map created in OTTD be imported into TTD or TTDPatch?
Technically it is possible to write a converter from OpenTTD savegames to TTD(Patch) savegames as long as the savegame doesn't contain things that TTD(Patch) doesn't understand, e.g. diagonal slopes with rail on both sides.
However... reasonably it's unfeasible to write and maintain such code as OpenTTD's savegame format is still evolving.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Town Name Sets - Scenario Opportunity

Post by wallyweb »

Rubidium wrote:
wallyweb wrote:Hmm ... an interesting thought ... Can a 256x256 map created in OTTD be imported into TTD or TTDPatch?
Technically it is possible to write a converter from OpenTTD savegames to TTD(Patch) savegames as long as the savegame doesn't contain things that TTD(Patch) doesn't understand, e.g. diagonal slopes with rail on both sides.
However... reasonably it's unfeasible to write and maintain such code as OpenTTD's savegame format is still evolving.
I kind of suspected that :( ... oh well ... It would have been nice.
Circeus
Traffic Manager
Traffic Manager
Posts: 181
Joined: 07 Jun 2008 21:26

Re: Town Name Sets - Scenario Opportunity

Post by Circeus »

michael blunck wrote:
wallyweb wrote:[...] or is this type better?
OK, I know you guys are bi-lingual there, but why is the province called New Brunswick / Nouveau-Brunswick at all?

regards
Michael
How about the fact most of the Inhabitants there were French when the name changed to New Brunswick? (Nova Scotia is "Nouvelle-Écosse", British Columbia is "Colombie-Britannique" and Newfoundland is "Terre-Neuve") Even then, this is not Canada only: in French, New South Wales is "Nouvelle-Galles du Sud", Cornwall (England) is "Cornouaille", and Wales itself itself is "Pays de Galles".
Post Reply

Return to “Suggestions”

Who is online

Users browsing this forum: No registered users and 7 guests