Friday, January 28, 2005

Writing Pretty Code

At work we recently switched back to using C++. We argued for a couple of weeks over coding guidelines. During this protracted argument, much of the team sort of felt that we were wasting time arguing about issues like whitespace. However, it turned out to be a huge blessing that we all decided to write human readable code (note that human readable code is different than well designed code.) This article explains how to write human readable code and carefully avoids talking about well designed code:
http://www.acmqueue.com/modules.php?name=Content&pa=showpage&pid=271&page=3

Thursday, January 27, 2005

Week 13: Creating MiniGames

So, "Lediculous" now dubbed "Mini Game Maker" is in a very usable state. It's super easy to code MiniGames in under a half hour. Suddenly, coding the games is easy. Creating graphics for the games has become the time consuming bottle neck!
The lesson here is, "With middleware, it's easy to make custom logic. Sadly, middleware won't speed up custom content creation."

Sunday, January 23, 2005

Supreme Court Justices...Talk to the Hand!

From http://www.legalaffairs.org/howappealing/ExtremeAssociatesWDPA.pdf a court ruling that argues that Obscenity Laws are unconstitutional:
"In the dissenting opinion [the justices] opined that the holding in Lawrence calls into question the constitutionality of the nation's obscenity laws, among many other laws based on the state's desire to establish a "moral code" of conduct. Lawrence, 539 US at 590 (Scalia, J. Dissenting). It is reasonable to assume that these three members of the Court came to this conclusion only after reflection and that the opinion was not merely the result of over-reactive hyperbole by those on the losing side of the argument."

Federal Obscenity Law Struck Down!

All Americans know the First Amendment: "Congress shall make no law... abridging the freedom of speech.*" Most Americans don't know about the asterix however. The asterix isn't part of the original constitution. It was added by the Supreme Court. The asterix states, "Certain conditions apply: Freedom of speech is not guaranteed for sexual speech, especially if said sexual speech appeals to the prurient interest, describes in a patently offensive way sexual conduct and the work lacks serious literary, artistic, political, and scientific value."

Strange huh? The Supreme Court guarantees Neo-Nazis the right to march and speak, but doesn't guarantee you or I the right to read Hustler?

Thankfully, a low level court has come to its senses and realized the obscenity of obscenity laws. The full judgement can be read here: http://www.legalaffairs.org/howappealing/ExtremeAssociatesWDPA.pdf

The relevant passage is: "We find that the federal obscenity statutes burden an individual's fundamental right to possess, read, observe, and think about what he chooses in the privacy of his own home by completely banning the distribution of obscene materials." I'm breaking out a bottle of champagne, though I fear this celebration will be short lived.

Sunday, January 16, 2005

Adventures in a Drug Store

Did you know that you can by dried Pigs' Ears at Rite Aid drugstores? Evidentally, dogs love to chew on them. Here are some other strange items I recently found in the curio halls of a suburban drugstore:
Hard boiled egg peeler (As seen on TV!)
Shaver designed specifically for shaving your head (the blades are attached to a ring that you slip your finger through, so you don't have to hold the handle at an awkard angle.)
Magnetic "non-medical" pain reliever (What's next? The Virgin Mary "Power of Prayer" non-scientific, non-medical, faith-based pain reliever?)
A variety of "massagers" which are obviously thinly disguised vibrators.
A camping axe.
A variety of ointments whose labels are completely in Spanish.
A plastic toy of Tigger selling Lemonade.
A vinyl jump suit in a box.

Wednesday, January 05, 2005

Week 11: Rendering Dynamic Text

Just spent the evening figuring out the best way to render user determined text in rectangles of user determined size.

The solution is actually pretty simple using .NET. First, measue the size of the rendered text using some arbitrary font and some arbitrary bounding box. Next, determine the ratio between the width of the arbitrary bounding box and the actual area you want to render to. Do the same for the height. Choose the smaller ratio of the width and height ratios and scale the font size by that ratio. Wallah! The text fills the area you want.

Sunday, January 02, 2005

Week 11

I'm currently reading User Interfaces in C# by Matthew McDonald. While the book is mainly a technical overview of C#'s WinForms, it includes an interesting chapter on UI design. The short version is: 1) Use DataSets to separate UI from data. 2) Make all controls "Windows Standard." In other words, follow existing design patterns to make the UI learning curve as simple as possible. What does this mean? Force the user to go to "File, Exit" instead of letting the user hit "Escape" to exit. Sure the escape key is faster and is intuitive to some, but it's not Window's Standard and it will confuse people.

I've just finished a simple application that allows the user to play compiled "Micro Games". The saying is correct: "It's much harder to encode data than it is to decode it." It took me about 3-4 weeks of coding to write the compiler and the UI that encodes the data. It only took me about a two days (12 hours of coding) to complete the "decoder" that allows the user to play the game.

On the design side, I'm trying to decide if I should let the user decide which color should be transparent for sprites or simply force the user to use the bottom left pixel for transparency. Letting the user decide is an extra UI element that complicates things, but it does have it's uses and it makes it clear which color is being used for transparency. However, letting the user decide is only important in a very rare case (when the sprite is square and the bottom left pixel should NOT be transparent.) It's the classic Simplicity vs. flexibility tradeoff.

A Day in the Life of a Hobby Game Programmer

Since October 12th 2004, I've been working on a micro game maker code named "Lediculous.*" A micro game is a game that can be completed in under 5 seconds. The idea is to string lots of micro games together to create one big game. Lediculous is designed to enable designers to create a micro game in under an hour.

I am going to post about every week or so, describing some thoughts, problems, and progress with Lediculous that will hopefully give insight into hobby game/application making. Enjoy.

*I have been told that "Lediculous" is a bad name, because it evokes racist imagery of Asians saying, "Ridiculous" in an "Asian" accent. However, the actual name of the software comes from LED as in, Light Emitting Diode, because micro games were first made popular on watches that used LEDs. I may change the title.