sheep snaggers 2
SS2 : Update
The updated version of Sheep Snaggers 2 is now available for download.
As well as the performance fix for the schoolboy error in the original release, I also corrected a major oversight in the original game.
One of the first questions I was asked when demoing it at Retrovision was "why can't you shoot Markie up the arse?" Seems obvious in retrospect, but somehow during development it never occured to me!
This shameful faux-pas has now been corrected - although in the interests of balance you'll have to deal with Markie's newly acquired rear defenses...
Yes. Yes I did go there.
Pygame input wrapper
As originally discussed in Keeping Control, I built a fairly handy wrapper class for handling player input in Sheep Snaggers 2. Now that the game is finished, I'm happy enough with the wrapper code to release it into the wild in the hope that someone else might find it useful.
Basically it abstracts out the various keyboard/mouse/controller functions by mapping them to a set of named controls. Each control can map to more than one input format so the core game logic doesn't have to know what controller you're using, it just asks the input module if e.g. a 'FIRE' event happened this frame.
You can find the source code along with a simple example here, or in the sidebar under 'Other Stuff'. The code is released under the Beerware license, so if you like it, why not buy me a pint?
Found the problem
I finally got around to sitting down and taking a look at the performance problems with Sheep Snaggers 2 tonight. A 5 minute run with profiling switched on pointed me right to the middle of my font handling routine where I found this:

Post Mortem : Sheep Snaggers 2
I released Sheep Snaggers 2 on Friday at Retrovision 2011, to what was overall a pretty good reception. All being well, I'm hoping for a fairly positive writeup in the Retrogamer review of the event.
The high score competition I had running over the weekend was popular, though made somewhat more difficult than anticipated by the fairly low-end laptops available to play it on - I didn't pay a great deal of attention to performance optimisation so when it landed on a machine with 32MB of shared video RAM there were... issues.
Luckily I managed to source an alternative machine which left the game playable with only occasional slowdown, but I'm not entirely happy. At the end of the day it's only a bloody Defender clone; there's really no excuse for it to not run on damn near any hardware you can throw at it, so I'm planning to spend a little time sharpening up the performance before I move on to my next project.
Retrogamer's article on the event should be hitting the stands around the middle of next month, so that seems like a reasonable short term deadline to get a version 1.1 together and iron out some of the speed issues before that hopefully points some more attention this way
So, the plan.
I'll probably need to spend some time profiling to be certain, but I'm pretty sure the biggest problem is that I'm being incredibly lazy with my texture memory usage. I've got limited spritesheet support in there for some of the animations, but for the most part it's one texture per sprite. Worse, for some of the font routines I'm generating one texture per combination of character/font/size.
Since my development system has 96 cores and a gig of video RAM, that's not really something that's been an issue for me, but I should probably look into addressing it. First on the list there should be packing all my graphics into as few textures as possible, which may mean finally venturing into writing my own development tools. Nothing fancy, just something that takes a folder of PNG files and turns them into packed images and a handy code file with all the texture coordinates in - something along the lines of:
{
#use the original filename as a key to the texture dictionary
#cuts down on the amount changes needed to the existing code
#and makes it easy to cross reference with the original unpacked sprites
"alien1.png" : {
"texture" : "texturemap1.png",
"tex_shape" : [0,1,1,0],
"shape" : [-50,50,50,-50]
}
}
With that done, it won't need a massive amount of work to update my drawing routines to load sprites from the packed textures rather than individual files.
The next (and possibly much bigger) problem is the fonts. Right now I have a kind of hybrid system that sometimes generates textures for individual characters (e.g. in the high score counter) and sometimes for entire phrases (like the "SHEEPIE SAVE" message). It would probably help if I defined these up-front rather than building them on the fly as the game runs just because I'm lazy. One texture per font and a couple of special cases for the floating messages shouldn't really be all that much work.
Hopefully, by the time I've got those out of the way I should have managed to come up with a few ideas to play with for my next project.
SS2 : Right down to the wire
Finally finished coding on Sheep Snaggers 2. Been a bit of a hectic week, not helped by me being struck down by the dreaded Man Flu.
I spent most of today alternately between dozing on the couch (that damn man Flu again), deciding I was all done, and thinking "crap, I missed a bit" and coding frantically to implement piddly unimportant features like having more than one life... All done now though, and I'm pretty pleased with the end result.
The final build is uploading now. I'll be putting the download link live sometime tomorrow after the official launch at Retrovision 2011. Watch this space!
SS2 : 4 days remaining
Not long left now. The official Sheep Snaggers 2 release is at Retrovision on Friday - I'll be putting it up for download for those of you that can't make it - and it looks like I'm gonna be coding right up to the wire.
Gameplay-wise, everything's in there and working (as seen in the last update). I've just got the usual last-minute tweaks and "boring bits" to finish off - fixing up the menus, redefinable controls (maybe), but mainly a bit of playing with the difficulty curve.
SS2 : Feature complete
I've had a fairly busy week here at the beercave. Pretty much all the vital gameplay elements for Sheep Snaggers 2 are now in place. Check out the video below of me playing through a full game.
Things I've been doing recently
Avid readers might have noticed I've been a bit on the quiet side lately. A pretty major software release at the day job has been sucking up all my available brainpower for the last few weeks, which hasn't left me with anything much in the tank for Beercave-related projects.
That all seems to be calming down a little now, so with any luck I should be able to get things back up to speed, so with 10 more weeks till RV there's still plenty of time to get things polished up and finished off.
End of month 1 update.
It's been a couple of weeks since I posted last so I figured it was time for an update on the current state of Sheep Snaggers 2.
Right now, the game is fully playable, if not anywhere near complete. The engine work is all pretty much done now so from here on in I should be able to focus on nothing but gameplay. Which is nice.
Here's where I was at the end of last week.
SS2 : All systems go
It's coming to the end of the first week of the newly restarted Sheep Snaggers 2, and so far things are going pretty well.
Once I decided to ditch the old codebase and start from scratch, I managed to make some pretty decent progress on the new stuff.
Here's the first test of the sprite system:

Which pretty quickly turned into this
