This item has been removed from the community because it violates Steam Community & Content Guidelines. It is only visible to you. If you believe your item has been removed by mistake, please contact Steam Support.
This item is incompatible with Cities: Skylines. Please see the instructions page for reasons why this item might not work within Cities: Skylines.

Manipulate networks with a Hex editor
By Orchid
Understanding how network data are stored in a save file. Fine tune your intersection assets without fiddling with the asset editor.
Favorite
Favorited
Unfavorite

This item has been added to your Favorites.

Created by
Posted
Updated
23 Apr, 2015 @ 10:25am
20 May, 2015 @ 2:29am
3,562 | Unique Visitors |
38 | Current Favorites |
Guide Index

Overview

Introduction

Structure of path stack

Structure of each path

Map coordinate system

Reference 1: List of float representations of common numbers

Reference 2: Types of paths

Comments
Introduction
To be able to edit the save file, you need a hex editor, like HxD: http://mh-nexus.de/en/hxd/
In this tutorial, I will describe:
In this tutorial, I will describe:
- Structure of the serialized data stored in the field m_paths, and
- Coordinate system used in the game.
CAUTION when you edit your asset with a hex editor:
Changing the file size will break your asset. This means you cannot add paths to or remove them from the path stack. What is available is to replace a path with another one having the same name length.
Structure of path stack
Under the section where m_paths is defined, a stack of paths is found. Immediately after the key word, there is a 32-bit integer describing the size of the stack; that is, how many paths are stored. Be sure to check this number; the file won't load if this number is wrong.
Note: Integers and floats, which we will see later, are stored with the least significant byte first[en.wikipedia.org]. For example, a 32-bit unsigned integer 2 is expressed as 00 00 00 02 but stored as 02 00 00 00.
Note: Integers and floats, which we will see later, are stored with the least significant byte first[en.wikipedia.org]. For example, a 32-bit unsigned integer 2 is expressed as 00 00 00 02 but stored as 02 00 00 00.
Structure of each path
Each path begins with its type name. Before the name string, there is an integer describing how many characters, or how many bytes, the name uses. It's also important to check the character count, or it will cause the file to fail to load up in the game.
After the name is the section describing the position of the path in a 3D space. There are three key points controlling the length and direction of the path, and whether it is straight or curved. Similarly, before these points there are also integers that reflect the number of the stack, but these integers are constant. First two points are the start and end positions. The third point defines the control node of the curve or does nothing if it lies on the straight line between two nodes.
The three coordinates of each point are stored as 32-bit floating-point numbers, with the least significant byte first. Their values are difficult to calculate manually; you might want to use a converter[www.h-schmidt.net] instead, but be careful – these bytes should be written in the reverse order to successfully convert them.
The last variable is a boolean which determines if the direction of the path goes reverse. This is the basis of the tool for switching directions. It also offers great convenience if we want to do this manually.
The last four bytes, not captioned in the image below, are another float called m_maxSnapDistance. Its default for virtually all networks is 0.1, which means they will snap to existing network if within a 0.1 meters' distance. It can also be edited.
After the name is the section describing the position of the path in a 3D space. There are three key points controlling the length and direction of the path, and whether it is straight or curved. Similarly, before these points there are also integers that reflect the number of the stack, but these integers are constant. First two points are the start and end positions. The third point defines the control node of the curve or does nothing if it lies on the straight line between two nodes.
The three coordinates of each point are stored as 32-bit floating-point numbers, with the least significant byte first. Their values are difficult to calculate manually; you might want to use a converter[www.h-schmidt.net] instead, but be careful – these bytes should be written in the reverse order to successfully convert them.
The last variable is a boolean which determines if the direction of the path goes reverse. This is the basis of the tool for switching directions. It also offers great convenience if we want to do this manually.
The last four bytes, not captioned in the image below, are another float called m_maxSnapDistance. Its default for virtually all networks is 0.1, which means they will snap to existing network if within a 0.1 meters' distance. It can also be edited.
Map coordinate system
In the default view, the three axes are laid out as: X pointing to the left, Y toward the top, and Z forward.
The unit length in this system is 1 meter, which equals 1/8 a cell length. The origin is at the center of the map.
From the origin, the map extends 1080 cells, or 8640 meters along X and Z directions. The asset editor provides an editable area that extends as far as 32 cells, or 256 meters in one direction. From the default height, one can go down at most 60 meters, or go up at most (1024 - 60 = 964) meters.
The unit length in this system is 1 meter, which equals 1/8 a cell length. The origin is at the center of the map.
From the origin, the map extends 1080 cells, or 8640 meters along X and Z directions. The asset editor provides an editable area that extends as far as 32 cells, or 256 meters in one direction. From the default height, one can go down at most 60 meters, or go up at most (1024 - 60 = 964) meters.
Reference 1: List of float representations of common numbers
From 0 to 32 meters (4 cells):
Use the converter for the rest of the numbers:
http://www.h-schmidt.net/FloatConverter/IEEE754.html
But be careful: In the converter you need to write the most significant byte first, which is the reverse from those listed here.
A common mistake is to break up a byte into two hexes. Don't just write the hexes in reverse.
Meters | Cells | Float in Little Endian (least significant byte first)
0 | 0 | 00 00 00 00
1, -1 | 1/8 | 00 00 80 3F, 00 00 80 BF
2, -2 | 1/4 | 00 40, 00 C0
3, -3 | 3/8 | 40 40, 40 C0
4, -4 | 1/2 | 80 40, 80 C0
6, -6 | 3/4 | C0 40, C0 C0
8, -8 | 1, -1 | 00 41, 00 C1
12, -12| 1 1/2 | 40 41, 40 C1
16, -16| 2, -2 | 80 41, 80 C1
24, -24| 3, -3 | C0 41, C0 C1
32, -32| 4, -4 | 00 42, 00 C2
From 4 cells upwards until 16:Cells | Float in Little Endian (least significant byte first)
4, -4 | 00 00 00 42, 00 00 00 C2
5, -5 | 20 42, 20 C2
6, -6 | 40 42, 40 C2
7, -7 | 60 42, 60 C2
8, -8 | 80 42, 80 C2
9, -9 | 90 42, 90 C2
10 | A0 42, A0 C2
11 | B0 42, B0 C2
12 | C0 42, C0 C2
13 | D0 42, D0 C2
14 | E0 42, E0 C2
15 | F0 42, F0 C2
16 | 00 43, 00 C3
Use the converter for the rest of the numbers:
http://www.h-schmidt.net/FloatConverter/IEEE754.html
But be careful: In the converter you need to write the most significant byte first, which is the reverse from those listed here.
A common mistake is to break up a byte into two hexes. Don't just write the hexes in reverse.
Reference 2: Types of paths
Notice that most of them have spaces in their names, while HighwayRamp and HighwayRampElevated are the exceptions.
[Common Types] | Length | Hex representation of length
Gravel Road | 11 | 0B
Basic Road | 10 | 0A
Basic Road Decoration Grass | 27 | 1B
Basic Road Decoration Trees | 27 | 1B
Basic Road Elevated | 19 | 13
Oneway Road | 11 | 0B
Oneway Road Decoration Grass | 28 | 1C
Oneway Road Decoration Trees | 28 | 1C
Oneway Road Elevated | 20 | 14
Medium Road | 11 | 0B
Medium Road Decoration Grass | 28 | 1C
Medium Road Decoration Trees | 28 | 1C
Medium Road Elevated | 20 | 14
Large Road | 10 | 0A
Large Road Decoration Grass | 27 | 11
Large Road Decoration Trees | 27 | 11
Large Road Elevated | 19 | 13
Large Oneway | 12 | 0C
Large Oneway Decoration Grass | 29 | 1D
Large Oneway Decoration Trees | 29 | 1D
Large Oneway Elevated | 21 | 15
Highway | 7 | 07
Highway Elevated | 16 | 10
Highway Barrier | 15 | 0F
HighwayRamp | 11 | 0B
HighwayRampElevated | 19 | 13
Train Track | 11 | 0B
Train Track Elevated | 20 | 14
Pedestrian Pavement | 19 | 13
Pedestrian Gravel | 17 | 11
Pedestrian Elevated | 19 | 13
[For Stations, Airport, Harbor] (not buildable nor bulldozable)
Pedestrian Connection | 21 | 15
Pedestrian Connection Inside | 28 | 1C
Train Station Track | 19 | 13
Airplane Stop | 13 | 0D
Airplane Runway | 15 | 0F
Airplane Taxiway | 16 | 10
Ship Dock | 9 | 09
Ship Dockway | 12 | 0C
[For Metro Stations exclusively] (not buildable nor bulldozable)
Metro Station Track | 19 | 13
Pedestrian Connection Surface | 29 | 1D
Pedestrian Connection Underground | 33 | 21
You need to sign in or create an account to do that.
The mod tools script command line.
I posted a guide for elevated train stations here, but the script can also be used for many other things: http://community.simtropolis.com/forums/topic/68906-i-think-i-found-a-way-to-create-elevated-train-stations/#comment-1590036
I think I found a way to create elevated train stations. I'm planning to make a mod for it. This is the first prototype: http://community.simtropolis.com/forums/topic/68906-i-think-i-found-a-way-to-create-elevated-train-stations/
I am facing a problem with the creation of the train station track. It is always split into 2 segments when it is longer than 12 cells. Do you know how to prevent that?
Also, do you know how to modify the existing station track of the template?
Very useful guide btw!