Traductions possibles :

Différences

Cette page vous donne les différences entre la révision choisie et la version actuelle de la page.

en:tutomakeobj3 [2014/11/18 16:09]
gauthier
en:tutomakeobj3 [2015/02/18 04:40] (version actuelle)
Ligne 1: Ligne 1:
-<WRAP important>These tutorials are now two years old and some additions to the game are not taken into account yet. Nothing essential is lacking, though you can find what is missing on German wiki until next update. In case of complaint, you can send all sort of insults to the adress given in "Contact" page ;)</WRAP> 
- 
====== III.Source files ====== ====== III.Source files ======
- +<WRAP info>Latest update of this tutorial: Simutrans 120.0.1</WRAP>
-<WRAP warning>This tutorial is made for latest versions of Simutrans, it may not be good for previous versions. Last updates : +
- +
- +
-    * Simutrans : 102.+
-    * Makeobj : 50 +
- +
- +
-</WRAP>+
===== 1.How does it work ? ===== ===== 1.How does it work ? =====
- 
A Simutrans'object is composed of (most of the time) pictures for display and datas for technical datas of the object. The datas are just written in a simple text file (.txt) but saved with the extension .dat. Easy to do it : when saving your file, replace the .txt extension by a .dat extension. To open your .dat files you have to adjust your computer to open these files with the text editor (notepad with windows). This an example with windows :\\   A Simutrans'object is composed of (most of the time) pictures for display and datas for technical datas of the object. The datas are just written in a simple text file (.txt) but saved with the extension .dat. Easy to do it : when saving your file, replace the .txt extension by a .dat extension. To open your .dat files you have to adjust your computer to open these files with the text editor (notepad with windows). This an example with windows :\\  
- 
{{  fr:tuto:dat:fichiersource01.png  }}Inside the text you can write parameters one after each other but you'd rather write them one below each other for a better aspect. You can put several objects in the .dat file if you separate them with dashes. {{  fr:tuto:dat:fichiersource01.png  }}Inside the text you can write parameters one after each other but you'd rather write them one below each other for a better aspect. You can put several objects in the .dat file if you separate them with dashes.
- 
for example : for example :
- 
<WRAP box>Parameters of the first object <WRAP box>Parameters of the first object
- 
- 
Parameters of the second object</WRAP> Parameters of the second object</WRAP>
- 
Pictures have other constraints depending on the pakset you create for. The picture must be saved as 24 bits .png (Photofiltre save in 24 bits by default), makeobj can only read .png and if it's a 32 bits .png (with a transparency layer) you'll have a graphical glitch. The dimensions of your pictures must be multiples of the pakset's size. If it's pak128, pictures will 1024%%*%%256 or 768%%*%%512 for example. If you create for pak64 you'll have pictures of 128%%*%%64 or 192%%*%%384 for example, etc ... If the size isn't right, makeobj will crash. Pictures have other constraints depending on the pakset you create for. The picture must be saved as 24 bits .png (Photofiltre save in 24 bits by default), makeobj can only read .png and if it's a 32 bits .png (with a transparency layer) you'll have a graphical glitch. The dimensions of your pictures must be multiples of the pakset's size. If it's pak128, pictures will 1024%%*%%256 or 768%%*%%512 for example. If you create for pak64 you'll have pictures of 128%%*%%64 or 192%%*%%384 for example, etc ... If the size isn't right, makeobj will crash.
- 
You have to know how the source pictures work. You have to know how the source pictures work.
- 
<WRAP important>The following things is ajusted for pak128, for other paksets you have to change the sizes.</WRAP> <WRAP important>The following things is ajusted for pak128, for other paksets you have to change the sizes.</WRAP>
- 
The picture is cut in 128%%*%%128 pixels squares (so the picture must have dimensions multiple of 128). This is an example of a source picture part (here is the source picture of the AMT) :{{  fr:tuto:dat:fichiersource02.png  }}<WRAP info>Of course don't draw red shpaes on the source picture, I did so to show you the squares.</WRAP> The picture is cut in 128%%*%%128 pixels squares (so the picture must have dimensions multiple of 128). This is an example of a source picture part (here is the source picture of the AMT) :{{  fr:tuto:dat:fichiersource02.png  }}<WRAP info>Of course don't draw red shpaes on the source picture, I did so to show you the squares.</WRAP>
- 
Then you'll have to define the squares in the .dat file. Coordinates are used, the first for lines and the second for columns. See here in the same picture : Then you'll have to define the squares in the .dat file. Coordinates are used, the first for lines and the second for columns. See here in the same picture :
- 
{{  fr:tuto:dat:fichiersource03.png  }}<WRAP tip>You'd rather paractice now with coordinates, mistakes occur frequently for a beginner.</WRAP> {{  fr:tuto:dat:fichiersource03.png  }}<WRAP tip>You'd rather paractice now with coordinates, mistakes occur frequently for a beginner.</WRAP>
- 
The .dat file parameters and the corresponding pictures can be different but can be also very repetitive if you often create the same type of objects, so I will give you graphical shapes and .dat shapes for you to make your files easier, objects will be described one by one. The .dat file parameters and the corresponding pictures can be different but can be also very repetitive if you often create the same type of objects, so I will give you graphical shapes and .dat shapes for you to make your files easier, objects will be described one by one.
- 
A picture is defined in a .dat file as this : A picture is defined in a .dat file as this :
- 
<WRAP  box>internal_id_of_the_picture=name_of_the_picture_witheout_the_extension.line.column <WRAP  box>internal_id_of_the_picture=name_of_the_picture_witheout_the_extension.line.column
- 
example : imageUp[3]=AMT.3.3 example : imageUp[3]=AMT.3.3
- 
the picture used for imageUp[3] is the square on the intersection of the fourth line and the fourth column of AMT.png.</WRAP> the picture used for imageUp[3] is the square on the intersection of the fourth line and the fourth column of AMT.png.</WRAP>
- 
<WRAP info>Graphical shapes given here are made for the standard pak128, there can be differences with the other pak128. These graphical shapes are made for .dat shapes given with, be careful if you modify the position of objects…</WRAP> <WRAP info>Graphical shapes given here are made for the standard pak128, there can be differences with the other pak128. These graphical shapes are made for .dat shapes given with, be careful if you modify the position of objects…</WRAP>
- 
<WRAP info>In .dat files, every parameter is written as here : <WRAP info>In .dat files, every parameter is written as here :
- 
<WRAP box>parameter=value</WRAP> <WRAP box>parameter=value</WRAP>
- 
Every number is integer. The text respects shift.</WRAP> Every number is integer. The text respects shift.</WRAP>
Ligne 81: Ligne 50:
===== 2.Offset ===== ===== 2.Offset =====
- 
The offset allows you to move the picture in some situations. This technic must be used only in necessary situations, it musn't be used instead of the moving directly the graphics on the picture. The offset allows you to move the picture in some situations. This technic must be used only in necessary situations, it musn't be used instead of the moving directly the graphics on the picture.
- 
How to use the offset : How to use the offset :
- 
<WRAP box>id_picture=name_picture.line.column,x,y</WRAP> <WRAP box>id_picture=name_picture.line.column,x,y</WRAP>
- 
x is the number of pixels to the right and y is the number of pixels to the bottom. x is the number of pixels to the right and y is the number of pixels to the bottom.
- 
In the example below, the picture is moved of 16 pixels to the top. In the example below, the picture is moved of 16 pixels to the top.
- 
<WRAP box>cursor=SNFOSstationsmodern.1.7,0,-16</WRAP> <WRAP box>cursor=SNFOSstationsmodern.1.7,0,-16</WRAP>
- 
<WRAP important>The icons and the [-] view of ways don't support offset.</WRAP> <WRAP important>The icons and the [-] view of ways don't support offset.</WRAP>
-===== 3.Using your notepad =====+===== 3.Angle of slopes =====
-==== 1.Windows ====+Since Simutrans 120, slopes can be of two different heights. Some paksets use full and half slopes, some other paksets use full and double slopes.
 +Pak128 use half slopes. In this pakset, most ways cannot be built on hard slopes, such as tracks and highways.
