Just Us

Dirty Diapers and Life…

Froggix 1.0

March30

So in my spare time I decided to tackle another fun project to brush up my programming skills.  It had been a bit of time since I had done some C work so I decided to tackle SDL and C by creating a clone of the classic Frogger designed to run in Linux, titled Froggix.

This is a first rough “release” of sorts.  All of the basic game play is there.  You can dodge cars, ride logs and turtles, reach the goal and advance levels with increasing difficulty.  There is a lot that is not implemented as well as a number of bugs.  Since this is really a work in progress please bear with me.  I know there’s no game over screen, the score flickers and in the Win32 compile there’s no score at all displayed and when you get the frog in a goal there’s no indication aside from the happy frog — oh and after starting a new game some variables such as the frogs in the goals don’t get reset, the free life doesn’t get reset and the speed of the first row of cars never resets on a new game either.  I am sure this is a short list of bugs.

As far as yet-to-be-implemented, there is no snake, alligators, badgers or flies.  I also need to improve some of the game play.  Frogger is very sensitive to cars, if he gets anywhere near one he dies, but as far as jumping on turtles and logs, he can have a toe on the edge of the log and be safe.  So there is work yet to do.  There is also no 2 player mode, regardless of what the title screen says.  There is also a fair amount of information being dumped to STDOUT and STDERR that can safely ignored.

The Windows version runs in XP under VMware, that is as far as my testing went.  It was compiled using mingw cross compile libraries on an Ubuntu 8.10 system.  There is also no Windows installer for Froggix.  Just unzip it and double click on ‘froggix.exe’.  Windows includes all the necessary SDL libraries, which is why the binary download is much larger than the Linux version.

If compiling from source a simple, ./configure && make will do the trick.  You do need the SDL libraries as well as SDL_image, SDL_ttf and SDL_mixer.  Also move ~/src/froggix up one directory so it finds it’s sounds, fonts and graphics.  There is a warning while compiling about ‘VERSION’ being declared twice, this can be safely ignored.  If compiling for Windows, using the convieniently included ‘cross-configure.sh’ and ‘cross-make.sh’ should do the trick if the mingw and SDL environments for cross compiling are in place.  I have never compiled this directly under Windows, but I would assume the same environment in cygwin is necessary.

Everything is rough around the edges on this release, even the method I’m releasing.  But please feel free to comment or e-mail me.

The screen shots in this post are all taken from the Linux version of the game.  The only major difference with the Win32 release is the lack of the score being displayed; score is being kept in the background.

I would consider porting this to MacOS X but my only access to a OS X system is via really, really old 400MHz G3 system that after a few days of compiling never was able to get a fully development environment built.  One day I’ll try and tackle this again.

Btw, this post is the docs for the project thus far.  That’s weak, I know.  Here are the files:

Linux Binary:

froggix-bin-1.0.tar.gz MD5: 5dc8a489bff00fc7227ad489dfda9d90

Windows Binary:

froggix-win32-1.0.zip MD5: 07cb1e398cb93399e7dafa962567bb1a

Source:

froggix-src-1.0.tar.gz MD5: a30cdc6f0b2346a91d066a3e29b305fd

posted under Programming | 1 Comment »

Gimp Plug-in for Guides

January26

I am currently working on a small OpenGL program for my son to play with.  In the course of writing this I came across some issues with my textures.  I ended up with quite a few textures, each in it’s own file.  Management and load times were hindered by this.  So taking a recommendation given to me I combined them all in to a few texture maps instead.  Dealing with these maps is a lot easier if each “cell” is the same size or X sells combined for a single texture.  The images are quite large and I needed to create a ton of guide lines in GIMP to handle this.  It’s a PITA to go and create each individual one for each texture map so I ended up creating a small GIMP Script-Fu plug-in to generate these guidelines for me.

It works very simply by taking two parameters, Horizontal/Vertical lines and the distance to space them apart.  It’s now a world easier to manage each individual texture within the larger texture map file.

It’s simple to install. Download the file:

guides-every-x-pixel.scm

