zlsa / atc

https://openscope.co/
342 stars 107 forks source link

KLAX freezes #417

Closed doofus closed 8 years ago

doofus commented 8 years ago

Every time I play KLAX or KLAX90 the sim freezes on me after a minute of two. If I switch to another airport, the screen is still frozen. I have to reload the sim to recover. I have tried this on at least two different computers using Chrome on one and Chromium on the other. Is anyone else experiencing this?

Fechulo commented 8 years ago

Since I don't usually plat at KLAX, I haven't experienced this, but I'm going to take a look at it. Did this happen before the new SID update?

doofus commented 8 years ago

I'm not sure when the new SID update was, but it was happening in January.

Fechulo commented 8 years ago

it was released a few days ago. I've been playing for the last 10 minutes on x2 speed and so far no crash. Is it still happening?

doofus commented 8 years ago

Yes. Just tried a few minutes ago. Same problem.

Fechulo commented 8 years ago

Did you try it on KLAX or KLAX90?

Fechulo commented 8 years ago

I don't seem to have any problems with KLAX. However, when using KLAX90 the game does freeze. With some aircraft, the CAF (Cleared as filed) command does not work. The error is: "Cannot read property 'toString' of undefined" in util.js line 379. Once the aircraft is cleared for takeoff, the game freezes and another error pops up: "Cannot read property 'type' of null" in aircraft.js line 968. @erikquinn mind taking a look at this?

erikquinn commented 8 years ago

@Fechulo sure, I'll get back to you. If it is specific to this airport, that would seem to point to the airport file, but nothing seems wrong with it as I looked just now on my phone. Once I can get to my computer, I should be able to get an answer.

erikquinn commented 8 years ago

it actually was trickier to make sense of than I thought.... but the problem will happen with 8 aircraft types; all a/c that were added in b315af6 (from pr #337) will experience the issue. It is due to them not having any service ceiling specified for each aircraft. It works like this: the aircraft's fms has a flightplan, including a route and altitude (very basic at this point). The route comes based on where they are and where they're going, and is saved in aircraft.fms.fp.route. Until more intelligent and thorough logic is implemented, I just have the flightplan altitudes (aircraft.fms.fp.altitude) set to the aircraft's service ceiling (highest altitude it can go). Thus, since the 8 added aircraft do not have any service ceilings defined, and the FMS isn't sure what altitude it should file for. The error you are seeing is from when that altitude of undefined is passed to a function, radio_altitude(), that pronounces numbers for the speech synthesis.

It can be resolved by adding appropriate service ceilings to all aircraft that don't have such a property (probably just the eight in the linked commit).

In fact, there are other issues with those flights as well..... they just seem to be built using only the properties previously in use, and don't include all the new properties that are needed to work properly with a variety of newly-added features. For example, the second error at aircraft.js:968 is from the aircraft not having the properties that describe the number and types of engines present, which is used for a variety of things in the sim logic.

Long story short, those aircraft need to be updated, and then all will be back to normal. Perhaps it would be a good idea to add some validation logic that checks all the aircraft to ensure it has all the properties it needs to have, and if not, throw an error in the console so we can see it clearly.

Fechulo commented 8 years ago

Interesting, I think having a validation logic is a great idea. We should still try to add the missing information for these aircraft. Thanks for the help!

erikquinn commented 8 years ago

Found the issue at a number of other airports as well. Turns out to have been related to airlines trying to spawn aircraft that don't exist (eg a300 vs a306 for Airbus A310), or airline default fleets being empty, or aircraft that have a different .icao than their filename.

Knowing this, I have now thoroughly tested and verified this issue to be resolved by the combination of changes specifically fixing this in 23bcd47, as well as the updates made to #397.