Add support for placing track tokens
t-rapp opened this issue · 2 comments
The Copilot expansion from Rallyman DIRT adds some track tokens that can be placed on top of the existing track tiles:
- water splash
- jump
- chicane
From what is shown till now in Kickstarter update #6, update #8, and update #12 the tokens are available with gravel, asphalt and snow background.
The editor should allow to place these tokens on the map, to move and rotate them.
Proposed changes to the RTG file format
Currently map data is stored with the following JSON structure:
{
"Path": "C:\\Applications\\RallymanGT\\RallymanGT Track Editor\\My Tracks",
"Name": "Some Track Title",
"Tuiles": [
{
"X": 50,
"Y": 50,
"Orientation": 0,
"TuileId": "201A"
},
{
"X": 51,
"Y": 50,
"Orientation": 0,
"TuileId": "205A"
},
/* ... more tiles ... */
],
"lowResWidth": 2480,
"lowResHeight": 1748
}
For adding track token support it is suggested to extend the structure of a tile with an "Tokens" array:
{
/* ... */
"Tuiles": [
{
"X": 50,
"Y": 50,
"Orientation": 0,
"TuileId": "205A",
"Tokens": [
{
"X": -0.6,
"Y": 0.0,
"Orientation": 0.0,
"TokenId": "chicane-gravel",
}
]
},
/* ... more tiles ... */
],
/* ... */
}
Placing the tokens inside the corresponding tile has the advantage that the editor application knows what tokens belong to a tile. When the tile is moved or rotated, the displayed tokens will also move or rotate. The stored token data is not changed in these cases, as the X
/Y
position of a token is relative to the tile that contains it. Similar the Orientation
of a token is considered relative to the Orientation
of the tile.
Token Fields
A token uses similar fields to a tile but with adjusted value types:
X
: position on the x-axis relative to the tile center as a floating-point value. A value of 1.0 represents the length of a hexagon side.Y
: position on the y-axis relative to the tile center as a floating-point value. A value of 1.0 represents the length of a hexagon side.Orientation
: rotation of the token relative to the tile as a floating-point value. For symmetry with tiles a value of 0.0 represents 0° and a value of 6.0 represents 360°.TokenId
: identifier for a token. Using strings like "jump-gravel" or "water-asphalt" would be suggested, combining the token type and the background terrain surface.
The following image shows the alignment of the X/Y axes, they are placed analogous to the X/Y direction of tiles:
Examples
Here two chicane tokens are placed on tile 205a. The token with a speed limit is placed on the tile center and rotated by 180°, the other token without a limit is moved upwards by 58% of a hexagon side length.
{
/* ... */
"Tuiles": [
{
"X": 50,
"Y": 50,
"Orientation": 0,
"TuileId": "202A"
},
{
"X": 51,
"Y": 50,
"Orientation": 0,
"TuileId": "205A",
"Tokens": [
{
"X": 0.0,
"Y": 0.0,
"Orientation": 3.0,
"TokenId": "chicane-limit-gravel",
},
{
"X": -0.58,
"Y": 0.0,
"Orientation": 0.0,
"TokenId": "chicane-gravel",
}
]
}
],
/* ... */
}
In the next example the same tiles are shown but rotated by 60° counter-clock-wise. Note how only the field values of the tiles change, the token values remain the same as they are relative to the tile:
{
/* ... */
"Tuiles": [
{
"X": 50,
"Y": 50,
"Orientation": 5,
"TuileId": "202A"
},
{
"X": 50,
"Y": 51,
"Orientation": 5,
"TuileId": "205A",
"Tokens": [
{
"X": 0.0,
"Y": 0.0,
"Orientation": 3.0,
"TokenId": "chicane-limit-gravel",
},
{
"X": -0.58,
"Y": 0.0,
"Orientation": 0.0,
"TokenId": "chicane-gravel",
}
]
}
],
/* ... */
}
Track tokens can be placed and moved in the map detail view in the upcoming version v0.7.