Tuesday, May 13, 2014

Dev Blog 91 - Refacotoring

Spent some time refactoring the equip code, hopefully to fix the functionality problems, but more so to get an idea of where the problem may be.

While I'm waiting for the results to show up on Google Play I'll be re-cutting the earlier levels.

Update 1 @ 1:45PM: So there's been some puzzling progress. The equip functionality code works for Teli, but apparently doesn't work for the 2 other skins. The code is almost identical for both - the only difference is an additional if statement for the other 2 to check if they've been purchased, which I've confirmed is true and should pass the if statement.

I've added additional debug code to find out if what I just said is true, whether or not the if statement passes. If it does pass the if statement, that's actually bad news since I'll truly have no idea why the 2 skins' code behave differently from Teli's. If it fails, that means that the boolean flag for purchase checking must be altered between where I have debug code tell me it's value, and when the if statement checks it.

Update 2 @ 4:30PM: I cut off the last 30 seconds or so of Level 10 to improve the timing, and after re-playing level 8 I actually couldn't find anything wrong with it. My notes say Notes #20-22 and the last 10 notes are off-timed, but I played 8 several times and couldn't reproduce it. About to address level 6, this might be the hardest one. I'm considering re-cutting it entirely; the problem is everything after Note 39 is off (there's 60 total). Re-cutting the only latter half might not do it.

Update 3 @ 5PM: Out of suspicion, I played level 8 again. I dunno why I didn't hear it earlier, but it's actually pretty off-timed starting after Note #22 until the end. Might re-cut this level entirely as well.

Update 4 @ 10PM: This one bug is damn mind boggling. I've narrowed it down to a single if statement, in fact the if statement I was referring to in update #1.

The reason it's so confusing is because I have a debug log in Update( ) showing me the value of the boolean flag checked in this if statement every frame. It returns true, every frame. Yet somehow, right before the if statement is checked, it's false. There are only two places it's set to false, when it's declared as a variable (which only happens once upon initialization) and if the skin isn't purchased (and that code is only run once). Neither of these take place anywhere near the if statement (in terms of order of execution) which is why it makes zero damn sense.

Either there's some black magic going on, the Devil chose today to screw with me, or I'm seriously dense and can't figure this out. As a work-around I changed the if statement, so instead of checking the boolean flag, it checks the text value of the equip buttons. If the text reads "Equip" then it's eligible to be equipped. Additionally I made sure that the text is only set to "Equip" if the skin's been purchased, otherwise it's "Locked". That way, this still functions as the check for "isPurchased" that the boolean flag was supposed to be. Hopefully this work-around will nix it. I still want to figure out the actual bug though.

No comments:

Post a Comment