News:

SimuTranslator
Make Simutrans speak your language.

How to add .dat files without driving me bonkers

Started by neroden, June 17, 2012, 10:06:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neroden

This is a suggested sticky.

How to add dat files without driving me bonkers

1. All dat files must end with a line of two or more dashes: --Simutrans doesn't care, but Simutranslator *does*.  This is in addition to the lines of dashes which are used as separators between multiple objects in the same file.

2. Object "name"s should not have spaces in them.  They can have dashes, underscores, and parentheses.  Underscores are preferred over dashes. name=Boeing_747_100(BOAC)

The spaces will be added in the translations.

3. City building objects have to follow a specific name format.
XXX_YYYY_LLzzzz
where XXX is COM, IND, or RES; YYYY is anything, including underscores; zzzz does not contain underscores or numerals; and LL is the 'level', which should be at least 01.  In pak128.Britain the format is stricter, and it will probably become stricter yet in the future as new features are added.  So ask before naming a city building.

4. Line endings.  If you're working with TortoiseSVN or subversion, before you commit any files:

First, find the configuration settings in TortoiseSVN, using these instructions:
http://www.mediawiki.org/wiki/Subversion/auto-props

Or find the configuration file from the command line for command-line subversion, which is at:
~/.subversion/config
or
/etc/subversion/config

In [miscellany] uncomment/add this line:enable-auto-props = yes

In the [auto-props] section, uncomment the default bits and also add:
*.dat = svn:eol-style=native

You only have to do this once.

5. Line endings again!  If you're working with git, before you add any files, set the core.autocrlf option appropriately for whichever system you're on:

Windows:
git config --global core.autocrlf true
Linux/UNIX/Mac:
git config --global core.autocrlf input

You only have to do this once.

6. You shouldn't need to touch the Makefile unless you add a new directory.  But if you add a new directory, please either update the Makefile or let me (or someone else who understands Makefiles) update it.

7. Finally, please check your spelling for typos, as mis-spelled names are confusing and hard to remember.  I have recently fixed a "clanlline-steamer.dat" (clan-line-steamer), a "Boeing_747_200_BritishCalendonian.dat", a "name=Cemetry" object, etc.

I think this is everything, though I or someone else may think of more things later.

The Hood

Thanks for this. I'm setting it sticky for easy reference for contributers.

jamespetts

May I ask - what is the reason that underscores are preferred over dashes? Dashes are what is predominately used in Pak128.Britain.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

The Hood

In going through the new railway vehicles I noticed a lot of files did not end in "---" - please can we ensure this as it's quite tedious for me to add them before putting into SVN (and I probably missed some too).

jamespetts

Ohh, I didn't realise that they had to have that at the end - apologies. May I ask - what function does this have?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

kierongreen

Quote from: jamespetts on August 30, 2012, 05:51:39 PM
May I ask - what function does this have?
See nerodens comment above:
Quote from: neroden on June 17, 2012, 10:06:08 PM
1. All dat files must end with a line of two or more dashes: --Simutrans doesn't care, but Simutranslator *does*.  This is in addition to the lines of dashes which are used as separators between multiple objects in the same file.
It will be something to do with an assumption the simutranslator code makes.

jamespetts

Ahh, interesting. I thought that this was only required between objects in the same file.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

The Hood

No, think of it as an end-of-file marker for simutranslator. Makeobj isn't bothered, which is why you probably haven't noticed...

jamespetts

Right. Will add it in future. Thank you for letting me know!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Drewthegreat87

Hello!

I've been reading about adding .dat files and the best I can seem to understand is that the program will have to be complied. I've been reading over this thread (http://forum.simutrans.com/index.php?topic=652.0) and I'm curious if this is how you add new items (trains, buildings etc) available on the sourceforge SVN (Examples: Zeppelin/ new Mk 1 carriages etc) to a pakset.

I would like to know if that's the process I need to follow to figure it out. Any help would be greatly appreciated!

jamespetts

What you need to do is (1) obtain the sources (the .dat and .png files); (2) compile them using Makeobj (make sure to use the correct version, depending on whether you are running Standard or Experimental); and (3) add the resulting .pak files to your pakset addons directory.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Drewthegreat87

Thanks James! That's exactly what I was looking for and I've gotten it to work! I greatly appreciate your help!

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

thunderkiller1996

I've been trying to follow the method of adding things to pak128.Britain as described above to add the new DC6B model, but when I try to load the thing in Simutrans it doesn't appear. Any ideas on what I'm doing wrong?
Here's what I punch into makeobj: makeobj pak128 DC6B.pak Douglas_DC6B_BritishEagleAirways.dat

When I do so, it says it's missing data in "Simutrans object file".

Milko

Hello

I believe that the problem is this: the files are made to be inserted directly into the pak, if you want to compile them externally, you must do one of two things: 1) create a folder images and put the pictures 2) modify the dat file by removing "./images/"

