In last week’s devlog I mentioned that the changed coordinates of most airports in the world are causing issues for players who need to change existing flights and I promised to work on a solution, namely speed overrides with fixed arrival times. So that’s what I did last week.
Implementing fixed arrival times
It’s sort of in the title: Flight planning is at the heart of AirlineSim. And I remember my young self being incredibly proud of the visual flight planning interface everyone playing AS has been using for the past 15 years or so now.
But this statement already hints at the core challenges here: My young self didn’t really know what he was doing and the code is really, really old. This means there is no test coverage at all and it shows in the way the code is written. Lots of cases of “once it works, never touch it again”-style code fragments or “spaghetti code”, as we like to call it. My natural instinct in a situation like this, especially after working several years in freelance projects practicing Continuous Delivery, is to rewrite the code to make it testable, then build test coverage and then do the actual change I want to do. But in this case, urgency trumped my instincts and I implemented the change “the old way”. Painful, but oh well…
There were also some smaller annoyances along the way, like realising that generating arrival times for aircraft flying at 800 km/h or more on trips of just a few hundred kilometers leads to ugly (but unavoidable) rounding issues when dealing with minute-precision times. Or like trying to switch our hours-and-time form component to native time inputs, just to realise that the browser implementations are sort of “meh” (to be investigated further in the future).
Implications of fixed arrival times and test run with Junkers
The new flight planning interface that replaces relative speed overrides with fixed arrival times will first roll out to Junkers today so we can get some feedback from actual use and spot any major issues before rolling it out to all game worlds. Here are the most important things to keep in mind:
- When scheduling new flights, everything should work pretty much as it has before.
- When working on existing flights, note that AirlineSim now defaults to the safe option, meaning any existing arrival times will be fixed by default and you need to uncheck the fixed arrival time checkboxes for AS to automatically compute new arrival times based on the aircraft’s speed.
- The utility buttons that previously allowed to set a minimum or maximum cruise speed have been replaced by such that allow to skip to the previous or next slot (meaning: current arrival time -/+ 5 minutes).
- As soon as you manually touch an arrival time, either by actually changing it by hand or using and of the utility buttons, the time for that day (or those days) will be automatically marked as “fixed”.
- Unchecking a “fixed arrival time” checkbox means that AS will immediately compute an arrival time based on the aircraft’s speed.
- Of course, any change will only become effective once the adjusted settings are saved.
- Scheduling hypothetical flights is still possible by marking a flight day’s arrival time as fixed in scheduling without assigning an aircraft. Note that in these cases, a default cruise speed of 800 km/h will be used for lack of a better alternative at this point.
Note that there’s a high chance of bugs hiding in this (new) code, especially when it comes to timezone and time settings shenanigans. Please keep an eye out for such issues and please let me know if you come across any!
In general, I would highly appreciate your feedback on this and how the feature could be further improved and/or be made more user-friendly.
Remaining work and general roll-out
While working on this I realised that the current 5% limit for deviations from optimum cruise speed really isn’t all that much, especially on short distances. I currently plan to increase this limit before the general roll-out to all game worlds.
Speaking of which: If we don’t come across any major issues or large waves of negative feedback over the first couple of days after Junker’s restart, we hope to roll this out to all game worlds later this week, together with a few other minor changes and fixed.