beerman's blog
New game - GUN BASTARD
With Sheep Snaggers pretty much finished, I've been thinking about how I could have improved the structure of the code. As it stands, it's a pretty horrendous spaghetti mess - I hacked features on pretty much at random, and it shows.
I've come up with a much better design, where the main game loop nice and simple
while running: think() #handles control input and AI update() # move things around render() # draws the end result
and the different game modules each have their own versions of the 3 functions. When I switch game modes, I swap out the function pointers for the relevant module and everything stays inside the one loop, which makes handling game events much cleaner.
In Sheep Snaggers, the attract mode and high score entry each have their own seperate copy of the game loop, which then has to throw events back to the main loop - hideous I know, but that's what happens when you don't plan ahead...
Anyway, to test the new structure out, I needed a nice simple game concept.
Enter GUN BASTARD.
Sticks of joy
We now have rudimentary joystick support!
Don't know if I'll get a chance to add an option to configure the button layout, so for now it's button 1 to thrust, button 2 to fire and button 3 to bomb, which works pretty well with my USB dualshock adapter. I can probably add some kind of config file to set up the buttons, doubt I've got the time to write any UI though.
Steering with the stick feels way more like classic Sinistar, rather than the Asteroids style rotation with the keys.
Gah! part 2
OK, that seems to have fixed it.
Turns out Rabbyt caches textures internally, so just reloading the images for my sprites didn't make any difference.
A little bit of digging around in the source and I managed to work out how to empty the texture cache. Once that was done I just had to refresh the textures for anything already existing and everything was happy again.
Of course, now I've found a new problem. All my sound effects seem to be playing about 0.5 seconds out of sync with the game. Grr...
Gah!
Been adding a few more things in, of which more details later.
Right now, I'm working on being able to switch the game to fullscreen mode.
Switching modes is simple enough, but suddenly all my sprites are rendering as solid white blocks. The only things displaying properly are a couple of things that are dynamically loaded.
Looks like I need to reinitialise all my textures when I switch video mode, which is gonna mean a wee bit of rearchitecture...
Damn!
Sheep Snaggers : Latest update
Ladies and Gentlebeasts. We are now 100% feature complete!
Sheep Snaggers : Status update
Updated the alien generation code. Enemies are no longer spawned en-mass across the map at the start of the game. Instead, they warp in to the base star location every few seconds. Calms things down considerably from before where the deathstar was being completed in seconds.
Need to fine tune the ship handling and fire rate a little, maybe the bullet speed too - right now it's way too easy to hit an alien that's anywhere nearby.
Tweaked the attract screen for added psychedelia - starting to look pretty damn good :D
Next job is either enemy fighters or a deathstar that's actually dangerous. Reckon I need to equip it with some suitably scary weaponry.
Sheep Snaggers : The sound of mooosic
Originally posted at http://postcardstohell.livejournal.com/70413.html
Got another nice lengthy update session in today.
We now have audio! For now, I'm using a bunch of free sounds from soundsnap.com as placeholders. Hopefully I can knock up some original ones before I get finished.
I've also hacked together a basic attract mode / high score table, which isn't looking too shabby.
Sheep Snaggers : because gun rhymes with FUN!
Originally posted at http://postcardstohell.livejournal.com/70178.html
Finally got weapons implemented tonight :D
Now I can finally defend the sheepies against the evil aliens. It's actually starting to feel like a game now :D
Next up, I want some enemies that shoot back, then it's time to activate the dreaded MarkieStar!
Once all that's done, all that's left is the polish. Menus, high scores, level balancing, attract mode. Sound might be good...
Sheep Snaggers : performance anxiety
Originally posted at http://postcardstohell.livejournal.com/70031.html
I'm sick of referring to this project as "my RV game project", so I'm officially making Sheep Snaggers at least a working title. Cheers, Amy!
Got the AI to a point that I'm pretty much happy with now. The sheep flock relatively convincingly, and the aliens hunt them quite nicely.
Unfortunately, the sheep AI is now crippling perfomance. The sweet spot for staying above 60fps looks to be around 20 sheep in my world, which kind of sucks.
Day 3 status update
Originally posted at http://postcardstohell.livejournal.com/69660.html
Had to go into town and see about changing banks today, so I didn't get as much done.
Wasn't entirely happy with the state-based sheep AI, so I switched it out for a simple flocking system. Avoidance behaviour is working pretty well - I can herd individual sheepies around with my ship pretty well - but they don't really flock yet.
I need to adjust how the enemy ships work too - they're *way* too efficient early on, then they get rubbish at hunting once the sheep are more spread out. I'm using a half-assed drunkard's walk algorithm at the minute(follow random vector for random time), switching to single-minded pursuit once a sheep comes into range. This kind of sucks on two levels - the random walk never really travels much of the world, and the chase mode is way to accurate to give the sheep a chance to escape.
Hopefully I can get the wrinkles ironed out of the behaviours sometime tomorrow so I can get on to adding the shooty parts.