Giuseppe

thunderkiller1996

I tried compiling your DC-3 model instead, and yup I did make a new "images" folder when creating the pakfile, but then it began spitting out error after error. Might have something to do with the version of Simutrans I am using-I'm using the latest version of makeobj and Simutrans.

jamespetts

If you are using Makeobj for Simutrans-Standard, this is normal and you should not worry: those extra parameters are intended only for Simutrans-Experimental.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

thunderkiller1996

Managed to get the pakfiles into Simutrans, DC-3 mail version works, but passenger planes (i.e. DC-3, Viking) won't work; their vehicle marker in a depot will show up but they cannot be selectable and their graphics don't show up either. Must be something to do with Experimental features.

jamespetts

Quote from: thunderkiller1996 on February 08, 2015, 04:21:35 AM
Managed to get the pakfiles into Simutrans, DC-3 mail version works, but passenger planes (i.e. DC-3, Viking) won't work; their vehicle marker in a depot will show up but they cannot be selectable and their graphics don't show up either. Must be something to do with Experimental features.

Can you elaborate a little more about what exactly you are doing? When you say that they are not selectable, what exactly happens when you try?

If you are using Standard Makeobj and the Standard executable, the Experimental .dat lines will simply be ignored and will have no effect other than generating warnings.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

thunderkiller1996

#19
Quote from: jamespetts on February 08, 2015, 09:32:34 AM
Can you elaborate a little more about what exactly you are doing? When you say that they are not selectable, what exactly happens when you try?

If you are using Standard Makeobj and the Standard executable, the Experimental .dat lines will simply be ignored and will have no effect other than generating warnings.
The planes "appear" in the hangar menu-the Mail DC-3 appears OK, but there is no image or model for the DC-3 or DC-3A. When I hover my cursor over the DC-3 or DC-3A, no information comes up about the aircraft, and I cannot select the plane either.

(Ignore the info box at the bottom about a Viscount type)

EDIT 23:44 Sydney time, 8/2/15: I've tried it with the DC-6 too, that doesn't work either.

jamespetts

That looks like a problem with the graphics - are there any graphics related warnings in Makeobj? Have you amended the .dat files at all?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

thunderkiller1996

Well makeobj does yell at me about some graphics related stuff and whatnot but I thought it would have been something to do with the livery system.

And nope, I haven't edited the .dat files.

EDIT: Had a look at the dat files... Simutrans must be ignoring the graphics because of all the Experimental-related stuff.

The Hood

Experimental supports multiple liveries but standard does not. If an experimental dat has multiple liveries defined standard makeobj will not understand. E.g.

Experimental:

EmptyImage[N][0]=....

Standard

EmptyImage[N]=....

jamespetts

I don't think that the DC-6 has multiple liveries; I think that only the 707 and the DC-3 at present have multiple liveries.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

neroden

Has Simutranslator been updated in he last decade to handle pak files which aren't terminated with dashes or underscores?  Can someone check?

There's currently a LOT of pak128.britain (for extended) files which don't have the terminator.  Like, a lot.  I'm checking to see whether this is a mistake (in which case many, many objects won't be translatable) or whether Simutranslator has been updated to handle it.

prissi

Maybe you need to poat this in extended. For simutranslator, ask makie, he currently is hosting it.
https://forum.simutrans.com/index.php?action=profile;u=11734

makie

Dash to mark 'end of file'? -> no, is not necessary

RealAmerican1776

I don't know about you, but I'm someone who likes visuals so I finished another model for my future Pak256.Atlantica so I can give you an example of a .dat file.

Obj=building
Name=Brownstone-1880
copyright=RealAmerican1776
type=res
chance=50
Level=1
population_and_visitor_demand_capacity=100
employment_capacity=0
mail_demand=1
class_proportion[0]=100
class_proportion[1]=40
class_proportion[2]=50
class_proportion[3]=75
class_proportion[4]=50
intro_year=1880
retire_year=1910
needs_ground=1
NoConstruction=1
dims=1,1,4
BackImage[0][0][0][0][0][0]=Brownstone-1880.0.0
BackImage[0][0][0][0][0][1]=Brownstone-1880.0.1
BackImage[1][0][0][0][0][0]=Brownstone-1880.0.2
BackImage[1][0][0][0][0][1]=Brownstone-1880.1.0
BackImage[2][0][0][0][0][0]=Brownstone-1880.1.1
BackImage[2][0][0][0][0][1]=Brownstone-1880.1.2
BackImage[3][0][0][0][0][0]=Brownstone-1880.2.0
BackImage[3][0][0][0][0][1]=Brownstone-1880.2.1