Sunday, November 1, 2009

Howitzer

Many years ago, I wrote a tank game called Howitzer. It had all sorts of features - animated mushroom clouds, dozens of types of ammo, computer-controlled tanks, etc.

To run well on the computers of the day, some of which lacked math coprocessors, I wrote my own graphics, sound, memory management, and fixed point math libraries in a mix of hand-tuned C and assembly. The entire program rang in at around 35,000 lines of code.

I released Howitzer as shareware - $10, $5 for students, and just a postcard if you lived outside the USA. I still have a binder filled with all the postcards, from over 30 countries.

A few months ago, I started encouraging my older son Gavin to learn programming. He asked if it was possible to write a game, so I dug out Howitzer to show him that yes, it's possible. I was thrilled to discover that Howitzer runs nicely in DosBox, with the exception of the digital sound effects.

Howitzer's still a bunch of fun to play. If you'd like to give it a try, I've made a free version available for download here.

Saturday, September 19, 2009

Mars needs a bigger moon

One of the factors stabilizing Earth's climate is its large moon in a relatively close orbit; it acts like a gyroscope to keep Earth spinning the same direction without wobbling (much, anyway).

Mars, on the other hand, has two dinky moons (captured asteroids, actually). Without a big moon, its axial tilt swings around wildly.

When we terraform Mars -- and I hope it's a when, not an if -- we need to plan for the long term. To keep the climate of our newly terraformed planet stable over millions of years, we're going to need to stabilize Mars's spin.

Conveniently, the planetoid Ceres is in the asteroid belt right next door to Mars. It's big enough that we could move it in a close orbit around Mars, and it would have the same stabilizing effect on Mars that the moon has on Earth.

Sunday, August 30, 2009

RC Lego Missile Launcher

Chasing the kids around with Nerf guns is tiring. If only there were some way to shoot at them without needing to get up...

Now, there is. Presenting the remote-controlled Lego Missile Launcher:

It both steers and fires remotely, using two IR remote-control sets (one for left and right wheels, one for the launcher). There's another motor channel still left, which could be used to control the elevation of the launchers, or for a second launcher.


Here's a front view of the launcher, showing one of the IR receivers and the gearing for the wheel motors:




Here's a picture of just the launcher assembly. When the motor turns the worm gear, it slowly rotates the camshaft. Each of the cams triggers one of the missile launchers.

Since the cams can be positioned in four different ways on the axle, it's possible to add two more launchers outside the adjustable angle supports, firing out of phase with the two interior launchers.

Next, I'm tempted to rebuild it using Lego Mindstorms, and program it to seek and destroy targets on its own...

Thursday, July 9, 2009

Open Source Projects

This has been a very open-source year for me at Google. In addition to working on some major projects (Chrome and now Chrome OS), I've also released the following:

Software Construction Toolkit - A set of extensions to the open-source SCons build tool, to make it easier to build and test cross-platform applications. Written in Python.

Mini Golf Score - My first Android app. I was inspired to write this by my two boys, who haven't yet figured out how to take turns at mini golf, and who often play the game more like hockey than golf. I designed Mini Golf Score so that I can just tap on their names as they hit the ball, and each tap adds a stroke to their score for the current hole. It's a free app at the Android Market (note: that link only works if you're on an Android phone). Written in Java.

Wednesday, May 27, 2009

Nerf Vulcan Machine Gun Rechargeable Battery Mod

Nerf has made the Best Gun Ever - the Vulcan Machine Gun. It fires 25-round belts at several rounds per second.

Only one problem. It needs 6 brand new D batteries to get anywhere close to the claimed 3 shots/sec. Those aren't cheap, and need to be recycled.

Fortunaately, there's an easy fix. 6 x 1.5V batteries is not too far off from a 9.6V rechargeable racing pack.

Parts:
  • 9.6V racing pack. You can get a decent one with a charger for $15. Try to get a charger which shuts off automatically when the battery's charged; the cheap ones don't, which will fry your battery if you forget and leave it plugged in too long.
  • Extra connector for racing pack. I chopped mine off one of those cheap chargers, which came with a remote control missile launching tank.
  • Alligator clips.
Tools:
  • Wire cutters
  • Soldering iron
Use the wire cutters to chop down the center divider of the Vulcan's removeable battery box so that the racing pack will fit. Then strip 1/2" of insulation off the extra connector and attach the alligator clips. Solder them on, so you get a good connection; the Vulcan wants to draw lots of juice. Charge and attach the battery pack.

One end of the battery box has metal pads on it. If you hold the box so those are on the left, that matches my picture. Clip the - (black) wire from the battery pack onto the spring closest to you. Clip the + (red) wire from the battery pack down into the far right connector. It should look like this:
Now, put the rechargeable battery in the battery box and slide it all into your Nerf Vulcan gun. Add darts, and fire away! It doesn't fire any farther (since that's dependent on the spring action in the gun), but it will fire a lot faster. You should get about 3.5 shots/sec on a fresh charge. And you can always switch back to those D batteries in a pinch.

