Phil Hassey - game dev blog
Phil Hassey as Snidely Whiplash
"You can't buy awesomeness.
You're born that way."

Archive for the 'testing' Category

Seahorse Adventures – Loading TGAs (and more)

Tuesday, January 5th, 2010

Here’s a screenshot.  This is my Ubuntu desktop of my work on a new iPhone game.  Take a look at it nice and big.  Below I’ll explain all of what is going on …

bsa_dev1

In short, I’m working on porting my pyweek#3 team entry to the iPhone.  Here’s the details:

  • Top left, you see Kate, my text editor.  You’ll notice I’ve got -what appears- to be python.  But that’s actually tinypyC++ code!  My converter still has some rough edges, but it’s starting to get pretty good.  If you weren’t looking to closely you might mistake that for ordinary python code!  (In fact, it should be 100% python parser friendly.)  You can see how I have to use a touch of annotation to make it all go.  But for the most part, the types get inferred.  (The C++ outputted is about 2x as long, so I’m saving a ton of keystrokes!)
  • Top right, you see the level being painted.  It isn’t all working yet, but those are the basic tiles.  Interesting bit about loading the level, when I created this game I used my own level editor and library I made with pygame.  To save on disk and time I save all the levels to .tga files.  Since I’m targeting the iPhone I need an easy way to read the data from .tga files.  I don’t have SDL_image available, so a friend pointed me towards this great site.  It appears to have some awesome bits of code, including very simple and easy to use image loader that can load tga/png/jpg/etc.  I think it has the most painless interface I’ve ever seen for a C-based image-loader.
  • Bottom right you can see me working on tinypyC++.  As I’m working on BSA, I’m always finding new bugs in it.  Lately most of the bugs have been of the “add more graceful error handling” nature.  tinypy will point out what line (and character) an error happened on, but with a bit of extra work I’m able to add in some coherent error messages to tell the user what is going on.  In this case it was to inform the user of an undefined module name.
  • Bottom left you can see the startup of the game.  I’m using irrKlang for all my  game audio now.  It is not open source, but it’s “free” to use for free games, and the price is quite reasonable for commercial projects.  irrKlang is not portable to the iPhone yet, so I have to have a separate driver for my iPhone audio.

And that’s it for today’s report!

-Phil

iGalcon + enet = Multi-Player fun fun fun

Thursday, July 31st, 2008

So .. not being in python-land I really didn’t feel like reinventing the networking-wheel this time.  So I grabbed enet for this project and it rocks.  I had no notable trouble (beyond normal laziness when it comes to reading documentation) getting it up and running.  And after I got it going nicely in my linux environment, it worked out-of-the-box for compiling to the iphone 🙂  Thanks to lack of endian issues, I didn’t have any trouble there either!  Here’s the screenie:

On my TODO list is:

  • Add Settings (Sound effects on/off, favorite colors for MP game, user / password login for MP game)
  • Add Server List (must figure out how to do HTTP requests from C with minimal strain)
  • A bit more testing and some odds-n-ends

I hope to have it all done soonish!

On a development-side note, I implemented some automated testing of the network code.  This saves me from having to run over a dozen use-cases any time I mess with the client-server code.  So it’s saved me a bit of time, and given me that great “feels like it will work” feeling.

out of control!!!!

Tuesday, October 9th, 2007

Maybe it’s overkill… But I just wrote a class named “test_testtest” to test the “testtest” function which I will be using to test test generators that are for testing stuff.

TDD part 2

Wednesday, October 3rd, 2007

I’ve been using it for the past week to great success. I’ve found my test suite frequently finds tiny bugs that I add in by accident when adding in new features. It’s great having those bugs found and fixed immediately 🙂

I’m using TDD right now for building a PHP library which will be the core of a new medical records system. In the future it will be interesting to try it with a game. I don’t believe it would be useful for all aspects of game development, but if I rewrote the Galcon “core” or the Galcon network library, I think TDD would be quite useful in that case.

test driven development

Tuesday, September 25th, 2007

I’ve taken my first plunge into TDD today. Yesterday I read (skimmed) the book Test Driven Development by Example by Kent Beck. In the second section of the book Kent gave a step by step example of how to develop the xUnit testing framework in python. At the end of the section he recommended implementing your own version of xUnit for whatever language you will be testing so you can learn the methodology.

I considered using some of the existing PHP testing frameworks – but they were all rather large (>100k) and both included a lot of features I couldn’t see myself using. So I forged ahead with Kent’s advice and wrote my own testing framework, which I named “Testing”. The final results are:

testing.php – 2440 bytes – the Testing class
tests.php – 2508 bytes – the tests for testing the Testing class (say that 5x fast!)
run.php – 161 bytes – a couple lines of php to run the Testing tests

It was a challenging task, as I’ve not done TDD before, and I found it took me about 3-4 tries to actually “get it”. The first few times I just scrabbled at not knowing where to start. The 3rd time I ended up implementing the Testing class “the old fashioned way” – but then realized I was supposed to be using TDD – so I reimplemented it using TDD. The interesting bit is that by reimplementing it using TDD I was forced to make my testing framework testable – so I had to add in logging facilities early on in the process. I also uncovered several bugs while re-writing it.

All in all, it seems like TDD will be a useful tool in the project I’m working on – will keep you posted.