Finding a new hobby

Recently I was looking at the calendar and thinking about the remaining time in the year. One of my unofficial goals for the year was to get a new hobby. I’m sad to say that this never really happened, I was pretty preoccupied most of the year and didn’t get as much downtime as I thought I would.

I am determined to change this but it occurred to me that I didn’t really have any good ideas for a new hobby. Sure I’ve got that guitar that I pick up every now and then, but what about going out on a limb and doing something completely new? But where would I start? What could I do?

TO THE INTERNET!

This seemed like a great question for the internet at large to answer. So I posted to Facebook, Twitter, and my mailing list to see what other people are into. The message was pretty simple: “I need a new hobby. What’s your favorite?”

 


I got a lot of awesome responses! I am really surprised at how people embraced this question and offered up such interesting and great responses. There were even responses from friends-of-friends which is awesome because it helps me move beyond my “bubble” a little bit.

Here’s a rundown of what people told me they are into:

  • Tying knots
  • Crossfit
  • RPG’s
  • Puzzles
  • RC Cars/Model trains
  • Coloring
  • Facebooking
  • Soccer
  • Mountain Biking
  • Martial Arts
  • Writing letters and postcards
  • Video games
  • Saltwater aquariums
  • Ham Radio

I even managed to get a suggestion of something I could start with a friend! That was one of the more intriguing ideas and I think I’m going to have to do start that one. The idea was to start a podcast and talk about one of my favorite philosophies, Stoicism with an old friend. Such a great idea!

In the end I decided to take on Knot Tying as a new hobby. It really appeals to me for a lot of reasons. It’s practical (I’m always needing to tie some string together), very portable (I could do it anywhere), and there’s lots of resources on it.

Never were truer words spoken (or typed)

The other day I came across this really cool posting talking about school projects for computer science students.
Basically it talks about the different “levels” of effort required to make a certain type of video game for a CS class. Having just finished a CS class that involved a group project (but not a game) I was intrigued by the author’s take on the topic. (I usually try to dissuade people from doing games as a CS project, they just eat up too much time usually unless everyone in the group is on the same page.)

Overall I found myself agreeing with the various comments and evaluations of each game type (pacman, tetris, etc.). But when I got to the end of the “Advanced” topics section, I laughed out loud:

RPG – if you hate your life (and some apparently do), this obviously final year attempt at video game programming glory is likely to end badly.

That pretty much sums up my experience so far with my attempts to make a “simple” RPG. There’s a lot going on in a typical RPG, and it takes a lot of effort and attention to detail to pull it off and make it look good and play well. And even then, if you manage to get the mechanics of the game engine working semi-decently, then you have a tall order to fill by creating the contents (scripts, maps, graphics). Needless to say it can quickly become a huge time sink. Which isn’t to say it isn’t fun, because it is. But when you get overwhelmed on a project like this where you are working for yourself (i.e. not getting paid to work on it) it becomes very difficult to get your motivation back.

Personally, I’m hoping to get my motivation back to work on my little project some more. I think what I’ll probably wind up doing is working on it in-between other projects.

CSS + Javascript + web = fun Easter eggs!

It occurred to me the yesterday, with more and more people seeing the power of Javascript and CSS, more websites are getting slick. Ok, that’s a pretty obvious statement, but here’s something that’s not obvious: This presents a great opportunity for easter eggs!

Easter Eggs are little hidden things in side of a bigger program. Some times it just the developer’s names, other times it can be something totally unexpected like a flight simulator hidden in a spreadsheet program. With the power of Javascript and nice tutorials like this one, there’s a lot of opportunity to have some real fun!

Just think, with all of the computing power a modern browser affords us developers, it should be very easy to recreate tons of games from the Atari 2600, early Nintendo systems. The imagination can very easily run wild….

Title first, then game?

I’ve been watching Code Monkeys a lot lately. If you haven’t seen it yet, its a cartoon on G4 that is basically South Park, but set in a 80’s video game company. Its pretty funny, sometimes sick, but always twisted. Every week the characters get into all kinds of trouble, usually while trying to make a “new” game.

One of the best parts of the show is when the developers are either talking about or pitching their new games. Just from hearing the titles of the games I wish some of them had been made! Cool titles like “Monkey vs. Cobra” or “Hobo Killer” or “Family Ties: The Video Game”. Plus some of the shots of the games looked pretty funny too. Check out the whole list here: Games featured on Code Monkeys

