[TUTORIAL] Creating an addon (I): Introduction
Author: IgorTekton
Translation: Vilvoh
Aspect: development
Level: average
Summary: Introduction to the process of creating an addon
Note: If you're going to use this content, please mention the author of the content or place a link to the original source where you get this content.
1. Introduction
This tutorial is the first part of a series of four that will show you how to create an addon on pak format. This one is short but it's focused on the stuff you need to start creating an addons.
2. Choosing the right tools
For creating an addon, you need at least three kinds of programs:
- Image Editor: it's necessary to make the png images of vehicles, tracks o any other object from the game. We recommend you to use GIMP, Paint.net, MS Paint, Photoshop or PaintShop Pro. The images must be saved in png format.
- Text editor: it will be necessary to create the dat files. A dat file is just a text file saved with dat file extension, that containts simple instructions to help Simutrans to recreate the object on the scenario from the images and the attributes. We recommend you to use Notepad, Notepad++, PSPad or Vim.
- Makeobj: this program will merge the png images with the attributes contained in the dat file, in order to create a file in pak format, that will be used by the game to represent the object. This time there's no alternative but don't worry, this program has been developed by the Simutrans developers.
3. A quick overview of the addon's creation process.
3.1. What does a pak file contain?
The pak file simply hosts the information from two different files:
- An file of images in PNG format: it's the visual representation that will be used by the game engine to represent the object inside the game.
- A text file in dat format: it's a small file that contains the attributes and instructions that define the object and its behaviour inside the game. Otherwise, how is Simutrans engine going to know who's who?
Above, you can see a screenshot that shows part of a dat file on the left side and the png file that contains several views of a highway.
3.2. The process, step by step
This is a brief summary of the process. Each step will be explained in deep with an independent tutorial.
- You must paint the different images of the object using the image editor. The images must be saved in PNG format.
- You must create and write the DAT file, using the png images as reference. You may need to include several extra attributes depending on the type of object you want to create.
- Now you have the PNG and DAT files, you need to merge them in a pak file using Makeobj