Dev Tutorial Making Splines

iomex

UKDT
Dec 10, 2015
1,344
Creating splines is quite a simple process once you understand the basic logic behind them. Essentially, they are made up of a series of ‘from’ and ‘to’ co-ordinates.

In this guide, I’ll show you how to create a basic spline. From this, you will have the knowledge to create any spline.

Structure of a spline file
  • Height Profiles
    This lets OMSI know where the surfaces of the spline are, so that cambers can be properly applied. This affects how the spline is cambered.

  • Textures
    You list each texture in use in the spline here

  • Graphical Lanes
    This is the meat of the spline file, determining each face of the spline (i.e. what you actually see)

  • Paths
    AI paths are programmed into the spline file.

So, let’s make a simple pavement spline. It will be 3 metres in width, and will be 15cm in height, with a ped spline exactly in the middle, with kerb faces on both sides.

Open your Splines folder, and create the folder your spline will be located in. Create a subfolder called ‘texture’ (case sensitive), and put two textures inside (You can use any textures you wish for this, it isn’t important).

Then, create a new text document. Rename it to ‘Pavement.sli’ (you may need to change your settings to show file extensions).

Open this file in Windows Notepad (although we recommend getting Notepad++).

Note: In this guide, X refers to left-right, and Z to up-down.

Note: Trailing spaces (spaces at the end of a line), will break a spline. Make sure that you press enter to start a new line after the final character, never leave a space at the end of a line. Notepad++ can remove all trailing spaces for you by selecting Edit>Blank Operations>Trim Trailing Space.


We’ll start off by putting in the Height Profiles section:

Code:
---------------------------
      Height Profiles
---------------------------

[heightprofile]
-1.5
1.5
0.15
0.15
The values are as follows:
  • X from
  • X to
  • Z from
  • Z to
We do not need to include the subtitle (the text inside the dashes), but it’s best to put these in to keep the file as readable as possible.

So, in that tag, we’ve effectively drawn a line 3m wide, at 15cm in height. Note, if you were to do the X values as: FROM 0m, TO 3m, it will still produce a spline that looks the same as our example. The difference is that in our example, when you place the spline, the centre of the spline will be at the tip of the mouse, and the spline will rotate about that point in curves. In 0m-3m, the left side will be at the tip of the mouse, and the spline will rotate about its left edge.

We do not need to tell OMSI about any vertical faces, as it will not camber these anyway.

Now, the next section is straight forward.

Code:
---------------------------
         Textures
---------------------------

[texture]
Pavement.bmp

[texture]
Kerb.bmp
This is simply a list of the textures used in the spline. Remember, these must match the filenames exactly – they are case sensitive. Make sure you put the correct file extension on.

Next, we get onto the ‘Graphical Lanes’ – the faces of the spline. This is the part that most people struggle with, so read very carefully.

Start with this:

Code:
---------------------------
     Graphical Lanes
---------------------------

[profile]
0
The [profile] tag is saying which texture is in use for the face we are about to input. In this instance, it is saying ‘Texture number 1’ – referring to the list of textures we put in above. Note, the first texture in the list is referred to as ‘0’, the second as ‘1’, the third as ‘2’, and so on.

Now, we put the face itself in:
Code:
[profilepnt]
-1.5
0.0
0.0
3.0
Each [profilepnt] tag refers to a whole co-ordinate. Note, it is handled differently than height profile tags, which only use one. The first [profilepnt] tag is FROM, and the second [profilepnt] tag is TO.

So, the first [profilepnt] tag is structured as follows:
  • X from
  • Z from
  • Texture start
  • Times texture repeats every 10 metres
X from determines where along the width the spline this face starts. Z from determines where on the height of the spline this face starts. So, we’ve told OMSI to place a point at -1.5m, 0cm in height.

Now, texture start and texture end determine what segment of the texture file is used. The left edge of the texture file is 0, and the right edge is 1. You can use any number in between. Therefore, if you wanted to use only the second quarter of the texture, you’d use 0.25-0.5. We’re using the full width, so we’ll do 0-1.

The fourth value in the [profilepnt] tag determines how many times the texture will repeat every 10 metres along the length of the spline. So therefore, if it tiles too frequently, and the texture is squashed, we need to tell it to repeat less, so we enter a higher value. If the texture is stretched and doesn’t repeat often enough, we decrease the value.