-Under windows, simple text editors such as notepad or notepad++ are used. You cannot use text processing programs like Word or Writer. It's accessible in the start menu%%\%%programs%%\%%accessories%%\%%notepad. The useful tools of notepad are the research tool and the replace tool that you find in the edition menu.+<WRAP info>In pak128, soft slopes are 16 pixels high and hard slopes are 32 pixels high.</WRAP>
 +===== 4.Icons (buttons) =====
-<WRAP tip>These tools are accessible via the keyboard shortcuts ctrl+f and ctrl+h</WRAP>+Objects which need icons have something like that on their graphical pattern:
 +{{  fr:tuto:dat:icon.png  }}
-Be careful using the tool “replace” if you use the icon “replace all”, it can modify some text parts which aren't supposed to be.+Images of icons must contain only the 16 by 16 pixels square at top left of this image, everything else must be removed, otherwise there would be display errors in game.
 +The elements around the icon itself are specific to pak128, they are used in its icons.
-Finally, to save a source file for Simutrans, replace the default extension ”.txt” by the extension ”.dat”.+===== 5.Cursors =====
-==== 2.Linux ====+On graphical patterns of objects needing a cursor, the tile used to place the cursor is higher than the bottom of the square which it is placed in. This is intended to compensate an offset downward applied by the game.
 +===== 6.Examples of source files =====
