Wednesday, January 18, 2012

Bugs at night

I am not sure about any of you coders out there. But for me i hate getting bugs in the middle of the night. Cos there i am last night after watching a movie that was a bit drab tbh (Intacto). A nicely made film, but on a subject i find a bit incredulous i suppose.. Still that took an hour and 45 minutes of my free time up and so left me to start late on coding for Bob the Frog.

It must have been around 11:30pm when i started coding and the aim was to implement the features i had put into the editor the night before. These features allow me to set/edit certain values to make the elements like platforms in the game do a circle or move a platform back and for. Then control the distance and speed of those movements. Anyway it did not take long to get coded in, maybe 15 minutes or so, though in real time it took a whopping 1 hour 15 minutes. That is because in the background i got into a battleground in Wow cos i had just missed Tol Barad. I was thrust into an Isle of conquest and that game went all turtle and ended up lasting an hour. Though it was truly a fun hour and i accumulated 210 kills and 1 death, also was top healer with 8.9 million healed  :O  Shocking eh!....

Oh yes, back to the story. So after we won the battle it was getting late and so i closed down Wow and focused on creating a nice level with circulating platforms etc. It was while iw as testing this new level that the crucial bad bug decided to rear its ugly head. Bob fell through a platform... GAH!  I was shocked, surely i must be mistaken. But no, i was not. Upong further testing i could see that vertically moving platforms were an issue. So then it was time to figure out the bug, which did not take long. Only i wasn't quite sure of the best way to solve the issue.

I have a collision routine that Bob runs in his update, and that checks to see if he has landed on a platform while bouncing around etc. Well, the bug was simply becasue the platform could move upwards from next to Bobs feet, after his check was done, effectively moving past his detection. simple enough for sure. So my first thought was to write another collision routine from the platforms to Bob, but i hated this immediately. I have had enough practice to know that spreading various collision routines around does not make things easier, in fact it can end up being a right muddle of contrasting collision views from the code (more bugs will ensue!). So then i figured i needed to make the single collision function i have from Bob to the platforms take into account their movement. Something i had not needed previously.

It was rather easy to solve this issue once i had made this decision, still the hands of the clock were still turning and now it was about 1:35am. Getting late for sure as i have a day job :O  I did have trouble with my 'If' statement being just the correct way around to work however and i reckon that trying to solve that bit of code in the wee hours of the morning certainly delayed me going to bed. I was in fact about to give up when i solved the issue and Bob stopped falling through the platforms altogether.

In hindsight, i probably should have gone to bed at a reasonable time and sorted it tonight.

So killing bugs in the middle of the night is slow going, mentally. I'll try ahrder not to do that again, though i am sure it will happen.

Da Voodoochief

No comments:

Post a Comment