So, a value of 1 will mean the texture repeats every 10 metres, a value of 10 will mean the texture repeats every metre. We’ll enter 3, which means the texture will repeat just under every 3 metres.

Note: It is important that the fourth value is the same in both [profilepnt] tags.

Now, let’s put the second [profilepnt] tag in:

Code:
[profilepnt]
-1.5
0.15
1.0
3.0
This tells OMSI to put a second point at X -1.5m, but now at a height of 15cm. It will draw a line between these two [profilepnt] tags, thus giving us a vertical face which will be our left kerb edge.

And that’s it for creating faces! We’ll put the remainder in here:

Code:
[profile]
1

[profilepnt]
-1.5
0.15
0.0
3.0

[profilepnt]
1.5
0.15
1.0
3.0
This was the top edge of our spline, going from -1.5m to 1.5m at a height of 15cm.

Code:
[profile]
0

[profilepnt]
1.5
0.15
0.0
3.0

[profilepnt]
1.5
0.0
1.0
3.0
And this was our kerb edge on the right side, going from 1.5m at a height of 15cm, to 1.5m at a height of 0cm.

A note on direction of faces:

Faces only have textures placed on one side. Where they go left to right, they appear on top. From right-to-left, they appear on the bottom. From bottom to top, they appear on the left, and from top to bottom, they appear on the right. This is useful to note if you are creating tunnels. If your texture appears on the wrong side of the face, simply switch direction.


Finally – we need to input paths that are on our spline:

Code:
---------------------------
          Paths
---------------------------

[path]
1
0
.15
1
2
The structure of this tag is as follows:
  • Type: 0 – cars, 1 – pedestrians, 2 – rail
  • Where on the X axis the path is - 0m is the centre of our spline
  • Where on the Z axis the path is – 15cm is the height of our pavement so we put 0.15
  • The width of the path
    • For cars, when they are turning, they will move over to the side – the wider the path is, the more they can move over. With pedestrians, they can walk anywhere in the width of the path. We'll just put 1m here.
  • Which direction the path goes in: 0 – forwards, 1 – backwards, 2 – both ways. As pedestrians can walk in either direction, we’ll put 2.
Your completed file will look like this:

Code:
---------------------------
      Height Profiles
---------------------------

[heightprofile]
-1.5
1.5
0.15
0.15

---------------------------
         Textures
---------------------------

[texture]
Pavement.bmp

[texture]
Kerb.bmp

---------------------------
     Graphical Lanes
---------------------------

[profile]
0

[profilepnt]
-1.5
0.0
0.0
3.0

[profilepnt]
-1.5
0.15
1.0
3.0

[profile]
1

[profilepnt]
-1.5
0.15
0.0
3.0

[profilepnt]
1.5
0.15
1.0
3.0

[profile]
0

[profilepnt]
1.5
0.15
0.0
3.0

[profilepnt]
1.5
0.0
1.0
3.0

---------------------------
          Paths
---------------------------

[path]
1
0
.15
1
2

And that’s it! Save your file and look at it in-game.

OMSI Spline Tutorial, OMSI Spline Tutorial English, OMSI English Spline Tutorial
 
Last edited by a moderator:

Jacobthebus

Weeeeeeeeeee
Mar 7, 2016
1,047
An incredibly useful and much awaited (from my point of view) guide! I'm sure this'll come in useful for a few people in quite a few situations, so thank you!
 

LondonBuses

Map Developer
Jul 24, 2017
50
Thank you so much! . I have been making junctions in blender following Rhys tutorials so now to be able to make splines is amazing!! Thanks so much!,

Just need to work on creating custom objects and then once im happy with all that in a few months i will attempt bus development too
 

junaidstarz

Junaid sheeraz
Oct 20, 2016
384
i dont think this was suppose to happen
upload_2017-10-17_11-47-32.png


how do i get the kerb texture on the to of the pavement?
upload_2017-10-17_11-53-4.png
 
Last edited by a moderator:

junaidstarz

Junaid sheeraz
Oct 20, 2016
384
@iomex please, if you have time. could you please tell us how to make a spline that is a road with pavements. thanks