41
Fate of the Galaxy / Re: [FotG Update] May the 4th 2025
« Last post by wookieejedi on August 20, 2025, 04:58:52 pm »Unrelated to previous bug hunt saga which finally ended, but figured a small bug hunt novella still fits the theme:
Alas my folly that I hope to spare others from...Got a report that a large Imperial station in FotG was refusing to fire any turrets. Not very Galactic Empire of it... So I started up POF Tools and test mission, thinking a quick easy adventure might await--what a nice thought. In examining the model I could clearly see the FoV was set ('$fov:190') as it was even showing up in POF Tools with a very nice half-dome! First, I tried the usual suspects of deleting every turret flag and turning off multiple AI flags. Luckily or unluckily the flags were not the issue and the station remained dormant. Well, I figured we could try another rather fun test of deleting every single script file in FotG. Fortunately for the scripts their absence did not fix the issue, but unfortunately for me I still had no idea why it was not firing. VS Studio beckoned, and I got the debugger fired up, checking every early return in the turret functions, though that was a bit messy given there were over 50 turrets. After making a custom model and ship entry with just 1 turret, the debugging revealed FoV checks were always returning false...FoV though was printing at 1, which I incorrectly thought was a full FoV. Thankfully Asteroth saved me from my naivety and correctly noted that a FoV of 1 means 'this turret can't see anything/can only see directly along the normal'. TIL! But then what awful bug was somehow changing my precisely set FoV from the POF file? Surely it was something deeply ingrained in FSO code, and I hypothesized it was some edge case combination of the massive station size with the high number of turrets...I was preparing another debug dive adventure when I finally thought of the easiest thing to do, and likely what I should have started with--simply look a ship I know the turrets work on. Opened up another Imperial cruiser and took a peak at the turrets. Then I blinked, and noticed, '$fov=120'. Oh no... I had simply the wrong character in the station pof file, it needed to be '$fov=190' not '$fov:190'. Turns out, FSO only checks for '=' and spaces when parsing 'fov', while when parsing 'fvec' or 'ufev' it also properly deals with ':'. Anyhow, got the POF update in the right syntax and the station came back to life with vibrant laser fire that immediately killed me in the test mission. Final step is now just to make a PR so ':' does indeed work for things like '$fov' it ideally spare future modders any similar frustration.
Alas my folly that I hope to spare others from...Got a report that a large Imperial station in FotG was refusing to fire any turrets. Not very Galactic Empire of it... So I started up POF Tools and test mission, thinking a quick easy adventure might await--what a nice thought. In examining the model I could clearly see the FoV was set ('$fov:190') as it was even showing up in POF Tools with a very nice half-dome! First, I tried the usual suspects of deleting every turret flag and turning off multiple AI flags. Luckily or unluckily the flags were not the issue and the station remained dormant. Well, I figured we could try another rather fun test of deleting every single script file in FotG. Fortunately for the scripts their absence did not fix the issue, but unfortunately for me I still had no idea why it was not firing. VS Studio beckoned, and I got the debugger fired up, checking every early return in the turret functions, though that was a bit messy given there were over 50 turrets. After making a custom model and ship entry with just 1 turret, the debugging revealed FoV checks were always returning false...FoV though was printing at 1, which I incorrectly thought was a full FoV. Thankfully Asteroth saved me from my naivety and correctly noted that a FoV of 1 means 'this turret can't see anything/can only see directly along the normal'. TIL! But then what awful bug was somehow changing my precisely set FoV from the POF file? Surely it was something deeply ingrained in FSO code, and I hypothesized it was some edge case combination of the massive station size with the high number of turrets...I was preparing another debug dive adventure when I finally thought of the easiest thing to do, and likely what I should have started with--simply look a ship I know the turrets work on. Opened up another Imperial cruiser and took a peak at the turrets. Then I blinked, and noticed, '$fov=120'. Oh no... I had simply the wrong character in the station pof file, it needed to be '$fov=190' not '$fov:190'. Turns out, FSO only checks for '=' and spaces when parsing 'fov', while when parsing 'fvec' or 'ufev' it also properly deals with ':'. Anyhow, got the POF update in the right syntax and the station came back to life with vibrant laser fire that immediately killed me in the test mission. Final step is now just to make a PR so ':' does indeed work for things like '$fov' it ideally spare future modders any similar frustration.