All of those wacky titles reminded me of all the times in other movies, TV shows, games, etc. I saw a “fake” video game and thought it was the coolest idea ever. Like “Billy Graham’s Bible Blaster” on the Simpsons. Or “Astro Chicken” in the Space Quest series. Classics!

And thanks to the wonders of the internet/web2.0/lazy web/wikipedia, there’s a massive list of all of these fictional games! Check out the list here: Fake Games

Seeing all of those games there got me thinking: Wouldn’t it be cool if someone made some of these games based on just the title? (Or in the case of shows like the Simpsons, take the clip of the game and expand it into a full fledged game!)  That would be so cool. So cool in fact, I think I’m going to start doing that, looking at a title and then trying to come up with a game. Cheesy, yes. Wacky, you bet. Fun? Lets find out.

Pyglet

Recently I heard about pyglet which bills itself as “a cross-platform windowing and multimedia library for Python“. This is more-or-less what pygame offers, but with one exception: pyglet doesn’t depend on SDL, its written in pure python.

As a side note, if you try to install pyglet on a Mac, there is a small catch. I’m running 10.4 Tiger which uses Python 2.4. Pyglet.org does offer a dmg file to install itself, but it doesn’t work. The reason for this is that Pyglet does need ctypes, and ctypes did  not become a standard part of python until 2.5. So, to get pyglet to work on your Mac, you’ll need to get (and build) ctypes, or install Python 2.5. I installed ctypes and found it to be pretty painless.

Its still in an alpha state, but I thought it sounded interesting so I decided to take a look at it. Compared to pygame, it seems to be a little more streamlined. I’ve never really push pygame to the limits, so I can’t really compare the two as fully as I would like. One thing that I did like were the demo apps and the examples in the documentation. They were concise, yet demo’ed useful things that I would want to do in an app.

I started reading the documentation after lunch the other day and within a few minutes I found myself modifying the code as I read through the docs. Within 5 minutes I decided that I would try a sprint: Could I implement a quick and dirty game of pong within an hour using pyglet? Well, the answer is Yes!

picture-1.png

After playing around for an hour I had everything except the computer’s paddle in place working. A few days later when I had some time I spent and additional 15-30 minutes (while watching the game on TV) and knocked out the “AI” for the computer player. This isn’t award-winning code or game play (the bounding box collision test is pretty crappy), but it did show me that I could get something done quickly using this framework.

So, check out pyglet. Here’s the code to my craptacular version of pong. (There are 3 files, two images for the paddles and the ball, and the source file pyglet_pong.py)

The Netflix prize

Everyone is talking about the offer put up by Netflix yesterday. Basically if you can improve their movie recommendations, you win a million big ones.

This is a really cool idea. Its a hard problem (otherwise everyone and their brother would already have done it), that looks like it has no solution. But just because it looks hard doesn’t mean there isn’t a solution!

To help out Netflix has supplied a data set of user recommendations. Looks like its time to fire up Eclipse, break out the python, and put on my Data Miner hat, and start reading those AI books. 😉

Make your own damn story

Like most amateur game developers, I’m inspired to try and create games that I think are cool. And like most game developers I’m influenced by games that I have played. So it follows that if a game really got me going, that I would like to make something like it in the hopes that other people will feel the same way about it that I do.
Now a problem occurs when that thin line that separates “inspired by” and “a carbon copy of” gets crossed. There’s a ton of games and mods out there that cross that line. Usually its just a quick little thing by the developers that gets left behind after a while. Other times it gets a lot of attention and then the lawyers get involved, and the project gets canned quickly. Inverted Castle had a great posting about this. The idea that Hunty posted was to make your own story. And I think he is 100% not just to avoid getting sued, but just to make a new and exciting thing.

It seems hard to come up with something new and original to base you game on, but if you think about it, it doesn’t have to be. Most movies, books, and games are based on a couple of ideas that have all been used before. They just take a couple of them and mix them together in a new way.

Think about this: How many movies and TV shows have you seen that centered around a stolen treasure? And how many books have you read that were set in outer space? And… how many featured a smart ass outsider as the hero of the story? See, combine those things together and you have “Trent and the missing Jewel of Titan”.