Disclamer: Use this mod at your own risk. I'm sure this voids the warranty. While I haven't seen the slight over-voltage burn out the motor of my Vulcan or break the internal action yet, that doesn't mean it won't happen eventually. This mod is not endorsed by Hasbro.

Sunday, April 26, 2009

Termites and doors

Thursday I opened the side door to our garage and discovered a pile of termite droppings under the door. The bottom of the door and its frame have been a little rotted for years, so I guess it's not completely a surprise. Still, it's never a good thing to find termite droppings.

Took the door off the frame and prodded it and the frame with a screwdriver. Frame is fine. Bottom of the door disintegrates into paint flakes and a huge pile of termite droppings. Ok, it could be worse. The termites are in one of the few parts of the house that I can replace myself.

Carefully measured the doorframe. 32" wide by 81" tall. About half an inch of space between the frame and the studs. Then, off to Home Depot to buy a new door. Lots to choose from. Found a nice steel-lined door with a window. They come in 32" and 36" widths. Great, 32" is what I need. Steel-lined doors are heavy, but managed to get it into the mini-van.

Got home and ripped out the old doorframe. Broke the handle of my favorite framing hammer in the process. Finished the demolition with my favorite 3' crowbar; in retrospect I should have started with the big guns.

Now, all I need to do is prop up the new door, shim it and align it, and screw it in.

Except the new doorframe doesn't fit.

Measured the doorframe. Aha, when you buy a 32" door, they mean the door is 32" wide. The frame adds another inch on each side. So I had a 34" doorframe and a 33" hole to put it in.

But with a 3' crowbar and a 16-pound sledgehammer, all things are possible (0r at least, removable). Widened the opening a couple inches, including shifting a stud and pounding back the stucco and concrete. Not quite how I'd envisioned my afternoon. On the bright side, hitting things with a sledgehammer is a good way to get out the frustration, um, of needing to hit things with a sledgehammer.

Several hours of pounding and shimming later, the door is in place. Now, all I needed to do was screw it in with the included 2.5" screws. Which are all apparently made of cheap steel, or the studs in the garage are really hard, or both. The screws snapped off or strip partway into the frame. Not only does this remove support from the door hinges, but it bows the frame inwards so that the door doesn't close.

Gpt out hacksaw. Removed blade from hacksaw. Slid blade in between shim and now-bowed-inward doorframe. Cut screws. Repeated on other side of shim. Door frame is now unbowed.

Found 4 nice sturdier 3" screws in my box-o-parts. Now we're back in business. Never throw out good screws. Added deadbold and doorknob from old door. And at the early hour of 10:30pm, the door is in!

Did the stucco-ing over the next day and a half. Stucco is great stuff - like wet sand. Takes an hour or so to set. I bet it's possible to build a great (and permanent) sandcastle out of it. Must bring a couple of bags of stucco to the beach next time. If I build at low tide, the stucco should be hard by the time the tide comes back in. And woe to the teenagers who try to kick over my sandcastle...

Sunday, April 5, 2009

Lego spider

It's spring, and the black widow spiders are coming out. Here's an enormous one I "found" in our shed out back...

It was quite upset when I brought it in the house for some pictures...

So I squashed it...

600 pieces of Lego, build time about 8 hours.