i use file from the map folder into LFS for that called .pth file.
You have all Node for a Track on a Map.
It contain:
Node Count,
Node Index,
Center Coord,
Parallel distance To track and Limit of Map playable.
Here is a code that is able to retrieve all PTH file and all info from those file! if you need to use it as example.
enum PTH_Format : int
{
FILE_TYPE = 0,
VERSION = 6,
REVISION = 7,
NODE_COUNT = 8,
FINISH_LINE = 12,
NODE_START = 16,
NODE_LENGTH = 40,
CENTER_X = 0,
CENTER_Y = 4,
CENTER_Z = 8,
DIR_X = 12,
DIR_Y = 16,
DIR_Z =20,
LIMIT_LEFT = 24,
LIMIT_RIGHT = 28,
DRIVE_LEFT = 32,
DRIVE_RIGHT = 36,
}
internal static bool Initialize()
{
string[] files = System.IO.Directory.GetFiles(Program.dataPath + Path.DirectorySeparatorChar + "map", "*.pth");
byte[] buffer;
int nodeCount;
int finishNode;
for(int itr = 0; itr < files.Length; itr++)
{
buffer = File.ReadAllBytes(files[itr]);
if(buffer.Length > 12)
{
if (GetString(buffer, (int)PTH_Format.FILE_TYPE, 6) != "LFSPTH")
{
Log.error(" Invalide FileType map -> "+files[itr]+"\r\n");
return false;
}
if (buffer[(int)PTH_Format.VERSION] > 0)
{
Log.error(" Invalide Version map -> " + files[itr] + "\r\n");
return false;
}
if (buffer[(int)PTH_Format.REVISION] > 0)
{
Log.error(" Invalide Revision map -> " + files[itr] + "\r\n");
return false;
}
nodeCount = GetInt(buffer, (int)PTH_Format.NODE_COUNT);
finishNode = GetInt(buffer, (int)PTH_Format.FINISH_LINE);
MapData mapData = new MapData(nodeCount,finishNode);
int firstIndex;
for(int nodeItr = 0; nodeItr < nodeCount; nodeItr++)
{
firstIndex = ((int)PTH_Format.NODE_START + ((int)PTH_Format.NODE_LENGTH * nodeItr));
mapData.SetNode
(
nodeItr,
GetInt(buffer, firstIndex + (int)PTH_Format.CENTER_X),
GetInt(buffer, firstIndex + (int)PTH_Format.CENTER_Y),
GetInt(buffer, firstIndex + (int)PTH_Format.CENTER_Z),
GetFloat(buffer, firstIndex + (int)PTH_Format.DIR_X),
GetFloat(buffer, firstIndex + (int)PTH_Format.DIR_Y),
GetFloat(buffer, firstIndex + (int)PTH_Format.DIR_Z),
GetFloat(buffer, firstIndex + (int)PTH_Format.LIMIT_LEFT),
GetFloat(buffer, firstIndex + (int)PTH_Format.LIMIT_RIGHT),
GetFloat(buffer, firstIndex + (int)PTH_Format.DRIVE_LEFT),
GetFloat(buffer, firstIndex + (int)PTH_Format.DRIVE_RIGHT)
);
}
string trackPrefix = files[itr].Substring(files[itr].LastIndexOf('\\')+1);
trackPrefix = trackPrefix.Replace(".pth","");
maps.Add(trackPrefix,mapData);
}
}
Log.commandHelp(" Loaded "+files.Length+" Maps.\r\n");
return true;
}
I hope this is not for using to calculate SPLIT Time a driver do between Node.
Since you are using a insim application, it is not possible for you to have a real precision time as the LFS server do.
This will deliver not quality content ;(.
As the Maximum Speed Or Acceleration speed Feature, it fun to have but we can't base Valuable thought or data from those system and most of driver don't know that! so this become the duty of people developing insim addons to be vigilant.