Moderator: OpenTTD Developers
Edit: my statement might be incorrect starting from openttd 1.10.0, let's wait if it will improve
The AI linked an iron ore mine to a steel mill via roads then proceeded to build 3 truck services within a few months. That's hardly an efficient way to do it as only 2 stations will be getting resources. However, all three services are still active after 10 years - and it does tend to block other companies from setting up a service!
The double tracked rail lines set their signals so trains drive on the right. I always set my trains to drive on the left. I had a quick look at the code and basically didn't understand most of it. I'm guessing it's not an easy thing to change this but if you think it's possible if you could perhaps give me a few pointers so I might change it... I'm NOT asking you to make any changes (I really wouldn't expect you to do so). I'm pretty sure that players who have trains driving on the left are few in number, but I'd like to change it for myself if I possibly can. It only becomes relevant when I take over such a company and I can live with it how it is at the moment.
I do like the fact that there are shared vehicles which makes it so much easier after takeovers. Bigger rail stations are also appreciated.
Actually, on further inspection, the signalling is way more complex than I first thought. There's a strange combination of single, path and one-way stuff. It mostly works except for one instance where a train went the wrong way (on a line that connected another service and the AI ended with 4 trains stuck).
It's also slightly annoying that if a rail service closes that the associated track is left in place - but I can understand the situation when services share some common track.
Changing trains to drive on the left track will be quite complex for sure. The rail construction contains a lot of code that is written to have trains running the right hand track. You could try to change the orientation (and types) of signals being placed on new railway lines, but it might cause deadlocks on two-track sections on single track lines.
The best way would be to change the RailTrackPlan (yes it is a huge bunch of code) in rail.nut and some more other changes. Required changes (as far as I think would be needed):
- Make sure you understand how the VectorCoordinates work (world.nut).
- path1 should not go from the right track to the left track, but from the left track to the right track. This can be changed in the pathfinder.InitializePath command (line 686 of rail.nut). Not that all the avoidArea and avoidTiles must be changed too: these are tiles that must be avoided by the pathfinder, basically already reserving some space for the other track.
- GetTilesLeftFrom must be changed to a function GetTilesRightFrom. This function now returns a tile/direction array left of a given path. Note that it behaves different from corners to the left and corners to the right, because the other track crosses a different number of tiles.
- BuildPassingSectionsLeftFromTiles must be changed to a function BuildPassingSectionsRightFromTiles
- If there is more that refers to left or right (variable names or comments), try and check if it must be changed.
- Disallow for train stations with more than two platforms (numPlatforms in station.nut). Current station exits will cause deadlocks with trains running on the left track, and it is all hardcoded (I still have the idea to refactor it one day). You could also try to change it, but it won't be easy.
- On double track lines, use simple signals
- Before switches, place path signals. Use a one-way path signal on the right track to prevent trains running on the left track.
- Also use path signals (preferably one-way signals) on two-track sections of one track railway lines (note that more than 50% can be double track)
- If something is changed to an existing railway line (a new bridge connected, a railroad crossing removed/placed, a new switch was placed) replace simple signals there with path signals
I'm not going to attempt any changes to train driveside or signals...way too complex.
As for the 3 stations at one mine, having 2 stations should be a max limit (which might effectively block opposition - that's fine) but having a third pickup station is self defeating - so perhaps being able to detect and prevent that happening would be helpful for that company.
Removing unused track would be helpful as otherwise a smallish map can easily get clogged with redundant track and a takeover or bankruptcy is the only effective way to clear it.