Need bad guys? Think of 5 typical bad guys (gangsters, thieves, corrupt politicians, etc.) and think of why they would be involved. Pick the two best and put them in the story.

Now think about how Trent would react to meeting these people (assume they aren’t going to kill him right away because he seems like he’s not worth the time of day). Imagine the weaknesses of the bad guys, how would this work in Trent’s favor? Where’s a place you’ve always wanted to see? What would Trent say if he wound up there?

Answer those questions and it should give you a lot of possible locations and situations for your game. Pick the best few out of the bunch, and use those as your starting points for your levels/adventures. Start with those. If they are working, go back and look at what you threw out. Can it be changed or salvaged? Did you come up with new materials or ideas?

Its not hard. You just gotta practice. Take a favorite story, and take the best elements out of it, and scramble it up a little bit. Then branch out and add new elements (the stuff you find yourself saying, ‘it would have been better if X had happened…), the next thing you know, you’ve got an original story!

The math behind Sudoku: Graph Theory

Dr. Dobb’s magazine this month has an article entitled “Sudoku & Graph Theory” which caught my eye. The article describes a logical Sudoku solver the authors built that uses graph theory techniques to analyze the puzzle.

This really got my attention because graph theory is an important field of mathematics that has a number of applications (network traffic flows for example), and it is something that I’m always interested to learn more about.

The first thing the article does is assume the 81 cells of a sudoku puzzle represent a vertex on a graph. They then point out that the numbers that can be assigned to each row, column, or 3×3 square can be thought of as a node of a bipartite graph. That node contains a array of numbers that could possibly be in that position on the puzzle.

This is exactly what I do when trying to solve a sudoku puzzle, but expressed in mathematical/topological terms. (This is what I was trying to get across in my post about Sudoku Strategy.)

The article then goes on to present two methods of logically eliminating number from the array to find the correct answer: Pile Exclusion and Chain Exclusion. Sadly, I can not find any links on the web to explain these algorithms in more detail, but the article does an ok job of showing how they work.

I do want to point out that if you read the full article, beware that the sample sudoku puzzle they present does not seem to match up with the sample arrays (or vectors as they call them) when they are demonstrating the chain and pile exclusions!

My own personal preference seems to be the Pile Exclusion, that seems to match up with how I solve puzzles. It is basically a system where you find groups of numbers that are common across several squares (usually in a 3×3 section, but I often expand it to include the row and column). Usually this works out so that you have two squares where the numbers could be 1,3,7 in one and 1,7 in the other. Then you look at the other squares and if you see that 1 and 7 aren’t a choice in any of them, then 1 and 7 must be in the two squares you are looking at. This means that the 3 is not a possible answer, so you can mark it out. This usually winds up helping you figure out where the 3 is supposed to go.

The Chain Exclusion is similar in that you are looking for groupings of numbers, but with this algorithm you are looking for the numbers to be shared in other parts of the array in order to rule out other locations. For example, if you have 1,3 and 3,4 and 4,1 as the possible answers in three cells, then other locations in the puzzle that contain a 3 can be ruled out. Personally I find the Chain Exclusion method to be more of a leap than the Pile Exclusion.

Both of these methods basically boil down to using logic to reduce (or outright find) the possible numbers that could be the answer. Using both, as the program written for the article does, makes for a powerful set of tools to work your way through the puzzle. The alternative is to do a “brute force search” which means simply trying every possible number in ever possible cell until you get the solution. Since there are 81 cells and 9 possible numbers per cell that means there are 9^81 possible answers (in plain english this means 19 followed by 76 zeros) give or take a few depending how many numbers were already filled in for you. Needless to say, using Pile and Chain Exclusions will help you get the puzzle solved much sooner.

So go check out the article in the Feb 2006 issue of Dr. Dobb’s magazine, it’s a great read.

Sudoku Strategy

I was thinking of doing an article about Sudoko and my strategy for solving them, but a quick check on the MAA.org website lead me to an article which eventually lead me to Sudoku.com where there are several pages of strategy.

I read through them quickly and for the most part that site does what I do to solve them, but it explains it in a weird way (at least that’s what I thought). Maybe this will inspire me to do my own “how to win” page.

UPDATE: I made a page that help you solve sudoku puzzles by giving you hints. Check it out: Sudoku Helper