Ok, I'd like to present my plans for an exporter:
Ingame Exporter
The exporter is implemented in the openttd game as a video driver. It will be named "graph" driver and inherit the "null" driver. It will just scan all stations and order list and output a dot-formatted graph to stdout.
So the call would be:
Code: Select all
openttd -g my_savegame.sav -v graph
This means: Load the game "my_savegame" into openttd, then run the video renderer "graph", which only renders the graph into a .dot file and dump it to stdout.
How will this graph look?
- Stations are nodes, waypoints and depots are not drawn
- The station nodes are positioned as in the savegame's map, preserving the geometry
- Each ordered list is one "railway line", and if two ordered lists are equal (except of where the trains start, except waypoints and depots), they are put together as one railway line
Example:
.
External Tool
The latter rendered graph will be basic and have no options, since options would have to go through the openttd argument parser. So, additionally, there will be an external graph tool which then converts the exported graph to a user defined graph (.dot to .dot). It will provide options, be written in C++ and maybe have an additional library dependency (boost::graph).
The external tool will allow
- to restrict the graph to some cargo types (only passengers, only coal and steel, etc.)
- to draw the graph octilinear and modifying the geometry a bit
- options, like, e.g. that order lists that have a subset of stations of another order list are being put into the same railway line.
- options, like, e.g. that express trains (e.g. railway lines that are like another railway line, but pass through some of the stations) are being discarded.
An example (Linux and similar)
Export my_savegame.sav to a basic graph.
Code: Select all
openttd -g my_savegame.sav -v graph > exported_graph.dot
Extract only passenger lines, and discard "subset railways" and "express railways" (see above)
Code: Select all
cat exported_graph.dot | openttd-graph-conv -cargo "passengers" -no-subset-railways -no-express-railways > my_savegame.dot
Create a PDF file
Code: Select all
dot -Tpdf my_savegame.dot > my_savegame.pdf
Or, more simple:
Code: Select all
openttd -g my_savegame.sav -v graph | openttd-graph-conv -cargo "passengers" -no-subset-railways -no-express-railways | dot -Tpdf > my_savegame.pdf
Other OS
Should not be a problem, since all Code is written in C++.
Any thoughts/comments about this plan?