The International Simutrans Forum

Simutrans Extended => Simutrans-Extended paksets => Topic started by: Ves on February 02, 2016, 11:45:20 PM

Title: Dat file reference for: Buildings and Stops
Post by: Ves on February 02, 2016, 11:45:20 PM
Note: This guide applies to Simutrans-Extended version 12.x and above only.

Short comments on buildings:

Visitors, residents and workers
There is a new system to divide passengers into "commuting" passengers and "visiting" passengers which will travel by different rules set in simuconf.tab. If the resident/visiting- or commuting parameters are not set in buildings datfile, the values will be calculated based on the "level=" parameter and constants specified in simuconf.tab. The initial mechanism of a buildings job slots are the following:
Also, a buildings willingnes to accept visitors and commuters will (as of 3/1-2016 proposed to in this thread Potential feature discusion: economic integration (http://forum.simutrans.com/index.php?topic=15095.0)) depend on each other like the following:
Signal boxes
As the new signals in simutrans require signal boxes to work as inteded, the signal boxes are coded as buildings with the "type=signalbox". To read more about how they work, read the Dat file reference for: Signals and Signalboxes (http://forum.simutrans.com/index.php?topic=14848.0)

From version 11.x and earlier:

Airport control towers
In Simutrans-Extended, airports must have control towers to work, unless allow_airports_without_control_towers = 1 is set in simuconf.tab. Airport control towers are station extension buildings with a special flag set in their .dat files.

Traction specific depots
It is possible to make the depots only build a certain type of vehicles based on their traction type. For example it is possible to code a depot to only allow building steam engines and another depot maybe only may build diesel engines. Maintaining a fleet of both steam- and diesel engines will then require the player to build, maintain and organize different types of depots.

---

Notes to the dat parameters below:
All buildings can use all parameters, if not specified otherwise.
{E} = Simutrans Experiemental parameter
{M} = A modified parameter from Simutrans Standard
{S} (or nothing specified) = Original Simutrans Standard parameter and can be further investigated here: Create Standard DAT files (http://simutrans-germany.com/wiki/wiki/en_dat_Files?structure=en_Devel_Index&page_ref_id=464).

.dat parameters for buildings:

obj=building
Name=
copyright=
intro_year=
intro_month=
retire_year=
retire_month=


level:{M} The "level" setting has a number of functions that many of them also can be overridden by other parameters and are dependent on which kind of building this is. It is mostly used together with multipliers specified either in simuconf.tab or hardcoded in Simutrans:
level=

population_and_visitor_demand_capacity:{E} If this building is "type=res", then this will specify how many inhabitans that this building has. For any other "type=", it will specify how many visitors that this building may attract, eg a museum attracting audience, a school attracting students, a store attracting costumers, a station building attracting architecture interrested people etc. Default if not specified: set in simuconf.tab based on "level=" value.
population_and_visitor_demand_capacity=

employment_capacity:{E} Specify how many "workers" (ingame job slots) this building demands for a fixed amount of time (set in Simuconf.tab). This will generate "commuting passengers" that have other travel rules than "visiting" passengers, also specified in the Simuconf.tab.
Although this is not a fully incorporated feature yet (as of 30/1-2016) the "employment_capacity=" of a building also may interfere with how many visitors the building accepts (eg a museum is closed for visitors when the staff is missing). If set to 0, there will be considered that no staff is needed (eg a monument or a statue) and then no penalties for visiting passengers. Default if not specified: set in simuconf.tab based on "level=" value.
employment_capacity=

mail_demand:{S} How much mail this building will demand every month. Default if not specified: set in simuconf.tab based on "level=" value.
mail_demand=

noconstruction:{S} No excavation pit graphics showed when under construction.
noconstruction=1

noinfo:{S} This building will not have an info window.
noinfo=1


type:{M} What kind of building this is. Dependent of what type it is, different parameters are possible or needed, eg "type=signalbox" requires additional parameters to work correctly.


City buildings:
type=resResidential building, peoples home
type=comCommercial building, where people work
type=indIndustrial building, also where people work
type=towCity townhall
type=monMonuments, like a statue people wants to visit
type=curCuriosities, buildings like schools
Player buildings:
type=stopCombined with "waytype=" it will become a stop a vehicle can use.
type=harbourWill make this into a harbour to place on the shore
type=dockSimilar to harbour, but to be placed on a flat shore
type=extensionThis will become a stationextension
type=depotVehicle depot, combined with "waytype="
type=hqYour company headquarter
type=signalboxSignalbox, to be used with the new signalling system. Read more about that here: Dat file reference for: Signals and Signalboxes (http://forum.simutrans.com/index.php?topic=14848.0)




Dat-file parameters only for City Buildings:

climates:{S} A commaseparated list of climates that this building can be built in. Possible climates: desert, tropic, mediterran, temperate, tundra, rocky and arctic. Default if not specified: All climates.
climates= (Example: climates=desert,tundra,tropic climates=arctic

clusters:{S} (only "type=res", "type=com" and "type=ind") A comma separated list of clusters that this building belongs to. When to decide which building to build, the four orthogonally adjacent tiles are checked.  A building which matches any one of the clusters for any of the buildings on any of those 4 adjacent tiles will get a bonus to its chance of being built. It is recommended only to use this parameter on attached buildings and row houses. Default if not specified: Belonging to no cluster group.
clusters= (Example: clusters=1 clusters=3,5)

build_time:{S} (only "type=mon", "type=cur" and "type=tow") Defines how many inhabitants a city has to have for this building to be built. If set to zero, it will be built on the countryside.
build_time=

chance:{S} (only "type=mon" and "type=cur") The chance that this building will be built when the number of inhabitants are reached.
chance=




Dat-file parameters only for Player Buildings:

Cost and maintenance:{E} Specified in 1/100 of ingame Simutrans Credits of the building cost and the monthly maintenance. Default if not specified: set in simuconf.tab based on "level=" value.
cost=
maintenance=

allow_underground:{E} Whether this building may be built underground, overground or both. 0 means that it can be built only overground. 1 means that it can be built only underground. 2 means that it can be built either underground or overground. Default: 2
allow_underground=

enables_pax
enables_post
enables_ware:
{S} (only "type=stop", "type=harbour", "type=dock" and "type=extension") With these three parameters one can decide wether this stop or extension can accept either passengers, post or good or a combination of them.
enables_pax=1
enables_post=1
enables_ware=1


waytype:{S} (only "type=stop", "type=depot" and "type=extension") Specifies which waytype this building should be assosiated with. "type=stop" and "type=depot" wil only be buildable ON the waytile, while "type=extension" will be visible on the menu for that waytype.
waytype=road
waytype=track
waytype=tram_track
waytype=monorail_track
waytype=maglev_track
waytype=water
waytype=air
waytype=power


capacity:{E} If "type=signalbox": The maximum number of signals that can be connected to this signalbox at any given time
If "type=stop", "type=harbour", "type=dock" or "type=extension": The maximum capacity of good or passengers this building can size. Default if not specified: set in simuconf.tab based on "level=" value.
capacity=

signal_groups:{E} (only "type=signalbox") A comma separated list that specify which signal group this signalbox belongs to (Read more about that here: Dat file reference for: Signals and Signalboxes (http://forum.simutrans.com/index.php?topic=14848.0)).
signal_groups= (Example: signal_groups=16,24)

radius:{E} (only "type=signalbox") The maximum distance in meters from this signalbox that any signal connected to it can be placed
radius=

hq_level:{S} (only "type=hq") This determines in which order the head quarters are being built when pressing "upgrade head quarter" in Simutrans. The smallest head quarter that is first built by the player should have "hq_level=0", the second version, which usually simulate a bigger head quarter, should have "hq_level=1", the third "hq_level=2" and so on. As head quarters should be buildable from the beginning of the game, it is wise to combine "hq_level=0" with a very early "intro_year=". NOTE: This is not to be confused with the functions of parameter "level="!.
hq_level=

traction_type[X]:{E} (only "type=depot") (Where X is a number in sequence, starting from 0, and being no higher than 255). A list of the traction types that can be built in this depot. Default: - all traction types can be built. Note that unpowered vehicles can be built in any depot. Possible traction types: bio, sail, steam, diesel, petrol, turbine, electric, hydrogene, fuel_cell and battery.
Example:
traction_type[0]=steam
traction_type[1]=sail


is_control_tower:{E} (only "type=extension") Whether this building is an airport control tower. If the setting "allow_airports_without_control_towers" is disabled in simuconf.tab, building this building connected to an airport will allow aircrafts to use the airport.
is_control_tower=1




Graphic representation for all buildings: How to code Backimages (http://simutrans-germany.com/wiki/wiki/en_BackImage)

needs_ground:{S} Wether the Simutrans painting engine needs to paint the ground underneath the building. If building graphics covers the entire tile (or tiles), this parameter is not needed.
needs_ground=1

animation_time:{S} If this building contains animations, this parameter, specified in miliseconds, tells how often to shift frames.
animation_time=

seasons:{S} Number of season graphics this building has defined with a maximum of five: spring, summer, autumn, winter and snow
seasons=

dims:{S} A comma separated list of three values (represented by A, B and C below) being number of tiles in east-west direction, number of tiles in north-south direction and number of rotations this building has. Read more about this here: Specify Dims and Backimage (http://simutrans-germany.com/wiki/wiki/en_BackImage#Dims)
dims=A,B,C (example: dims=1,2,4 dims=1,1,16)

Icon and cursor:{S} (Only "Player Buildings") Defines the icon and cursor using the same syntax as the main graphics. Note the ">" which makes the icon not zoom in and out when zooming ingame.
icon=>
cursor=

Graphical representation:{S} This is the same as in standard and the values and number of entries is dependent on the values given in "dims=". Read more about this here: Specify Dims and Backimage (http://simutrans-germany.com/wiki/wiki/en_BackImage).
In general, one can look at the values in brackets [ ] as a six legged coordinate system (12 legged when also counting the use of frontimage) where each entry points to one specific graphic. This means that a 2x2 tile building with one rotation needs four entries, but a 2x2 tile building with four rotations would need 4x4=16 entries. If the building contains snow you would need 16x2=32 entries.
The order of the values are: [rotation][north-south][east-west][height][animation frame][season]=png-name.coordinate_vertical.coordinate_horisontal,pixeloffset_vertical,pixeloffset_horisontal

backimage[0][0][0][0][0][0]=name.0.0,0,0
frontimage[0][0][0][0][0][0]=name.0.0,0,0

A short explanation and reference for the [rotation] value:
Title: Re: Dat file reference for: Buildings and Stops
Post by: Milko on February 03, 2016, 08:25:03 AM
This guide in highlight  :)

Thanks Ves

Giuseppe
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on February 03, 2016, 09:53:49 AM
Splendid, thank you for all this work: it is most useful.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 27, 2017, 09:19:12 PM
It seems that level=X does not specify sensible defaults for signalboxes. While a level=5 station extension costs 375 credits to build, a level=5 signalbox costs 21 milions... (to build and maintain)
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 27, 2017, 10:26:33 PM
Are you able to upload a pakset in which this can be reproduced? The British pakset seems to have the cost of all the signalboxes specified.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 27, 2017, 11:02:32 PM
http://server.exp.simutrans.com/pak128.CS/signalbox/

Also I think that the default visitors and mail levels for signalbox should be 0, unless explicitly defined. So that level would set only prices and jobs.

Edit: i think that level for signalboxes should also set default capacity. Level 1 = 4 signals, and every higher level will double.

I like the simple setting of many parameter using levels, as I do not want to bother with exact balancing until the pakset has all necessary objects for game.
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 29, 2017, 01:22:33 PM
This appears to be a station extension building rather than a signalbox (the .pak file, at least), and has a modest cost: can you re-check that this is properly configured?
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 10:02:38 AM
I have probably made a mistake when uploading the files. I did lots of experiments... Files updated now.
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 30, 2017, 11:31:38 AM
I still seem to be getting the same issue. Is this supposed to be the "station control building"?
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 11:34:04 AM
Yes that's it. I added it also to the whole pakset: http://server.exp.simutrans.com/pak128.CS-Ex.zip
And this save game: http://server.exp.simutrans.com/debug-saves/trnava.sve
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 30, 2017, 12:12:47 PM
Is that the same saved game and pakset that you uploaded for the signal reassignment bug?
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 12:40:24 PM
yes
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 30, 2017, 02:31:34 PM
Splendid, thank you: I think that I have found and fixed this now. Would you be able to re-test?
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 06:03:06 PM
Quote from: jamespetts on April 30, 2017, 02:31:34 PM
Splendid, thank you: I think that I have found and fixed this now. Would you be able to re-test?
Now the building costs seem to be reasonable, but when I build a signalbox, I get the money, instead of spending them. And if I destroy the signal box I get 10 Milion refund.
Manually specified costs seem to work well, I paid what was specified, and got half of the costs as refund when the signalbox was destroyed. Although the tooltip says the price (if specified manually) is negative.
As I was testing that I have noticed that the price paid for building station extensions is not what is being stated in tooltip - I tested with pak birtain as well as pak.cs and it affects all extensions. The price charged is slightly higher, just watch the price tag appearing after you build the station.
(And sorry for putting this in to the dat reference, insted of a separate bug thread. I originally thought the the problem is at my end.)
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 30, 2017, 08:22:24 PM
I think that I have fixed these now - would you be able to re-test? As to the station extension buildings, the price shown is just the construction cost - to that must be added the cost of land.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 08:36:38 PM
A little bit better. Now I pay the specified cost, although the tooltip show negative cost if explicitly defined, and positive if implicitly defined by level
When destroying a signalbox, with explicitly defined costs, i get 50% refund. When destroying signalbox with implicit costs, I pay almost double the price of it.
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 30, 2017, 08:59:08 PM
I have fixed the issue with the tooltip.

As to the demolition costs, I use the same formula for signalboxes with implicitly defined prices as for other buildings, which use the formula of level multiplied by cst_multiply_remove_haus.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 09:54:25 PM
Quote from: jamespetts on April 30, 2017, 08:59:08 PM
I have fixed the issue with the tooltip.
This is OK

Quote
As to the demolition costs, I use the same formula for signalboxes with implicitly defined prices as for other buildings, which use the formula of level multiplied by cst_multiply_remove_haus.
Well although it is weird to pay more to bulldoze than to construct, but OK. What is weird is to get money for bulldozing a signalbox with explicitly defined price (50 % of construction cost).
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on April 30, 2017, 10:54:29 PM
I think that I have fixed the issue with demolishing signal boxes adding to revenue; would you be able to re-test?
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on April 30, 2017, 11:25:04 PM
I think now it is OK
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on May 01, 2017, 01:21:10 AM
Excellent, thank you.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Matthew on June 16, 2018, 11:24:56 AM
I am trying to make a station extension building, but I'm confused by the fact that there seem to be two different systems for images. This thread and the wiki use a system where all the images are in the same PNG file and there are numbers, e.g. "FrontImage[0][1][2][3]". The Blender script produces multiple PNG files with N/E/S/W and the tutorial for making vehicles uses a system with letters, e.g."EmptyImage[E]". For a station extension made in Blender, should I be using only numbers even though the images are in different PNG files? Any links to documentation for the system with letters would be helpful, please.
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on June 16, 2018, 11:30:47 AM
For a single tile building, you can use the new rendering system (making sure to have a normal and snow image); however, multi-tiled buildings will need to use the old rendering system, as Tilecutter cannot deal with transparent pixels. Multi-tiled buildings also have a number of extra complexities in how their images are constructed: the .dat files need to be constructed by Tilecutter for these buildings.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Matthew on June 16, 2018, 11:54:29 AM
Quote from: jamespetts on June 16, 2018, 11:30:47 AM
For a single tile building, you can use the new rendering system (making sure to have a normal and snow image);

Ah, snow images are compulsory. That explains why makeobj was throwing an error for "seasons=1".

I can see that there's a texture that has been used for station building snow in the past, as it's in one of the blends (https://github.com/jamespetts/Pak128.Britain-blends/blob/master/stations/wood-building-snow.blend). That's doable then.

Quotehowever, multi-tiled buildings will need to use the old rendering system, as Tilecutter cannot deal with transparent pixels. Multi-tiled buildings also have a number of extra complexities in how their images are constructed: the .dat files need to be constructed by Tilecutter for these buildings.

Then I will stay well clear of multi-tiled buildings for the time being. Thank you.
Title: Re: Dat file reference for: Buildings and Stops
Post by: jamespetts on June 16, 2018, 12:33:09 PM
Yes, the snow texture is fairly easy to set up; multi-tile buildings are rather harder (although definitely doable with a little practice - but it is probably easier to start with single tile buildings).
Title: Re: Dat file reference for: Buildings and Stops
Post by: Vladki on June 17, 2018, 07:50:39 PM
Quote from: Matthew on June 16, 2018, 11:24:56 AM
I am trying to make a station extension building, but I'm confused by the fact that there seem to be two different systems for images. This thread and the wiki use a system where all the images are in the same PNG file and there are numbers, e.g. "FrontImage[0][1][2][3]". The Blender script produces multiple PNG files with N/E/S/W and the tutorial for making vehicles uses a system with letters, e.g."EmptyImage[E]". For a station extension made in Blender, should I be using only numbers even though the images are in different PNG files? Any links to documentation for the system with letters would be helpful, please.
You can split images for one object into multiple PNG files, if you like. E.g. I often have one PNG with summer image (and all 4 rotations), and another PNG with snowy winter image (and the same 4 rotations). Just because I have the snow as a layer in gimp, and export once with this layer visible, and once with snow layer hidden.

EmptyImage/FreightImage are specific to vehicles. That allows you to have different images for empty vehicles and for vehicles loaded with different cargo (e.g. black coal, yellow/white sand, brownish iron ore, etc)
For platforms the Front/Back image is important to split picture into what is drawn behind the tracks and vehicles, and what is in front of them. For general buildings (houses, factories, stations), backimage is enough, but you can use Frontimage in clever ways - e.g. have a set of houses as a backimage, and then add some fences, gardens, and stuff as frontimage and combine them to get more houses. Or have some labels or colorful decorations to distinguish shops selling different goods (like those in pak128.Britain), or you can even use them for animations (smoke, or Simutrans Fired Chicken in pak128). Perhaps snow could be done as frontimage too.
Title: Re: Dat file reference for: Buildings and Stops
Post by: Matthew on June 17, 2018, 08:29:59 PM
Quote from: Vladki on June 17, 2018, 07:50:39 PM
You can split images for one object into multiple PNG files, if you like. E.g. I often have one PNG with summer image (and all 4 rotations), and another PNG with snowy winter image (and the same 4 rotations). Just because I have the snow as a layer in gimp, and export once with this layer visible, and once with snow layer hidden.

EmptyImage/FreightImage are specific to vehicles. That allows you to have different images for empty vehicles and for vehicles loaded with different cargo (e.g. black coal, yellow/white sand, brownish iron ore, etc)
For platforms the Front/Back image is important to split picture into what is drawn behind the tracks and vehicles, and what is in front of them. For general buildings (houses, factories, stations), backimage is enough, but you can use Frontimage in clever ways - e.g. have a set of houses as a backimage, and then add some fences, gardens, and stuff as frontimage and combine them to get more houses. Or have some labels or colorful decorations to distinguish shops selling different goods (like those in pak128.Britain), or you can even use them for animations (smoke, or Simutrans Fired Chicken in pak128). Perhaps snow could be done as frontimage too.

Thank you for the explanation, Vladki. The explanation of EmptyImage is particularly helpful: I hadn't realized it was empty vehicles rather than images. It's so obvious when someone explains it to you....  :-[
Title: Re: Dat file reference for: Buildings and Stops
Post by: Matthew on June 07, 2019, 08:12:28 PM
Anyone attempting to use this reference to make a through platform may benefit from ranran's helpful tutorial (https://forum.simutrans.com/index.php/topic,19008.msg180296.html#msg180296) on how to do:

Quote from: Ranran on June 06, 2019, 03:13:03 AM
<snip>
You have to have dims=1,1,16 to support 4 rotations.
1,1,4 is for the terminal stop.
1,1,8 is considered to be symmetrical to the track.
1,1,16 is considered to be asymmetric with respect to the track.

i.e.
Dims=1,1,16
BackImage[0][0][0][0][0][0]=upper left
BackImage[1][0][0][0][0][0]=upper right
BackImage[2][0][0][0][0][0]=upper left
BackImage[3][0][0][0][0][0]=upper right
BackImage[4][0][0][0][0][0]=upper left
BackImage[5][0][0][0][0][0]=upper right
BackImage[6][0][0][0][0][0]=upper left
BackImage[7][0][0][0][0][0]=upper right
FrontImage[8][0][0][0][0][0]=lower right
FrontImage[9][0][0][0][0][0]=lower left
FrontImage[10][0][0][0][0][0]=lower right
FrontImage[11][0][0][0][0][0]=lower left
FrontImage[12][0][0][0][0][0]=lower right
FrontImage[13][0][0][0][0][0]=lower left
FrontImage[14][0][0][0][0][0]=lower right
FrontImage[15][0][0][0][0][0]=lower left

lower/upper, left/right are the position where the water tower should stand

(Double-post because this clarifies information in OP)