-Linux has many text editors. They often depend on the release, or on the installed desktop manager. The best thing to do is to see the documentation given with your text editor to know its keyboard shortcuts.+You will find example of source files for all kinds of objects in each pakset's repository.
 +[[http://svn.code.sf.net/p/simutrans/code/pak128/|Sources of pak128]]
-<WRAP tip>Some examples : Gedit, Kate, Leafpad…</WRAP>+===== 7.Using your notepad =====
 +==== 1.Windows ====
-<WRAP warning>I deal with text editors, not with text treatment softwares. OpenOffice writer isn't made for this use !</WRAP>+Under windows, simple text editors such as notepad or notepad++ are used. You cannot use text processing programs like Word or Writer. It's accessible in the start menu%%\%%programs%%\%%accessories%%\%%notepad. The useful tools of notepad are the research tool and the replace tool that you find in the edition menu.
 +<WRAP tip>These tools are accessible via the keyboard shortcuts ctrl+f and ctrl+h</WRAP>
-To save a source file for Simutrans, the process is the same as windows, you just have to use the extension ".dat" for the file.+Be careful using the tool “replace” if you use the icon “replace all”, it can modify some text parts which aren't supposed to be.
 +Finally, to save a source file for Simutrans, replace the default extension ”.txt” by the extension ”.dat”.
-<WRAP tip>Be careful, if you work on linux and windows, the wrap symbols aren't the same on the two OS. A file created on the one can be strangely displayed on the other one. You'd rather work on only one OS if you don't know the conversion commands.</WRAP>+==== 2.Linux ====
-===== 4.Objects =====+Linux has many text editors. They often depend on the release, or on the installed desktop manager. The best thing to do is to see the documentation given with your text editor to know its keyboard shortcuts.
 +<WRAP tip>Some examples : Gedit, Kate, Leafpad…</WRAP>
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutovehicle|vehicles]]+<WRAP warning>I deal with text editors, not with text treatment softwares. OpenOffice writer isn't made for this use !</WRAP>
 +To save a source file for Simutrans, the process is the same as windows, you just have to use the extension ".dat" for the file.
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutocitycar|citycars]] +<WRAP tip>Be careful, if you work on linux and windows, the wrap symbols aren't the same on the two OS. A file created on the one can be strangely displayed on the other one. You'd rather work on only one OS if you don't know the conversion commands.</WRAP>
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutopedestrian|pedestrians]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutoway|ways]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutowayobject|way_objects]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutobridge|bridges]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutotunnel|tunnels]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutosignal|signals]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutostation|stations]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutostationextension|station extensions]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutodepot|depots]] +
- +
- +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutobuilding|citybuildings, monuments, curiosities,  etc ...]] +
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutoindustry|industries]]+===== 8.Objects =====
 +[[en:tutovehicle|vehicles]]
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutogood|goods]]+[[en:tutocitycar|citycars]]
 +[[en:tutopedestrian|pedestrians]]
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutocrossing|crossings (level crossings, etc ...)]]+[[en:tutoway|ways]]
 +[[en:tutowayobject|way_objects]]
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutotree|trees]]+[[en:tutobridge|bridges]]
 +[[en:tutotunnel|tunnels]]
-[[http://www.simutrans-france.fr.nf/doku.php?id=en:tutosmoke2|smokes]]+[[en:tutosignal|signals]]
-===== 5.Annex pages =====+[[en:tutostation|stations]]
 +[[en:tutostationextension|station extensions]]
-graphics of buildings : [[:en:tutobuilding2|Buildings'graphics]]+[[en:tutodepot|depots]]
 +[[en:tutobuilding|citybuildings, monuments, curiosities,  etc ...]]
-waytype : [[:en:tutowaytype|Possible waytypes]]+[[en:tutoindustry|industries]]
 +[[en:tutogood|goods]]
-engine_type : [[:en:tutoenginetype|Energy of vehicles]]+[[en:tutocrossing|crossings (level crossings, etc ...)]]
 +[[en:tutotree|trees]]
-freight / goods : [[:en:tutogoods|Goods of pak128]]+[[en:tutosmoke2|smokes]]
 +===== 9.Related pages =====
-smoke : [[:en:tutosmoke|Smokes of pak128]]+graphics of buildings : [[en:tutobuilding2|Buildings'graphics]]
 +waytype : [[en:tutowaytype|Possible waytypes]]
-sound : [[:en:tutosound|Souds of pak128]]+engine_type : [[en:tutoenginetype|Energy of vehicles]]
 +freight / goods : [[en:tutogoods|Goods of pak128]]
-system_type : [[:en:tutosystemtype|Possible special parameters]]+smoke : [[en:tutosmoke|Smokes of pak128]]
 +sound : [[en:tutosound|Souds of pak128]]
-climates : [[:en:tutoclimates|Climates in Simutrans]]+system_type : [[en:tutosystemtype|Possible special parameters]]
 +climates : [[en:tutoclimates|Climates in Simutrans]]
-<WRAP box>next tutorial : [[:en:tutomakeobj|Chapter IV : compile with makeobj]].</WRAP>+<WRAP box>next tutorial : [[en:tutomakeobj|Chapter IV : compile with makeobj]].</WRAP>