And copy it to ‘~/gimp-2.x/scripts’.  This will automatically be picked up by GIMP when it’s started or if it’s already running the scripts can be refreshed form the GIMP menus, ‘Filters’->’Script-Fu’->’Refresh Scripts’.

To access the script, from the GIMP menus ‘Image’->’Guides’->’New Guides Every X Pixels’.  The dialog will appear and you’re all set.

I also have this posted on the GIMP plug-in registry here:

http://registry.gimp.org/node/13774

PerlMan!

January19

PerlMan is a Pac-Man clone I started to write back in late 2006 in my spare time.  I was interested in learning SDL Perl and interested in writing a game.  So I figured I would tackle Pac-Man as it hits on a number of classic gaming styles.  Character collision detection, environment collision and basic AI.

Unfortunately the code is slow.  I am not certain I am doing the collision detection quite right, it works but eats up the processor.  I am having difficulty keeping the speed steady and the AI for the ghosts seem CPU intensive and extremely poor.  I also don’t think I quite implemented the maze properly.  I am not a game programmer and tackled this without reading up on anything except for SDL Perl use.

There is a ton of debugging information available, in the code included at the end of this post I have it disabled.  It can be enabled from within the code easily and each debugging option is documented.

As of right now there are no power pellets and actually no way for a ghost to ‘kill’ Perlman; they’ll just pass through each other.  Also the warp tunnels are not implemented allowing Perlman to wander off the screen.

I would like to eventually spend some more time on this and get it working well enough to play.  For now this is what I have.

To run the game all that is needed is Perl, which all major Linux distributions include and the SDL Perl bindings.  For Debian-based distros (Ubuntu) ‘apt-get install libsdl-perl’ will do the trick.  This should also run in OS X and Windows with the proper Perl environments.  I have neither of those to test on though.

perlman-011909.tar.bz2 MD5: 95406e07b847bd8da117d5cc60541c14
perlman-011909.tar.gz MD5: 84a47b9e32f7749cb5756da19f92b302
perlman-011909.zip MD5: d8cf5157ae934b5bb2da14bcfb092ff3

The Funnies

December28

Each morning I read the comics.  Since I don’t get the newspaper every day I generally would view them online.  However, each comic is on a different page and I would have a list of bookmarks for my favorite strips.  To make it easier I wrote up a small Perl script that reads a configuration file and uses that to fetch the comic strip off the website.  The script was mostly written during my spare time at work and was never meant to be ran by anyone but myself.  So I apologize for some sloppy code that lacks comments.  But if anyone is interested I attached the files below.

To get it running you need Perl, wget and imagemagick.  I use imagemagick to convert all the downloaded comics to JPGs since many are GIFs.  I did this because the proxy server at my old job would sometimes have difficulty with GIF images and they wouldn’t fullyl download.  The only changes that need to be made is the path that is set in ‘comics.conf’.  Then run the script and it will create directories ‘images’ and ‘indexes’.  The index file for today’s comics are stored in there.  It can be ran locally on your desktop from your home directory or on a web server.  I do both.

comics-ss

It currently supports the following comics, “Andy Capp”, “User Friendly”, “Baby Blues”, “Luann”, “For Better or for Worse”, “Dilbert”, “Garfield”, “Wizard of ID”, “Ziggy”, “Stone Soup”, “Momma”, “Rose Is Rose”, “Peanuts”, and “xkcd”.

To remove a comic simply delete or comment out the line with a ‘#’ sign.  To add more comics you will need to supply the name, website, and a regex to grab for the comic image itself to download.   So it pretty much grabs the index file for the comic, searches it with the regex and if it finds the image it fetches that image and stores it.  If there are any problems the comic index page will reflect the error.

Any feedback is welcomed and I’ll be happy to take a few requests to add comics to the configuration and post them here.

comics.tar.gz MD5: ac626845a398999e0cbbf8576fc4cca3
comicFetch    MD5: 9ce0a4de874305964367fd29b7783d55
comics.conf   MD5: 174c45258aba2a0a07f0c3dc3a2923fc
posted under Programming | 1 Comment »