Legos and LEDs

Zombie Timmy LegoLast week Dan pointed me to an article on EvilMadScientist.com about putting LEDs into Legos.

I don’t know anything at all about electronics but it seemed pretty straightforward so I figured I’d give it a shot.

My first attempt was good old Zombie Timmy. I’ve created him in so many different media at this point it seemed like a natural first try.I picked up some 5mm LEDs at radio shack and used a coin battery like the article said. I was happy to see that there was no resistor necessary.

I sawed his neck off and drilled a hole big enough for the LED. Next I drilled out his eyeballs, and a hole in the back to run the LED’s leads out.

Then I went to work painting up a new Zombie Timmy body. A little blood here, a little dirt there, and I was done. I got a pretty encouraging result – he looks great with his evil, red-glowing eyes! The ring of red around his neck looks a little doofy. That’s the bottom rim of the LED. I will have to watch for that in the next project.
Borg Lego

After that, I figured I would try a Borg. Borg are fun to make because you get to make all these little imaginary circuit diagrams on them.

I followed the same construction technique as with Zombie Timmy, except I only drilled out one of the eyes. I also painted black around the bottom rim of the LED so light doesn’t pour out of his neck.
The only thing I’m not happy with is the way the battery sticks out the back (it’s tucked away behind the figures in both of the photographs here). I picked up a couple battery holders and would like to create a diorama-type setup with the battery holder and possibly a switch behind the wall.

My next project in this vein will be a new version of my Lego Sam Fisher, but this time with gren LED goggles.

gp2tanx Dev Log Continued

gp2tanx is now feature-complete. I’m just waiting on some art for the splash screens and victory screens, and then it is ready to go. Well, almost. Everything works great on Windows, but when I compile for the gp2x, it crashes at the pause screen. I’m trying to isolate the problem but I haven’t been able to figure out what is causing it. Very frustrating since I don’t have a way to debug directly on the gp2x; I have to change the code, rebuild, recopy to the gp2x, run it again (and again and again).

gp2tanx dev log continued

gp2tanxBack from vacation (lots more on that soon) and did a little work on the game today.

Got the wind working, and explosions cause damage now. Cleaned up the display a little. I’m trying to get through it without looking at any other Scorched Earth clones (which is kind of stupid since it’s already a clone anyhow, but whatever).

Now there’s lots of non-fun stuff left like menus to start and pause the game, detecting end-of-game state, and so on. Probably lots of stuff I haven’t thought of yet too.

I hope to press on to the bitter end though, so I have a finished game when I am done.

gp2tanx Dev Log

Completed on the train home last night:
- added “comet tail” to the fired shot so it shows up better

Completed on the train to work this morning:
- implemented destructible terrain (thank you jnrdev) and falling tanks

It’s almost a real game. Still to go:

  • wind
  • explosion graphics
  • damage
  • menu
  • pause

Haven’t ported it over to the gp2x in several days – I guess I should do that and make sure it still works!

gp2tanx – It’s Alive!!

gp2tanx - work in progressStarted off slow, but made huge progress toward the end of the weekend.

As you can see the tanks are now half the size they were before. The earlier version was good for learning but impractical for an actual game. (Thanks for the tiny tanks, Jim!)

Most of the time was spent trying to implement a fractal terrain-generation scheme (based on this article) and draw that to the screen. Once that came together, I tore apart the old version of the game, put the tanks in their own class and tried to clean up the rest of the code a bit. It’s still a big mess, I wouldn’t want anyone else to try to read it, but it does work!

I’ve got the turrets moving now as the player changes aim, although I think there is some weird rounding happening somewhere that makes some of the angles look weird. Next I will try to re-implement the ballistics code.

Here’s some great links if you’re trying to get started with gp2x development, or SDL development in general. I referred to them many many times this weekend. I’m using Cone3D’s sprite class (which is sort of overkill since nothing really animates but I wanted to learn to use it), and Lazy Foo’s timer/frame limiter class.

Programming the GP2X – Part 3: Mistakes Were Made

Tank game prototype on gp2xWell, I had not one, but two big mistakes in my code to calculate the trajectory of the bullets:

1) I had my GRAVITY constant defined as a negative (-9.8 m/sec^2), then I was subtracting it instead of adding it – so the bullet rose faster and faster!

2) The sin() and cos() functions were expecting angles in radians, and I was passing in degrees. That’s why everything got all crazy when I used an angle above 70.

    These are both resolved now, so the bullets actually go from here to there now. I can start doing some code cleanup before I move on to actually creating the explosions.

Programming the GP2X – Part 2

I got my prototype game running on the GP2X last night. There’s still something wrong with the projectile trajectory, but it was very cool to compile the program on my PC and then copy it over and see it run on the small screen.

If you’re getting into GP2X development, definitely check out the GP2X Dev Wiki, especially the section on setting up a development environment. I followed the instructions for Windows and everything worked perfectly.

I’m still not very happy with DevC++ as an environment though. I looked at CodeBlocks and didn’t like it. Eclipse looks promising but very complicated. I may just end up going with Visual Studio since that’s the environment I know best.

Programming the GP2X

Atari Adventure on the GP2XSo I ordered a GP2X last week. It’s a linux-based handheld that’s completely open for development.

If you are into emulation and classic games this is the system for you. It runs lots of emulators, MAME, etc. It also supports DivX and Xvid .avi playback.

Sean and I have decided (again) to try to write a game and Jim is on board for the art. I spent the weekend just trying to get acquainted with the system and rough out a Scorched Earth clone. I figured it is simple, but still has things like a HUD, physics, and so on.

Well, the first thing I learned is that I don’t know nearly as much about C++ as I thought. I’ve been coding C# for several years but it has tons of featured that just plain don’t exist in C++. So there was lots and lots of Googling and research.

So far I’ve got drawing both tanks on the screen, reading the input for the trajectory and power of the shot, and displaying that on the screen. Something’s funky when shot is actually fired though. I’m not sure if it’s not registering the input or if my math is way off.

Which brings me to my next issue: the debugger in DevC++ kind of sucks. I’m going to look into getting a different IDE set up, maybe CodeBlocks or Eclipse. Any suggestions?

Mmm, del.icio.us…

This weekend I got annoyed looking for bookmarks that are on my work machine, my desktop, my laptop, etc and started looking for a bookmark manager that would spare me the hassle of keeping an html page updated.

I know del.icio.us has been around for a while, but to be honest I never looked at it, and in fact I thought it was something like digg(which is cool, but not what I was looking for in this case.

del.icio.us is kind of like flickr for bookmarks. You can tag your bookmarks in whatever ways make sense to you, and you end up with a page with a nice URL that’s easy to remember. You can share your bookmarks if you want (mine are at http://del.icio.us/yacullo)and create a “network” of your friends’ bookmarks. You can also search other people’s booksmarks, see what has been added recently, what is under what tags and so on.

If you give this a try, I highly recommend the FireFox extension which adds a “Tag this” button to your main toolbar.

Now I’ve got all my bookmarks whereever I go and I’m happy.