The International Simutrans Forum

Community => Simutrans Help Center => Tutorials => Topic started by: vilvoh on September 09, 2009, 07:02:59 pm

Title: [TUTORIAL] Creating an addon (II): how to create a DAT file
Post by: vilvoh on September 09, 2009, 07:02:59 pm
Author: IgorTekton
Translation: Vilvoh
Aspect: development
Level: average
Summary: Introduction to the process of creating a dat file

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

First of all, you need to choose the pakset you are going to develop the addon for. There're at least three main paksets in Simutrans, and each one has its different tile size:

This is an important thing you must take into account, as the whole process depends on that.

Let's suppose you've chosen the 64x64 size. It means that each part of the image, from now on will talk about sprites, must have a size of 64x64 pixels and all sprites must be joined into a grid, organized in rows and columns, otherwise it will shuffle the images in the game. Each sprite must occupy a cell of the grid.

2. Painting the object

Let's suppose now that you want to make a vehicle. See the image below, where each sprite represents a different view of the vehicle.

(http://graphics.simutrans.com/albums/userpics/10026/setra.png)

If you can do this, you're already half way... ;)

:exclaim: Important: Notice that the image background is a light blue color (actually, in RGB color # E7FFFF) This color represents the transparency in Simutrans. Any area filled with that color won't be displayed by the Simutrans graphic engine.

3. Linking the sprites with the object views

The next step is to stablish the relation between is sprite and the different views of the object. Each sprite represents a different view so we must set that for example, the first sprite corresponds to the South view. That why the dat file exits.

A dat file is just a text file renamed with dat file extension

Sample:

little_blue_car.txt :arrow: replace the txt term by dat :arrow: little_blue_car.dat

In the example below, we can see the dat file that sets the relation between the views of the object and the previous sprites we painted.

Code: [Select]
  Image[S]=little_blue_car.0.0
  Image[N]=little_blue_car.0.1
  Image[E]=little_blue_car.0.2
  Image[W]=little_blue_car.0.3
  Image[SE]=little_blue_car.0.4
  Image[NW]=little_blue_car.0.5
  Image[NE]=little_blue_car.0.6
  Image[SW]=little_blue_car.0.7

4. Syntaxis of the lines related with sprites

What does "Image[SE]=little_blue_car.0.4" mean? let's see:


If you want to understand better how each sprite is numbered according to their position of row and column, see the following image of a 3x3 png file.

(http://graphics.simutrans.com/albums/userpics/10026/Grid_64x64.gif)

Making dat and png image correctly, we can create the pak file. So now you can use makeObj to pak all.

Obviously, this is a simple example. Each kind of object has its own independent attributes and special sprites (icons, cursors, extra views, full and empty images, winter views). There're many more details that we can't explain due to the lack of space, so we encourage you to investigate a little bit and make some tests.

You have more detailed info at wiki.simutrans.com..
Title: Re: [TUTORIAL] Creating an addon (II): how to create a DAT file
Post by: edson on September 09, 2009, 08:46:52 pm
This is an important thing you must take into account, as the whole process depends on that.
Primeiramente, precisamos definir em qual modo do Simutrans você está querendo inserir um add-on, ou seja, com que tipo de tile set você está querendo mexer. Existem, eu acho, 3 tile sets no Simutrans: 64x64pixels, 128x128pixels e o HD.

This was not translated ! Ctrl+C, Ctrl+V ? ;D
Title: Re: [TUTORIAL] Creating an addon (II): how to create a DAT file
Post by: vilvoh on September 09, 2009, 08:51:25 pm
Actually, It was translated a few lines before, but I forgot to remove those sentences in portuguesse. Thanks for the info, Edson.