Skip to content

Excerpts

Dr. Martin Brumm edited this page May 12, 2020 · 2 revisions

Excerpts

From rails

In the last years the project Rails had not a wiki, so most of the shared knowledge can be found in the archives of the rails-devel mailinglist. The reading and finding of information in the archives is not always very simple. You can find here some, partly heavily editet, excerpts of interesting threads or emails. Contents

1 Summary of the excerpts
2 The excerpts
    2.1 Excerpt 001 - Creation Tree for the different xml files
    2.2 Excerpt 002 - Tile identifiers
    2.3 Discussion around Tiles from Erik Vos on rails-devel

Summary of the excerpts

#Excerpt 001: Erik Vos recapitulates the workflow for the creation of the different xml files
#Excerpt 002: Erik Vos recapitulates how the tile identifiers are numbered in the rails project. 

The excerpts

Excerpt 001 - Creation Tree for the different xml files

Source Re: [Rails-devel] Tiles.xml, TileSet.xml, and svg files From: Erik Vos <erik.vos@xs...> - 2010-01-11 22:40

  1. Why do we have separate TileSet.xml and Tiles.xml?

TileSet.xml contains the game-specific tile properties, and Tiles.xml has the game-independent tile properties. The latter file is generated by rails.util.MakeGameTileSets (a stand-alone Java class/program) from TileSet.xml and the overall Tiles.xml file that has all tiles (this file and several other files that I'm going to mention are in directory 18xx/tiles of the CVS repository on Sourceforge). This program also checks TileSet.xml against Map.xml for consistency.

  1. Why do we have separate XMLand SVG files?

That is because we use an SVG renderer that understands SVG, whereas both I and the Java code I have written only understand XML. And I doubt if the twain will ever meet.

  1. Where do Tiles.xml and the SVG files come from?

Ultimately everything comes from a tile database named TileDesigner.18t created by Marco Rocci's TileDesigner program (see http://www.rails18xx.it/software.html). In the mean time I have added a lot of tiles to Marco's original tile set. From that database I export both the SVG tiles and an XML descriptive file called TileDesigner.xml.

The SVG export is somewhat buggy. Originally Brett fixed that by a procedure that I don't have the details of. I have recently taken over and I'm now using a procedure described in the comments of a Perl script named CombineTiles.pl. That script builds the Rails SVG file set by combining parts from three sets of SVG files: - tiles with ID > 0 (layable tiles, the ID is printed on the tile). - tiles with ID <=0 (preprinted tiles, no ID on the tile; this is a separate export from TileDesigner) - special tiles that I have modified manually with Inkscape (such as the red off-board tiles -901 throught -903, which TileDesigner cannot create with "arrows". So for these tiles the XML does not exactly correspond with the SVG!).

The XML export (TileDesigner.xml) is converted by another Java program/class named rails.util.ConvertTiles into the overall Tiles.xml that I mentioned before. I'm doing this conversion because I think that the latter format is better suitable for use in Rails.

  1. Why is this procedure so complex?

Well, we're doing the best we can with the limited knowledge and imperfect tools that we have.

BTW#1: Is there any routine to display all of the SVG files?

No. Only TileDesigner has everything.

Excerpt 002 - Tile identifiers

source Re: [Rails-devel] Tiles and Their Identifiers From: Erik - 2011-02-16 20:17

To create tile images and XML description, we use TileDesigner from Marco Rocci (see http://www.rails18xx.it/software.html ). This program has not been maintained for many years, and we don't have the source code, but this program is all we have to create tiles, so we have to live with its limitations and bugs. One limitation is that identifiers must be numeric.

The program comes with a tile database, containing 442 tiles, mostly tiles with IDs as defined in Blackwater Station's Tile Encyclopedia. It also contains the preprinted 1830 hexes as tiles with negative numbers. We have continued this approach when new tiles were added for other games, initially without much of a system, but more recently we have started to use a more systematic approach using large negative numbers for preprinted tiles. The total tile set now adds up to 559 tiles.

For the real (positive) tiles we follow the physical tile IDs where possible, adding 1000/2000/3000 in case of duplicate IDs (as did the original Tile Encyclopedia). The occasional alphanumeric ID has to be replaced by some number; there isn't yet a rule for that.

Since some time it is possible to display a different ("external") number than the (internal) tile ID to identify tiles textually in all Rails windows, and from the next release this external ID can be alphanumeric (see 1830 Coalfields, in progress). However, the tile images still display internal IDs only. I suppose the SVG tiles could be tweaked manually to show alphanumeric IDs well, but I haven't looked into that. (BTW the internal IDs are omitted on the preprinted tiles, TileDesigner has a seperate 'export' option for that).

Some specific points raised:

Regarding the towns and cities, this I'm sure is purely aesthetic, dits and city circles are rarely placed in the very centre of the tile on maps, they are usually off to one side, the rotation of the tile on the map helps to match the original board aesthetic.

The off-centre city (-10) and village (-1) tiles come from the original TileDesigner database, and in most cases we have used these in creating maps without particular attention to correct placement. The simplest solution would be to rotate such tiles,and/ or to replace these by the centered city (-3008) and village (-3009) tiles, that have been created for 18EU in a much later stage.

OK So how do you deal with games which have letters like AL? As the IDs are currently required to be numbers.

For such cases it was proposed to use six-digit negative numbers. But that proposal came after 18AL and 18EU had been done, and IIRC no decision has yet been taken.

Tile manipulation

I've found that making tiles in a text editor is actually easier for me! I just start with another tile that is similar and change what is needed.

-Tim

Such misalignment points to a change in the SVG image size. Due to a bug in TileDesigner, all tiles have a white border at the bottom side, which must be retained for correct display. Perhaps you have reduced or removed that white border.

I have exported the whole set myself again, using my normal procedure. Tiles -80001 and -80002 have been hand-edited (yes, with a text editor ;-)) to add the extra dots to the “medium cities”, based on your parameters. These tiles also been added to the “handmade” set, so new TD exports will not overwrite.

The whole 1880 stuff has now been checked into the repository, so you can find it all there.

One more comment: in TileDesigner, please use the “tlMapxxx” tile types for preprinted tiles (negative numbers) only. It doesn’t make a practical difference, but I would prefer to keep using the tile types as originally intended. I have changed the new layable tiles in TileDesigner to mention just the colours.

(I only found this because class ConvertTilesXML choked on “tlMapUpgradableToGray”. I have fixed that bug as well).

Erik.

Tricks in display manipulations for tiles

What I usually do in such cases is drawing two tiles in TileDesigner: one with the picture that must be displayed, and one with all allowed track connections. The Map.xml code then looks like (for example the Altoona tile from 1830 Coalfields):

    <Hex name="H12" tile="-30003" pic="-30002" city="Altoona"/>

Where pic= indicates what is displayed, and tile= what is used internally for routing and other purposes.

You will meet the file Tiles.xml in different places. Despite of the same name, these are different files. Lets call them Tiles.xml(1) and Tiles.xml(2). There is only one Tiles.xml(1) and as many different Tiles.xml(2) as implemented 18xx-variants.

Tiles.xml(1) can be found it in the folder rails-1.4.1.jar:\tiles
This file contains the definition of all the tiles in a format suitable for Rails. It's function is to serve as database to form the Tiles.xml(2) specific to the single 18xx-variants.

Tiles.xml(1) is a product at the end of this chain:

The program TileDesigner exports the file TileDesigner.xml
The file TileDesigner.xml is converted by the Java program/class named rails.util.ConvertTiles to Tiles.xml(1) 

Tiles.xml(2) can be found in every folder of the single 18xx-variants rails-1.4.1.jar:\data\18??
This file contains only the subset of Tiles.xml(1) needed for the specific 18xx-variant.

Tiles.xml(2) is a product of this chain:

The Java program/class rails.util.MakeGameTileSets
    reads out the specific file TileSet.xml to see which Tile# are used in the specific 18xx-variant (+ some checking with Map.xml)
    extracts from Tiles.xml(1) just the definitions needed for this 18xx-variant
    stores the result as Tiles.xml(2) 

Comparison Tiles.xml vs.TileSet.xml

It may be helpful to see a short comparison of the content in Tiles.xml vs.TileSet.xml before we dig deeper into the structure of Tiles.xml.