Monthly Archives: August 2008

Yes, you know you’re a geek when you see a book about statistics and you get excited.  Then again, all the Head First books are teh AWESOME.

I often try to communicate to my students that development can be a slow process sometimes, recounting stories about “bad days” when you change only a single line of code.  Well today we actually had one of those days.  Logan, a co-worker of mine did most of the grueling investigation and eventually found out that

TCPSocket.do_not_reverse_lookup=true

makes FTP connections on Windows not suck (ala 6 second delay on each request).  At least I’m pretty sure there’s no bugs hiding in that one line of code.  We’ll add some tests just to be sure.

When we all have camera phones its humorous how quickly something in the office becomes a demotivator.

I was a presenter at the first Ignite Phoenix event, held last Tuesday at the Jobbing.com office.  The video (split into two parts) is posted at ustream.tv

My presentation was in the first half and starts at 36:40.

Slides can be found here

So much has changed since my last update.  First off, we’ve created a system for managers to be plugged into the basic game state.  The three core managers are game object, update and render.  The default versions of these three get auto-added to a game state unless you specify your own to use.

Why might this be useful or interesting you ask?  Well consider the problem of one behavior we were working on.  CollidableWhenMoving hooks into a game object’s move method using on_after_move.  The behavior then needs to check the object that just moved against anything it might have collided with.  There’s a basic behavior (BoundingBoxCollidable) that does the actual coordinate checking, but CollidableWhenMoving still needs to get a list of other game objects to check against.  Previously, the behavior was keeping an internal list of objects it had been added to.  This sort of worked, except that it used class level variables which really breaks down if you want to be able to pause, swap to another state for a while and then come back.  Also, other collision’ish behaviors would have to maintain their own lists of game objects and there was no way to share those lists so CollidableWhenMoving could only collide with other CollidableWhenMoving objects.  Oh, and it was also an ugly hack.

So the answer was clear, we needed a way for behaviors to generically get information.  This evolved into the idea of a state having some number of managers that could provide that information.  So now after the movement of a game object, CollidableWhenMoving can query the GameObjectManager registered on the state and ask it for an appropriate list of objects to check against.

Another big improvement was the idea that behaviors should be able to be used as interfaces.  So kind_of? was enhanced to check against behaviors as well.  Also a new behavior class method: depends_on_kind_of was added to allow a behavior to express the need for another behavior witout having to specify the type.  Unlike depends_on, the depends_on_kind_of method does not require or add any dependant behaviors, it simply sets up a instantiation check that will raise an exception if there is not a sub-class of the declared behavior on the object.  This allows you to depend on some kind of algorithm object, even though you don’t care which one.

The keymap concept has been enhanced to give you some fairly nice syntax for setting up input processing. Here’s the keymap file for the example pong-like game.

map KEY_HELD, :source_value => Input::KEY_Q, :destination_type => :p1_paddle_movement, :destination_value => :up
map KEY_HELD, :source_value => Input::KEY_A, :destination_type => :p1_paddle_movement, :destination_value => :down
map KEY_HELD, :source_value => Input::KEY_O, :destination_type => :p2_paddle_movement, :destination_value => :up
map KEY_HELD, :source_value => Input::KEY_L, :destination_type => :p2_paddle_movement, :destination_value => :down

The destination_type and destination_value are totally arbitrary and should be customized to make sense for each particular game.  Other supported input map types are key_pressed, key_released, mouse_moved and mouse_button_pressed/released.

Finally, we’ve split out the example game into the examples directory.  It’s now an actual game with animating sprites, scores and two player controls.

I’ve had a very hard time coming up with anything resembling a logo for my GUI library Monkeybars. So I was amused when James Britt, a co-worker at Happy Camper Studios, came up with this.

Perhaps not somthing to go on the Monkeybars home page, but amusing none-the-less.  I wonder what the portait for something like Spring, or Rails or JEE would look like?