Category Archives: What?!

RC Car no longer under your control.

I’m in the middle of reading MSP430 Microcontroller Basics, which I’d picked up for some insight into the inner workings of the MSP430 line from Texas Instruments (especially the MSP30G2231, one of the controllers included with the Launchpad Emulator board). Unfortunately this coincides with a lot of overnight work at the office, so I’m still making progress (albeit slowly) with the RC Car modification and rebuild.

Patrolling a messy desk.

In the past few weeks, I’ve done a bit of work/learning with a couple of Parallax sensors  – namely the PIR and the PING. I’ve ripped out the stock board and replaced it with a SN754410E Quad half H-bridge, and began cleaning up some of the poor solder joints. More on all of this in a few weeks, but in the meantime let’s tryout my new Toshiba Camileo X30 (sorry about the low light) and Cinelerra, and look at using the MSP430’s TimerA for pulse width modulation:

More in a few weeks…

Java Circuit Simulator

While looking for HackerSpaces in my area, I came across the Philadelphia HackerSpace Hive76. Apparently the group has an Art of Electronics class, and while looking through their wiki – I found an excellent Java applet that gives examples as to how many common circuits work.

Circuit Simulator: That's where my electrons went.

Thanks to Hive76 for linking to this electronics resource. Paul Falstad has done a great job putting this simulator together, I definitely recommend it.

The Great Internet Migratory Box Of Electronics Junk: Excavating a box.

I recently received a Great Internet Migratory Box of Electronics Junk (man is that hard to say in the proper order).

The rules are simple: Sign up for a box (or start your own), dig through it and document (in some form) what you’ve taken  from the box and what you’re doing with it, and ship it off to the next person in line. I feel bad that I’ve been sitting on this box for longer than I should have (normally no more than 7-14 days)… but with work, other projects, a house, and not enough sleep lately, progress has been a bit slow. (My apologies)

Let’s go digging:

I’ve found some use already with large capacitors and solenoids (and my Electronics Learning lab kit)… and a small handful of other parts are going into an upcoming project that I plan on writing up (that’ll happen soon). Adding  a few items to the box, and off to the post-office on Monday to keep this thing in circulation.

Video Game Creation using Blender, Gimp, and Allegro

I had an enjoyable assignment in a college course on the C language the other day – using the Allegro libraries, write a game of your choosing.

The assignment coincided with my recent discovery of Blender, the 3D mesh animation and design tool. Out of boredom on a recent weekend afternoon, I found Blender in a series of random Google searches… and dedicated the better part of 3 weeks teaching myself the ins and outs. (Surprisingly EVERYONE I know already knew about it, I’m not sure how Blender eluded my radar).

The entire movie Big Buck Bunny was created in Blender

So many people are familar with Blender  in fact, that there are hundreds of YouTube videos (and even  DVDs) covering practically anything you’re looking to do.

My first job was to model an alien – one similar to one of the enemies in a great game from my childhood – Commander Keen. (Side note: I first got the game from one of the many mail-order shareware companies that were popular before the Internet was in practically every home.)

Simple enough, the Alien is basically 3 spheres and 2 cylinders. After 30 or so iterations, I finally had one I liked.

My inspiration (from Commander Keen)
My Tribute to Commander Keen

Learning to paint took about 2 days of watching video after video trying to figure things out. Part of that time was devoted to me hunting down the cause of  a “bug”, which I later learned was a default setting in vertex paint.

This is not a boog.
With the Painting Mask enabled (the 'F' key)

The freenode #blender channel had plenty of knowledgeable users that convinced me that I wasn’t dealing with a bug in my install

Probably the best thing about Blender is that even I (having no real graphical talents), was able to create a decent looking object with a small amount of effort. And  I could then animate it, using armatures and a tutorial by Ira Krakow.

Citronella is Evil: The Action Editor and Timeline

After creating a few other random objects (some of which looked just plain pathetic), I ended up with a small stable of characters – and thankfully an assignment where they could live.

The Allegro programming library is a well documented, easy to use programming library that handles the tough parts of graphics programming – getting objects onto the screen. As with everything – where does one start?

Having two weeks to start and finish a game, I decided another childhood staple would be the perfect game to write – Jetpack.

Just a fun game.

Jetpack had a lot of great things going for it – fun game, re-playable (especially since it had a built in level editor) , and one of my favorite things – a jetpack. Jetpack could easily be thought of as Lode Runner with the ability to fly.

XScavenger is a fun Linux port of Lode Runner

While digging through Allegro’s online manual and chatting with other users on freenode (trying to  figure out how I could write this thing), my storyline inspiration played on my Last.FM stream – “Let’s save Tony Orlando’s House“, a great song by Yo La Tengo about Frankie Valli setting fire to  Tony Orlando’s house after a dispute over backup singers. The song is so subtle (it could easily be played in an elevator) that I had probably heard it a dozen times before actually realizing this soft song was all about a pretty amusing instance of arson.

So, I had a storyline, I had a borrowed game idea- and I had little time.  My first tasks basically drilled down to these items:

How do I make the background of a bitmap image transparent?

Set the transparent portion of the bitmap to #FF00FF (pink), and use masked_blit() or draw_sprite()

Hmm, Allegro didn’t remove all the pink background?

Make sure to disable anti-aliasing, you’re blending #FF00FF with nearby colors

How do I easily generate animations?

Design the models in Blender, use armatures and timelines to create the motion, save them as individual bitmaps (with OSA disabled and with the camera’s background color set to #FF00FF)

What’s the shortcut to add bitmaps to a datfile? Grabber would take forever!

Use the command line interface to datfiles – “dat”. Trust me on this one, I could archive 300 images in a few seconds, doing it by hand would be masochistic, taking hours.

How do I prevent choppiness in animations and movement?

There’s system bitmaps, video bitmaps, and memory bitmaps. Look into them, and the example code that comes with Allegro (especially exupdate) for ideas and examples.

How can I fade in/out?

One method is to place a semi-transparent black rectangle over the screen. Look at set_trans_blender(), drawing_mode(), and rectfill().

With the answers to those questions in tow, I had a decent demo ready in under two weeks; one that supported smooth screen scrolling, had some limited game-physics, and an even more limited level editor.

In the end, I pieced together level backgrounds using GIMP and a few photos from IStockPhoto.com. The game physics could be better, I’ll attribute their current state to my inexperience and the pending deadline. In the end – I think the project turned out fairly well.

GIMP and the first level background

Part of the Title Sequence to the game. Tony Orlando image used without his consent.

I took the following screen capture of the game using Taksi, an open-source, and free capture program in the same vein as Fraps (although Fraps is limited to 30 seconds of capture in the trial version). The screen-capture doesn’t have sound (the game does) and the actual game runs much smoother than the screen-capture..

So basically, you’re a mosquito with no wings (thank you Mr. Orlando) fighting to survive, collecting blood IV’s and gascans to fuel your jetpack. Now, I’ve got another project to dedicate free time to – all made possible with Blender, Allegro, GIMP,  and a little programming.