Archive for the 'programming' Category

GBA video on You Tube

GBA screen shot (clip from video posted on you tube)

In a previous post, I mentioned an application that I wrote for the Gameboy Advance for Blipfestival 2007. As I mentioned in that post, it’s very similar to the applications that I’ve written for other platforms like the gp2x but found that at 16 MHz writing pixels to the screen is a little crazy.

Anyway… I’ve posted a video of this and plan to get back to other GBA experiments in the not too distant future.

GBA visuals

GBA screen shot GBA screen shot GBA screen shot

(more screen shots here)

For Blip Festival 2007, I was determined to do all of my visuals on game systems rather than using a laptop. My gp2x applications were ready but I wanted to try another platform. Dusted off my Gameboy Advance and thought that due to the fact that just about everyone can get there hands on one of these, it would be a great platform to write some video applications for. I spent the next few weeks reading everything that I could find on the web about GBA programming.

I ended up having several small applications written in time for Blipfestival. They were all written in C. A few use images as sprites but most are my usual style - math. Basically, I write a bunch of equations and map them to a button so that the user can push and choose (or get a random one). Each equation has some variables which are mapped to the D-Pad (Joystick) so that the values change with up/down, right/left.

The GBA uses a 16.78 MHz ARM processor and at that speed it’s kind of crazy to be writing individual pixels to the screen, but something that I wanted to try after doing it with success on the GP2X. I plan to revisit the code for these and see if they can be optimized to the point where others might like playing with them. If not, I’ll try other approaches.

I finally got around to doing some video captures of what I’ve done so far - thanks to Bitshifter for loaning me his TV out adapter. I’ll put them together with some music and post on You Tube later this month.

For now I’ve posted more screen shots on this page.

Pygame Book

I recently Beginning Game Development with Python and Pygame: From Novice to Professional (Beginning from Novice to Professional)reviewed the book “Beginning Game Development with Python and Pygame: From Novice to Professional (Beginning from Novice to Professional)” by Will McGugan at Amazon. If you read my review you’ll see it was somewhat a mixed reaction. I was really hoping to find the perfect book for teaching game programming and while this one is good and covers some interesting topics, I think it may not be as hands on as most students would like. As some of the other reviewers mentioned, they would have liked to see a full working game.

That being said, I was cleaning up my desktop in preparation for going to CA next week and found some code that I was playing with while reading this book. This code comes from Chapter 4 of the book where the author is discussing the pygame.draw functions. Since I’m always playing around with math based visuals, I decided to tweak the examples a bit. These aren’t rocket science or even useful for a game, but give an idea of how you could do visuals with pygame.draw

pygame circles

circleTest.py draws circles across the screen in different directions.

pygame lines

drawingLinesMOD.py draws perspective lines across the screen bobbing to a sine wave.

polygons

polytestRAND.py draws random polygons on the screen - kind of screen saver-ish

So while none of this is ground breaking, I think it shows how you could use Pygame for doing visuals. In fact, about a year ago I was doing that. Dots, Plasmas, Blurs, Rotozooms, etc. but decided to go with C/C++ instead because it was considerably faster on the GP2X which was my target platform. Still, if I can find any of those Pygame demos I’ll post them. Or you can search and find some other ones on the web.

DISLIN, GSL set up

A while back ago I purchased a used copy of “A First Course in Computational Physics and Object-Oriented Programming with C++” by David Yevick and I’m finally getting around to reading it. To follow along one needs to install DISLIN and GSL.

Note that not all of this is free (as in speech, although it is free as in beer), however, I wanted to set it up so that I could read the book.

First off, I was setting this up on my Debian box which uses “etch” and found that (due to licensing, I believe) libmotif3 was not to be found so I ended up enabling the “sarge” repository to get it.

Once everything was installed there’s a few other things to note:

  1. Setting your PATHS. You need to do something like
    export DISLIN=dislin_directory
    in my case that was
    export DISLIN=/usr/local/dislin
    then
    PATH=${PATH}:${DISLIN}/bin
    LD_LIBRARY_PATH=$DISLIN:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH
  2. Write up your source code in your favorite editor and save it. In my case, let’s say it was myFile.cpp
  3. Run the following to compile and link it:
    clink -cpp myFile
    Note that the extension is left off.

Some interesting examples are in the examples directory and can be compiled with:
clink -a exa_c

Lastly, typing: dismanĀ  will launch a manual.

Video of gp2x visual app

gp2x applicationgp2x applicationgp2x application

My first little visual app for the gp2x is kind of in alpha version.

I have about 100 equations programmed into code and the Joystick controls various parameters of each equation. “B” goes to the next equation, “X” to the previous and “A” resets.

Overall, I like it but want to add more functions (of course) since there’s more buttons to press on the gp2x :-)
Last weekend I threw together a quick video - gp2x TV out -> crappy capture card in - showing me playing around with it. Of course the video only shows a few of the tons of possibilites and as usual some parts (those will fine lines especially) do not look so good on YouTube with Flash Video.

That being said - here is a link

There’s more stills here too.

If I get time over the next week, I’ll make another.

sprite calculator for c64 basic

spritecalc01-web.jpg

I was doing some c64 BASIC sprite programming and wanted a way to create the DATA statements for my sprites so I made this. It is just a simple spreadsheet for drawing your sprite (put an x where you want a pixel) and calculating the data.

You can get the files from my site in two flavors:

Note: this spreadsheet was created in OpenOffice and tested on an older copy of Excel at work. I have no idea if it breaks in the latest version.