News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

[TUTORIAL] Creating an addon (II): how to create a DAT file

Started by vilvoh, September 09, 2009, 07:02:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

vilvoh

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:

  • pak64: 64x64 pixels tiles
  • pak128 : 128x128 pixels tiles
  • pak96: 96x96 pixels tiles

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.


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.


 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:


  • Image["view of the vehicle"]="name of the png image file"."row number from the png"."column number from the png". In this case "Image[SE]=little_blue_car.0.4":
  • SE = SouthEast view, it's one of the several views. It will be displayed when the vehicle is moving to the southeast.
  • little_blue_car = name of the file that contains the sprites without ".png" extension. You have to write this to determine which sprites from the PNG file are going to be read.
  • 0 = row zero from the png file. The row numbering always starts from zero, from top to bottom.
  • 4 = fourth columnfrom the png file. The row numbering always starts from zero, from left to right.

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.


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..

Escala Real...a blog about Simutrans in Spanish...

edson

Quote from: vilvoh on September 09, 2009, 07:02:59 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

vilvoh

Actually, It was translated a few lines before, but I forgot to remove those sentences in portuguesse. Thanks for the info, Edson.

Escala Real...a blog about Simutrans in Spanish...