BugSmashers – Episode 11

Bugsmashers

Notes by CanadianSyrup

THE BUG

In editor, when a user climbs into a hornet then exits game mode, the client will crash when entering game mode again. (Game mode is the state you are in when piloting the hornet afaik)

THE SMASH

– Mark broke the ladder to the hornet but that’s working as intended

– Mark gets in the hornet and exits the game mode to back to the editor and as soon as he clicks the button to switch back to the game mode it crashes.

– Mark dives into the logs to see what went wrong

– When Mark looks through the logs, he finds that the reset event, which is responsible for clearing the entities to a default state, accidentally clears the animations incorrectly and throws an error. When clicking the button to switch back to the game, the client uses the “Callback” which loads everything back in but fails to do so properly because the “reset” function made the mistake of removing the character in the hornets seat and as such the player no longer exists in the game. So when the game goes to load the character into the seat, there’s no character for the Callback animations to place in the seat and as such the game flips out and crashes.

– The reason why this bug appears to have happened was due to another crash where a function named “Delete Action Controller” was removed from a section of the vehicle destructor code(Which is used to deconstruct the object) and moved into an event called “done”. The event entity done allowed it to be called out to the entity being removed prior to deleting which allowed it to clean up and not deal with the virtual function calls.

– The reason why it was bad for the “Delete Action Controller” function to be in the Vehicles destructor code in the first place is because when the code does it’s deconstructing and it calls back with virtual functions, a callback with virtual callback functions can get some weird undefined behavior due to the nature of a virtual callback compared to a regular callback .Think of the difference between something simple and something complex when comparing regular callbacks to virtual callbacks, more chances of something going wrong if the virtual callback parameters don’t match properly.

– With that fix it introduced the current problem which was all the “call back” animations (How it loads everything back in) weren’t being properly completed due to how everything was organized after the previous fix.

– Mark makes sure that everything is loaded in the correct order and no more crashes!

– But wait Mark crashes again! However this crash is due to something completely unrelated!