The International Simutrans Forum

PakSets and Customization => Pak128.Britain => Topic started by: neroden on June 17, 2012, 10:06:08 PM

Title: How to add .dat files without driving me bonkers
Post by: neroden on June 17, 2012, 10:06:08 PM
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 (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.
Title: Re: How to add .dat files without driving me bonkers
Post by: The Hood on June 18, 2012, 07:07:56 AM
Thanks for this. I'm setting it sticky for easy reference for contributers.
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on June 22, 2012, 08:55:07 AM
May I ask - what is the reason that underscores are preferred over dashes? Dashes are what is predominately used in Pak128.Britain.
Title: Re: How to add .dat files without driving me bonkers
Post by: The Hood on August 30, 2012, 05:12:54 PM
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).
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on August 30, 2012, 05:51:39 PM
Ohh, I didn't realise that they had to have that at the end - apologies. May I ask - what function does this have?
Title: Re: How to add .dat files without driving me bonkers
Post by: kierongreen on August 30, 2012, 06:30:07 PM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on August 30, 2012, 07:48:54 PM
Ahh, interesting. I thought that this was only required between objects in the same file.
Title: Re: How to add .dat files without driving me bonkers
Post by: The Hood on August 30, 2012, 09:16:08 PM
No, think of it as an end-of-file marker for simutranslator. Makeobj isn't bothered, which is why you probably haven't noticed...
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on August 30, 2012, 09:38:21 PM
Right. Will add it in future. Thank you for letting me know!
Title: Re: How to add .dat files without driving me bonkers
Post by: Drewthegreat87 on August 27, 2013, 09:23:29 PM
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 (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!
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on August 27, 2013, 10:06:52 PM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: Drewthegreat87 on August 28, 2013, 02:16:50 AM
Thanks James! That's exactly what I was looking for and I've gotten it to work! I greatly appreciate your help!
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on August 28, 2013, 09:33:12 AM
Splendid!
Title: Re: How to add .dat files without driving me bonkers
Post by: thunderkiller1996 on February 06, 2015, 06:04:54 AM
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".
Title: Re: How to add .dat files without driving me bonkers
Post by: Milko on February 06, 2015, 08:26:33 AM
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
Title: Re: How to add .dat files without driving me bonkers
Post by: thunderkiller1996 on February 06, 2015, 08:37:53 AM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on February 06, 2015, 09:30:11 AM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: 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.
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on February 08, 2015, 09:32:34 AM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: thunderkiller1996 on February 08, 2015, 12:34:42 PM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on February 08, 2015, 12:50:15 PM
That looks like a problem with the graphics - are there any graphics related warnings in Makeobj? Have you amended the .dat files at all?
Title: Re: How to add .dat files without driving me bonkers
Post by: thunderkiller1996 on February 08, 2015, 01:33:59 PM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: The Hood on February 08, 2015, 02:54:40 PM
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]=....
Title: Re: How to add .dat files without driving me bonkers
Post by: jamespetts on February 08, 2015, 10:49:51 PM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: neroden on April 07, 2023, 11:31:40 PM
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.
Title: Re: How to add .dat files without driving me bonkers
Post by: prissi on June 04, 2023, 02:26:49 AM
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
Title: Re: How to add .dat files without driving me bonkers
Post by: makie on June 04, 2023, 05:29:42 AM
Dash to mark 'end of file'? -> no, is not necessary
Title: Re: How to add .dat files without driving me bonkers
Post by: RealAmerican1776 on June 05, 2023, 02:37:34 PM
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