News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Pakfile-like format for heightmaps

Started by IgorEliezer, May 08, 2011, 03:03:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

IgorEliezer

O HAI,

This extension request isn't new. It was posted probably by some people some ages ago, but this time I'm posting it more elaborated.

Currently the heightmaps are provided as PPM files. To create a PPM, all you need is a BMP file, follow some instructions to convert it to PPM and it's done, but no additional info is added in order to make it an actual map with city locations, rivers and so on; it's just the topography.

Since the pakfiles are made of an image + dat file, why not PPM as well? BMP + DAT = PPM.

Here's a dummy DAT for PPMs as sample:

obj=map
name="map name"
copyright="autor name"
pakset=pak64,pak128
allownewfactories=0
allownewattractions=1
city[0]="name",x-coord,y-coord,category,population,allowgrowth
river[0]=x-coord-start,y-coord-start,x-coord-way,y-coord-way,x-coord-way,y-coord-way
forest[0]=x-coord,y-coord,x-coord,y-coord,x-coord,y-coord,x-coord,y-coord
attraction[0]=name-as-in-pakset,x-coord,y-coord
factory[0]=name-as-in-pakset,x-coord,y-coord


Let me explain the stuff in there:

obj=map
Object type. Self-explanatory. Probably it's not needed since the heightmaps are always in PPM file format.

name="map name"
This is the map name that will be displayed in "Load" dialog.

copyright=autor name
Author name.

pakset=pak64,pak128
This lists the paksets that Simutrans will look in to find the data that will be used in the pakset-dependent parameters bellow. If this map is loaded with another pakset not specified in the list, all pakset-dependent parameters will be ignored.

allownewfactories=0
This turns on or off whether new factories should be built during the game. Possible values: 0 or 1.

allownewattractions=1
This turns on or off whether new attractions should be built during the game. Possible values: 0 or 1.

city[0]="name",x-coord,y-coord,category,population,allowgrowth
This sets the city foundation on map creation. Not a pakset-dependent parameter. Entrances:

"name": city name. If ignored/left in blank, Simutrans will use the citylist.
x-coord and y-coord: x and y coordinates where the city will be founded.
category: it could be useful if the cities have categories. Possible values: capital, town, village.
population: urban population of the city. Possible values: 0 - 99999.
allowgrowth: this sets the city allow growth on or off on map creation. The "city allow growth" can still be changed during the game. Possible values: 0 or 1.

Example:
city[0]="Renby",324,289,capital,5909,1
city[1]="Greenfield",564,856,town,2345,1
city[2]="New Well",724,209,village,456,0


river[0]=x-coord-start,y-coord-start,x-coord-way,y-coord-way,x-coord-way,y-coord-way
This sets the river on map creation. Not a pakset-dependent parameter. Entrances:

x-coord-start and y-coord-start: x and y coordinates of the spring, where the rive will start on the map.
x-coord-way and y-coord-way: x and y coordinates of pathway of the river. If the distance between two points is greater than 8 tiles, the Simutrans will create a river with curves as usual. After the last given point, Simutrans will try to find the nearest sea border or river tile to connect the river.

Example:
river[0]=20,15,26,26,10,12,15,43,45,67,90,111,134,145,167,170
river[1]=67,56,12,34,56,45,34,40,23,34


forest[0]=x-coord,y-coord,x-coord,y-coord,x-coord,y-coord,x-coord,y-coord
This sets the forest on map creation. Not a pakset-dependent parameter. Entrances:

x-coord and y-coord: x and y coordinates of forest border. In this case, I'm considering it's possible to create polygonal forests; if impossible, just two points are needed to create an elliptical forest, as usual.

Example:
Forest[0]=45,67,56,59,35,47,40,62

attraction[0]=name-as-in-pakset,x-coord,y-coord
This sets the attraction on map creation. It's a pakset-dependent parameter. Entrances:

name-as-in-pakset: the author must use the name of attraction as given in pakset. If Simutrans can't find the the attraction in the pakset, the attraction will not be inserted in the map.
x-coord and y-coord: x and y coordinates where the attraction will be inserted in the map.

Example:
attraction[0]=10_WOHN,124,878
attraction[1]=Feste,567,780


factory[0]=name-as-in-pakset,x-coord,y-coord
This sets the factory on map creation. It's a pakset-dependent parameter. Works like an attraction.

Example:
factory[0]=Autohaus,345,678
factory[1]=CHEMIST,766,456


Well, that's all.

Combuijs

I would love such an extension.

Some remarks though: PPM is an official format: Portable Pixel Map. So you can't do it in a PPM file.

What you can do is provide a *.ppm file for the heightmap and a separate *.dat file for additional information. This *.dat file could be pak-dependant, e.g. for each pak a different *.dat file (and maybe one general dat file with pak-independant data such as city info). I would love to give this a place on the Simutrans website (and take care for content too!)
Bob Marley: No woman, no cry

Programmer: No user, no bugs



VS

Theoretically, PNG could be abused for this effect. It is really flexible inside, and the "compiler" could just copy the png and save the dat file inside as another chunk. It would tie Simutrans to libpng though... which shouldn't matter much, as it is needed for makeobj anyway.

(For PPM specs: http://netpbm.sourceforge.net/doc/ppm.html )

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Ashley

Isn't what you're describing just the Simutrans savegame format? :?
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

ӔO

Quote from: Timothy on May 08, 2011, 10:03:07 PM
Isn't what you're describing just the Simutrans savegame format? :?
except savegames are pakset dependent. I doubt you could open a pak96comic save in pak128
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

Dwachs

Imho building pak files for this purpose is overkill. Simple tab-files should do the trick.
Parsley, sage, rosemary, and maggikraut.

prissi

Simutrans can read tab files, and the maps can be save as (which are quite small, RLE compressed). Just somebody is needed to add a routine that tries to open a tab-file with same name as the map, and if found just call a parser for such files. Most of the routines are there, they just need to be parse and called.