A tool to generate efficient cargo networks (in Transport Fever 2)
The Map
class represents a map, to which Town
and Industry
instances can be added.
The class creates a delaunay triangulation network linking all towns and industries,
optionally removing edges which cross impassable lines.
A network which minimises cost by using empty return journey capacity is generated.
- Uses a custom graph data structure to store directional weight and cargo flow information per edge
- Generates tab separated text output suitable for import into data visualisation softare or futher processing
- Well documented source code
The source code contains documentation of the main functions and types.
CargoType
and WagonType
enumerations represent cargo and wagon types.
Town
and Industry
classes represent towns and industries.
Map
is initialized empty and information is then added using the following methods:
addTown(_)
to add a townaddIndustry(_)
to add an industryaddImpassableLine(_)
to add an impassable line
A network can be generated using te following methods:
triangulateAllLocations()
to create the initial triangulation between all towns and industriesbuildNetworkGraph()
to build the network graph in which edges crossing impassable lines are removed from the triangulationsetUniformTownCargoRequirement(_)
to set a uniform consumption demand for all townsmakeAllConnections()
to make all connections for cargo required
The network structure can be inspected using the following methods:
printIndustryInfo()
to print node id, type and location of all industriesprintTownInfo()
to print node id name and location of all townsprintAllPaths()
to print informatino about each pathprintEfficiencyStats()
to print statistics about the efficiency of the network