Thursday, December 22, 2011

Actually some progress: Or I how I stoped worrying about variable corruption and learned to love the global

Yeah I finally got a fire lit under me. This fire got me to open up this old project and fix some bugs. Was a simple bug but how I got to it was something new.

So python and my monstrous amount of comments wasn't helping me and I needed some variable output. I however did not want to comment out all my debug prints, I've been doing that at work stead and didn't want to continue the practice at home. Realizing that I had an option of making a method to do print  outs and just comment out the print there but would be cumbersome and possibly require some debugging itself and smart passing or something I heavily avoided in the past, global variables. Global variables must have bitten me hard at some point in the past but how I don't' remember the specifics. Effectively Global variables does what the box says, makes a variable global, this means you global i here and you change it there, the i will be the changed version later. This can easily lead to variables causing unexpected bugs as you made a temporary variable that shared the same name without realizing it.

With this in mind debug_print_variable came to mind and I slapped it down in front of every method in my level class. Checkign when things were added and when things were moved, all the fun stuff that leads to bugs. Within the first running I realized the problem. The bug of the player character hitting themselves was caused by them being initiated at the start area and then the reset function move the player to it's starting position which cuases the "attack" event to replace the move. Since the player was at the starting position I never noticed this. So good success for "bad" programing practices.

Next up I'll have to figure out what to do next with it. Maybe add a weapon upgrade to pick up.

Tuesday, December 20, 2011

Revenge of the math

Some things just come back and bite you. The past few days I've felt the sting of things I've forgoten or ignored.

I'm horrid at math. Supposedly this is rare in computer science things but I just am. Through school I've generally programmed a calculator, which surprisingly I was allowed to get away with as somehow I knew the things by being able to program them, and just avoided those classes. College I jumped to a related degree that just plain had less math.

Last few days we needed some more graphical things set up. That required lines drawn between nearly the shortest points of some lines and some points, in other words everything I've been avoiding. The crash course has went alright, as this is not completely needed to be automated some corner cutting is needed but it is sad I've spent a lot of the past two days failing at math instead of being stuck on a programing problem. But I suppose that's life.

Wednesday, December 14, 2011

Still kicking post trip

Oh boy I haven't put anything up here in a while. I do have half an excuse though. Last week I was a timezone and a few states away from training and this week I have had work to deal with. The trip was interesting and we arrived in a below zero blizzard. Warmed up later though, other than that nothing to say beyond being somewhere else will ruin your ability to game as much as missing a flight home. That was an interesting 16 hours. For now though I still need to recover some more and get used to being in my native time zone and native work load.