Monday 16 September 2013

Progress on Piggy Petter Alpha - Sort of

This weekend I made a lot of progress on an early alpha of Piggy Petter, by which I mean nothing about it changed.  When the weekend started I had a browser based game where you could pet a piggy to gain imagination and spend imagination to learn two different skills that affected how the game played.  At the end of the weekend I had the same thing except that one of the skills no longer had a game effect.  Progress!

What I did this weekend was eliminated a lot of lines of code that could be written better and that were actively doing nothing and rewrote the better half of my animation code.  The piggy will no longer risk blinking out of existence if there is an internet hiccup when he is turning around - loading one larger sprite sheet seemed a lot better than repeatedly loading multiple smaller ones unless the large one is really large, which is it not in the case of the piggy.

I've done nearly all I can with rewriting the code for now.  I still find that javascript does some things I don't understand and that sometimes I write something that looks like it should work to me but ends up not working at all, only to work when I change something that doesn't seem to make it any different.  I honestly think that in one case it was javascript behaving insanely, but there are really things I think I just don't get.

As always, my problem with coding is wanting to have perfect code.  Of course my code is very far from perfect, especially by the criteria that code ought to be judged on, but I have this concept in my head about how programs should work.  It's not based on efficiency as real world applications should be, but instead on a pure-math aesthetic.  It's not whether you win, but how.

Of course with an interpreted language this is even more stupid than it is with a compiled one.  Optimizing for compilers is a real thing for sure, and it's a skill I certainly don't have, but when the full text of your code is going to have to be read every single time it executes - and people are going to have to download the code over the internet every time they want to use it - it seems extra important to cut that code down.

All that said, I hope to have something to show you soon, though the definition of soon here is totally up in the air.

2 comments:

  1. I can remember a CS130 or CS134 assignment in Pascal that didn't work and I didn't understand why it didn't work. Eventually I added in a comment and that made it work. A comment. Something the compiler should never see.

    I ended up going outside and running laps around MC screaming my head off at 3 in the morning when it happened.

    ReplyDelete
  2. Oh, I forgot about that, I had one moment where I got something to work by removing a comment in the html. Rather than deleting a script /script section I had commented it out - as people are wont to do.

    Chrome was telling me there was an error on one of those lines and I thought, "Well of course there is, I commented it out for a reason." I understand that if you put !-- tag inside a javascript, the script will just ignore it, but if it is surround the script tags, shouldn't it stop the script from being recognized in the first place?

    ReplyDelete