Dev Log Week 2024-21: Ad hoc open-heart surgery

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.

2 Likes

Hi Martin, Great work on such a quick implementation.

I was wondering if for the speed overrides, it would be possible to take actual aircraft topspeed in account. E.G. An A350 won’t start flying well over 1000 km/h but is limited to actual real life spec sheet topspeed.

Of course groundspeed can be higher,but I don’t think AS takes wind/jetstreams into account currently, which therefore doesn’t make sense. Downwards modification to a slower speed would of course be much more possible, and you could easily be able modify to a decrease of more than 5%.

Best,
Rjohn

At this point it isn’t, for the simple and obvious reason that we don’t have the respective data in our database :wink:

But in this case, getting the implementation done quickly was the priority. I see no reason why not to add actual minimum and/or maximum speeds for individual aircraft types, if those values can be easily researched for the majority of the relevant types. Haven’t looked into that at all yet and would appreciate input from people in the know.

1 Like

Happy to help researching if it helps, using open source. As far as I am aware though, there are no minimum speeds apart from stall speeds at certain height, there are cruise and maximum speeds though.

I find it actually pretty good.

I would add one more thing, set arrival time with maximum cruise speed, and set arrival time with minimum cruise speed.

The “ticks” are already in the old code, just implement them to the new code please. I understand the “max/min speed” would not be saved (only arrival time would be saved) and the cruise speed is dynamically calculated for reference, but it would make it a good tool to set arrival times while travelling at the maximum or minim speed, without having to try multiple arrival times and seeing if the aircraft is still within performance limit.

What it would effectively do is take the minim or maximum speed when clicked on the “tick” and calculate the appropriate arrival time in the box below.

I actively decided against keeping them because they’d become “dangerous” should we actually allow higher deviations from the optimum speed. There will be quite the penalty in fuel consumption - including potential performance issues due to reduced max payload - and I can already see a lot of confused questions on the forums about that because inexperienced players might just go with the highest speed (because…why not?) while unaware of the consequences.

All hypothetical, of course. But I’d rather wait with (possibly) re-adding those utility buttons until I have increased the deviation limits.

Running into a problem with the fixed arrival times. I’m looking at adding a flight from NRT to SEA on A321LR. The fixed arrival time 1 minute interval results in speeds of either 839kph or 841kph, neither of which is valid for this aircraft on at this range. Somehow I need to get to 840kph but that isn’t possible. Am I missing a solution here?

Thanks.

What do you mean by this? Of course these are valid speeds. It’s likely due to rounding issues that you can’t hit excactly 840 km/h. But that really shouldn’t matter all that much.

What he means that in the new system that route is invalid, while on the old system it is a valid route. It is not invalid because of arrival time (which is the same with new calculation as with old calculation), but the speed changes from 840 km/h in the old system to 841 km/h in the new system (see image 1). And 841 km/h makes the flight invalid. If you move the arrival by one minute later, the speed changes to 839 km/h which is also invalid (see image 2). There is no way to set the speed to exactly 840 km/h. Compared to the old system, where it’s 840 km/h default (see image 3). Also in the old system, changing the speed to 841 km/h or 839 km/h makes the flight performance invalid, but that’s a manual action (see image 4). In the new system there is no way to set the speed to exactly 840 km/h, as the system calculates the speed by itself, whereas in the old system the speed was manually chosen by the player.

image 1

image 2

image 3

image 4

This probably will affect many flights that are on the edge of speed / distance performance.

Ok, now I get it.

But in a case like this, it was pure chance that it worked in the first place. I don’t think the goal should be that players have to fiddle with single-km-per-hour precision when scheduling. Which sort of reinforces my view I stated above that focusing on min/max cruise speeds is not in the players’ interest.

I’ll likely roll out the fixed arrival times to all game worlds sometime between today and Friday, and I’ll increase the maximum speed deviation to 15%. Then at least the immediate issues from changed airport coordinates should be resolved. People will only run into issues down the line when they decide to max out the speed envelope again :sweat_smile:

1 Like

Martin - it’s not a min/max question, it’s a range question. In the last third of an aircraft’s range, you can’t vary from the default speed. This isn’t trying to game things or have precision, the aircraft can physically fly the route, but the system won’t allow it to do so unless it’s exactly 840kph. Having a 15% tolerance around that speed seems like a practical solution.

Oh, ok, I sort of skipped over the “NRT to SEA on an A321” bit :smiley:

I figure that’s an edge-case. The Improved Aircraft Performance formulas would likely solve this issue, but the current static formulas just don’t permit any additional fuel in “section 3” of the payload-range chart. And deviations from optimum speed always incur an increased fuel burn.

Let me think a little about how this issue could be resolved.

I just saw the update on Kaitak while scheduling some flights. Functionality is really nice, thank you for that! I just want to mention that the readability of the arrival times is a problem now. I’m using a 13" Macbook and thus a pretty common resolution, I guess, and there is not enough space for the dropdowns to show the numbers. Any chance to improve that? If you ask me, the ‘UTC’ information is not important as it is an overall setting. I know that there won’t be perfect solution for all screens though.

1 Like

Thanks for the heads-up! Will remove the timezone label with the next patch. And need to have a look at the styles…odd that the numbers simply disappear.

1 Like

The numbers are there but the column is too tight. The numbers appear once I open the dropdown. Or when i widen the browser window (extending/exiting the screen).

I met the same problem, only one digit is displayed.
image

Maximum speed deviation from ±5% to ±15% wtf? Was that necessary?

Hi Martin,

I think it can be better if there can be an option in the game settings that allows us to make “fixed arrival time” not ticked by default.

2 Likes

That thought has occurred to me as well. So when one opens existing flight assignment for editing, the boxes would optionally be unticked, meaning that if something changed in the background, the possibly changed arrival times might cause errors.