A month or two ago I have searched for open source alternatives for TTD and found openTTD. Since then I've been playing a lot, but there was one thing annoying me - purchasing a train is very long procedure. Click 'Buy', search for best engine, click buy, search for required wagons, many clicks to buy the required number of wagons, few clicks to refit (if FIRS or similar NewGRF used), click order icon, search for source station, click, search for target station, click, and one more click to start the train.
Usually I do not care much about the engine (buy fastest at later game stages, in earlier stages - fast, but not very expensive), I do not do refits at stations and use one or two types of wagons (just wood, just coal, passengers+mail, livestock + grain, etc). My trains are usually of the same length (5 or 7) and go between 2 stations (load at one, transfer or unload at another). And I do many mistakes using current openTTD "Buy vehicle" window - sometimes I give orders and start train forgetting to buy wagons, often I forget to refit wagons.
So I have decided to implement a simple window which produces me a fully functional train of selected length. I had problems choosing the right name for the window (and a patch), so for now I will just call it "Lazy Train Builder" (window title is still "Casual Train Purchase" which was the name I have used earlier).
Here is the screenshot of a current version:
As you can see, there is a new button "New train" in train depot which opens a new window. Lazy Builder window allows to select cargo type (and optionally second cargo), engine type, train length, source and target stations. It works best if depot is located near the source station - nearest station and its produced cargo are selected by default. So if your depot is near the farm station, this station will be selected as the source, livestock will be selected as first cargo and grain - as a second one. And it will works better if you build the target station before opening the window (as cargoes section filters out the cargoes which are not accepted in any of your stations).
The patch is not meant to cover all the needed cases, so some things are simplified - it only shows cargoes which are both produced and accepted by some of your stations, cheapest wagon is selected for each cargo (if there are multiple possible wagons), if stations are selected first orders is "full load", and the second one - "unload" (if passengers are selected, second order is also "full load"). Expert user will often find old style "Build vehicle" window more efficient, but for casual users it might make game more enjoyable.
I have tested the patch in single player games using clean trunk build (r27505) and multiplayer games using BTPro server/client (which is based on 1.5.3 with multiple patches applied).
I have many plans how to improve the window, but I'm not sure which ones I will ever implement:
- Add filters. For wagons it would allow to filter "Produced+accepted", "Produced anywhere", "Accepted anywhere", "All cargoes". For engines I should probably add the "Show/Hide" functionality (as in original "Build vehicle" window) and a filter to show hidden engines. For wagons there could also be an option to prefer cheapest or highest capacity wagon (if there are multiple choices)
- Make some labels and add warnings ("selected station does not produce the cargo", "no path found between stations", etc.)
- In station drop-down list order stations by cargo production/acceptance and by distance (so if coal is selected, in target stations selection first show nearest power station). Stations producing/accepting the cargo should be marked in a list.
- [DONE in 1.0.0] Calculating profitability estimates. I would like to make a rough estimate of how much trips per year could the train make and how much max profit can be made assuming indefinite production (knowing the distance between stations, capacity, engine running cost, aging vehicle price decline, cargo price it should be possible to make some guess). I do not plan to make a very realistic estimate
- Allow to select order types (full load or load any for source, transfer or unload for target)
- [DONE in 0.9.5] Option to build train stopped (to have ability to add tertiary cargoes, etc)
- If there are trains with same order need an option to make this train orders shared (quick way to clone vehicle using newer engine type)
- Better error handling. As train building is not an atomic process, it can fail at any step (for example, there is autoreplace going in background and company runs out of money after building engine with some wagons) and the half-built train will be left. Need to sell it in this case.