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.

Sunday, March 22, 2009

Lego chainsaw


When you're running low on ammo, here's what you need to fight off the Lego hordes - a chainsaw with working motor.

I wonder if I should pack this on my upcoming family trip to Legoland...

Sunday, March 1, 2009

Lens cap gray card

Getting the white balance (color cast) correct when shooting with a digital camera is sometimes a challenge. Here's a quick project which can solve this problem.

Buy a cheap gray card from any photo shop (online, I've had good luck from Adorama and B&H). Cheap cards actually work better than expensive ones, because they're usually printed on thinner cardstock. Cut out circles to fit inside your lens caps. Stick to the lens cap with double-stick tape.

Do a quick check to make sure the card isn't touching the lens when the cap is on; some lens caps work better for this than others. You can also buy replacement lens caps which may work better than the one that came with your lenses.

Now you're never without a gray card, and it's right at hand when you need it. You can either zoom in on the gray card and use the "custom white balance" feature of your camera, or correct the images to match later in your photo editing software. The latter works better if you shoot RAW (which lets you change white balance after the fact), or if you set your camera to a white balance which is "pretty close" (for example, set it to daylight or cloudy outdoors). For this trick to work, it's important not to use in-camera auto white balance; you want the white balance to be the same in your keeper shots as it is in the throwaway shot which shows the lens cap.

Here's an example of where auto white balance can go horribly wrong, and the result with the gray card.

The first shot is straight out of the camera (Canon 30D), using in-camera auto white balance. Not bad, but the image has a blue cast. Still, it's much better that what Photoshop did with it (middle image). The last image is using click-neutral on the lens cap; this is the color the bouncy house actually is.




Tuesday, February 24, 2009

The tree house

Last spring, I decided to build a tree house for our two boys, who had outgrown their plastic climber. After talking with the boys, I determined the most important characteristics to be:
  1. High enough they could get a good view of the yard, and reach the climbable branches in the tree.
  2. Sturdy enough to last a long time. If it's hard to put up, it should be hard to knock down.
  3. Must not hurt the tree. Trees grow to usable size much slower than boys do.
  4. Some way of attaching a swing.
  5. Not too expensive. Would you rather spend $1000 on a tree house and $200 on Lego, or the other way around? I thought so.
Our mimosa tree wasn't sturdy enough to support a tree house, so it needed to be more of a 'tree platform' than a 'house held up by the tree'.

I fired up Sketchup, and pretty quickly designed something treehouse-like. The only hard part was the cutouts for the ladder rungs; for some reason they had a tendancy to go away when I resized or edited other parts of the tree house.

We built a list of lumber and parts off the Sketchup model, and headed to the hardware store. Treated 4x4's for the base, since we know termites live in our area (nothing like taking down the pool at the end of the summer and finding a termite colony happily eating the crushed grass underneath). Kiln-dried lumber for the rest of it. Assorted strong-ties and galvanized bolts. Total cost: around $200.

Remember that really hot weekend last May, when it was like 100 in the shade? Guess which weekend I picked to build the tree house. 15 hours and 3 gallons of lemonade later, here's the (almost-) finished result.

We put a rope swing on the 2x6 that sticks out from the left corner. To keep the swing from rocking the whole tree house up off the ground, we pounded pairs of 18" construction stakes (3/4" steel rods with a point on one end) through the 4x4 into the ground near each corner. They're angled out like an A, so they hold the tree house down to the ground.

Since then, my 8-year-old has added a hammock I got him for Christmas, and my wife discovered the tree house is a great place to do bird-watching.

I haven't all spent the money we saved on Lego, but now that I've discovered BrickLink that's looking more likely...