Part 25: Commentary Corner - Sakura and Scripts
More Stuff about Sakura and ScriptsSpeaking of Sakura, and how the game was made in general, she's got a lot of hardcoded behavior and actually shows up as a unique object class in the editor. A lot of functionality exists as "scripts" functionality which can be freely applied to many objects; basically functions you attach to them, complete with user-configurable parameters (health values, waypoint IDs, sound file names, etc.) in general.
There were actually some quirks with the scripts from what I recall during A Path Beyond development that could cause some slowdown. We relied on a pile of scripts on nearly everything, to give the custom behavior we desired. You ended up with a huge stack of virtual function calls for every object, for every script, that would be invoked for a wide variety of events that didn't really need it. Like, every single bullet fire event would bother every single one. Oddities like this might be why some things were packed so tight into either a unique class, or into a monolithic does-it-all script.
In any event, it is annoying if you're trying to use that stuff. Sakura the helicopter is hardcoded to reference several waypoint IDs by reference number, not even a by name lookup, and will only attack if within certain map boundaries that are hardcoded. So if you wanted to reuse her behavior you'd have to divine those and then hardcode them into your map or whatever, then adjust the whole map to position her arena accordingly.
Unlike the chainguns in the game, her own chaingun really has a "spinup" built in by way of her unique object. You can hear that noise before she shoots our hero. It might not surprise you to know that the game itself, for all weapons, does support a sort of spinup or fire delay-- it just goes unused. You could easily make, say, an Obelisk Gun that has to charge before firing.