The International Simutrans Forum

 

Author Topic: How to build a pak128 road addon.  (Read 275 times)

0 Members and 1 Guest are viewing this topic.

Offline Commander Noddy

  • *
  • Posts: 73
  • Languages: ZH, EN
How to build a pak128 road addon.
« on: June 23, 2020, 12:50:12 PM »
After 5 years, I am finally back to play simutrans. Other than playing it, I would like to make contribution to society.
I would like to make Hong Kong style road. Indeed, I don't know how to start with it. The tutorials are outdated, and I can't find suitable information about it.
So I have some questions.
1. What software should I download to start creating addons?
2. Can I have some sample so I can take reference?
Thanks:)

Offline Vladki

  • Devotee
  • *
  • Posts: 3370
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: How to build a pak128 road addon.
« Reply #1 on: June 23, 2020, 06:40:22 PM »
Dat file reference, and sample graphics for pak64 can be found here: https://simutrans-germany.com/wiki/wiki/en_WayDef
For real objects you can learn from - look at pak sets with open source: https://sourceforge.net/p/simutrans/code/HEAD/tree/
Templates and other useful stuff is also here: https://graphics.simutrans.com/index.php
Especially this one: https://graphics.simutrans.com/displayimage.php?album=9&pid=292

Software - to create the graphics, use whatever you like, or already know how to use. E.g. gimp for pixel art, or blender for rendered graphics, notepad to write the dat file.
The use makeobj (command line !) to combine dat + png to pak.

Offline Commander Noddy

  • *
  • Posts: 73
  • Languages: ZH, EN
Re: How to build a pak128 road addon.
« Reply #2 on: June 24, 2020, 06:39:46 AM »
Thanks for the info! Btw, is there any ways that can open the png and dat files inside the pak file?

Offline Vladki

  • Devotee
  • *
  • Posts: 3370
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: How to build a pak128 road addon.
« Reply #3 on: June 24, 2020, 02:14:42 PM »
No. It is so on purpose to protect paks that are not open-source.

Offline Commander Noddy

  • *
  • Posts: 73
  • Languages: ZH, EN
Re: How to build a pak128 road addon.
« Reply #4 on: June 24, 2020, 03:01:45 PM »
I have drawn a testing road with png file. What step should I do next? I have tried the read the steps of SNFOs but I dont understand.

Offline Ves

  • Devotee
  • *
  • Posts: 1801
  • Languages: EN, SV, DK
Re: How to build a pak128 road addon.
« Reply #5 on: June 24, 2020, 05:33:33 PM »
You also need the .dat file, which will hold all the information about the object, the road in this case. Go to the sources Vladki linked to and find a road. Locate the corresponding .dat file to the specific road, and open it. It will hold a bunch of parameters, and in general, you will need all those parameters in your own datfile, but the information should be switched out to match the road you are creating. Most important here are the image definitions, where you need to specify the name of the png you have created.
If you look into the various datfiles in the sources Vladki linked to, you will find that they all link to different png's (although the filename will be specified without ".png" in the dat file).

So the task you have to do is to create a new datfile (just create a new textfile, and rename the ending to ".dat" instead of ".txt"), copy an entire road object from an existing datfile in the sources linked into your new file, give it a new name and adjust all the parameters, and lastly, replace the existing filenames in the dat file with the filename to your png.

If the directions of the road in your png matches the directions in the png to which the original datfile refers to, you dont have to switch the image positions around, otherwise there are a few methods to do so.

After that you need to compile it using the makeobj.exe. If you run on Windows, an easy way to use the makeobj is to create a new textfile, name it "compile.bat" (pay attention to the ".bat" ending instead of .txt!), rightclick on it and press edit, copy the following line into the now open text editor:

Code: [Select]
makeobj pak
When done, you double click the compile.bat file, and it will in turn run the makeobj.exe, and that will hopefully pak your road!
Note that all files need to be in the same folder for this to work.

If you end up with a pakfile with more than 1kb, it should succesfully have packed the pakfile!

Offline Vladki

  • Devotee
  • *
  • Posts: 3370
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: How to build a pak128 road addon.
« Reply #6 on: June 24, 2020, 07:54:24 PM »
It should be "makeobj pak128"