Wednesday, December 20, 2006

Merry Christmas from Chicago

So about 3 weeks ago I bought the 360.

A couple of days ago I got a note in the mail from the City of Chicago Department of Revenue. It turns out that on our quick trip back into the city to return the defective 360 to Microcenter I turned right on a red light where I wasn't supposed to.

Frangelica and I were both in the car and neither one of us saw the sign. Naturally, the sign is quite visible int the grainy photo that came with the ticket.

In theory I could contest the ticket via mail, but I think that's unlikely to succeed. They list 6 valid reasons to contest the ticket and "I didn't see the sign even though both my passenger and I looked" is not listed among them.

So, Happy Holidays Chicago.

Maybe they'll use the $90 to help repay the legal fees.

Monday, December 11, 2006

Programming board game


Programming and snowboarding. Two great tastes*...


*I don't snowboard. The closest thing I get to snowboarding is SSX.

Monday, November 27, 2006

PS3 vs. Wii - Apple Style!

I know I just bought a 360, but I also want a Wii (silly name aside)

Striding boldly forward into current generation gaming technology

As you can see via the newly modified "about me" section, I finally gave in over the weekend and bought an XBox 360. Microcenter had a deal that was too good to pass up. A $100 mail in rebate on any XBox 360 console.

Of course, the first console I brought home had a bad hard drive, so I had to exchange it. Did I mention that microcenter is about an hour and a half away?

The new console works just fine. I played Kameo for a few hours yesterday. It's fun, but I'm not sure it's my kind of game. I'll give it a little while more and then probably move on to Full Auto.

Thursday, November 09, 2006

The Dorm Room

I've known about this for quite a while but I keep forgetting to post it.

My buddy D-Rod went and made a movie based on a play he wrote in college. It premiers this Sunday. Check it out!

www.dormroommovie.com

And then there were 7

I've been talking about running a couple of different D&D games for a while. Since before Frangelica and I moved back out to Rockford. Heck, one of the advantages to moving back here was that I could (in theory) muster the old group. No hunting for new players, wandering if they were giant goobers or not.

The old group didn't work out. Folks were too busy. It made me sad, but it happens. I was semi-intentionally dragging my feet in finding new players, hoping maybe the old group would come together after all.

That's when Frangelica mentioned that she'd made a few friends in one of her classes. They seemed cool, and were interested in gaming.

So now, just like that, I have 7 players (including Frangelica).

We're rolling up characters this weekend. I'm looking forward to gaming again.

Sunday, October 22, 2006

Vehicular Fortitude: The Next Generation

This was a bad weekend for the car.  Four new tires and a tuneup.

There went $850.  Ouch.

Props

That last post was brought to you with Windows Live Writer and a nifty Source Code Formatter.

 

Now I just need to figure out how to make my chosen template look decent with the main text window wider, so the source code doesn't look bad.

String descritions from enums in C#

Anyone just looking for code can skip to the end.

My AE Item Maker has a SingleUseItem class, which uses an enum for each different kind of single use item.

public enum SUType
{
INVALID,
POTION,
OIL,
DETONATION,
OTHER,
}
Among other things I use the enum to generate names for items. In C++, I would probably write a function to convert the enum to the string I wanted, but this isn't c++, and I wanted to try something different.

My first thought was to use the nift ToString() method. This got me literal strings for values, like "INVALID", "POTION", etc. It was close, but not really what I wanted. So I turned to my favorite search engine for help.

The results were mixed. It seems you can't actually override the ToString() method on an enum. But I did find the next best thing.

First, I add a Description attribute to the enum (you need System.ComponentModel for this)

public enum SUType
{
[Description("Unknown type")]
INVALID,
[Description("Potion")]
POTION,
[Description("Oil")]
OIL,
[Description("Detonation")]
DETONATION,
[Description("Single Use Item")]
OTHER,
}


Next I added this public static method in a helper class:


 

public class ItemHelper
{
/// <summary>
/// Returns the DescriptionAttirbute for an
/// enum.
/// </summary>
/// <param name="nType">Any enum</param>
/// <returns>DescriptionAttribute for that
/// enum, if it exists</returns>
public static string GetTypeDescription(Enum nType)
{
Type oSystype = nType.GetType();
string strName = System.Enum.GetName(oSystype, nType);
FieldInfo oFieldInfo = oSystype.GetField(strName);
object[] rgObjs =
oFieldInfo.GetCustomAttributes(
typeof(DescriptionAttribute), false);
foreach (object obj in rgObjs)
{
DescriptionAttribute oDesc = obj as
DescriptionAttribute;
if (oDesc != null)
{
return oDesc.Description;
}
}

return "Unknown";
}
}

 


You use it like this:

string strType = ItemHelper.GetTypeDescription(m_nType);

This isn't perfect.  For one, if you have multiple description attributes you aren't guaranteed to find a particular one first.  It also doesn't handle localization at all.  But this works for what I need right now.

Thursday, October 19, 2006

Source Control update

After a while I remembered a discussion I had with a coworker about perforce, and now I have a workaround for checking out all the files and doing a "revert unchanged."

  1. Save the file. That brings up a few options, include "Save As." Click that.
  2. In the file list, find the file you want and right click it.
  3. From the right click menu, select Perforce, then "check out."
  4. Finally, cancel and save again. You've checked out the file.

It ain't pretty, and it's not as nice as source control integration, but it does work.

ItemMaker updates

I've been slowly working on the Arcana Evolved Item Maker. Very slowly.

So far I have tests for 4 different item types, but 3 of those need some refactoring. My current goal is to finish one kind of item and get that working in a UI. I've decided that the first Item type I want to tackle are single use items.

At a minimum in order to get an app together that does single use items, I need:

  1. Tested and debugged basic single use types --DONE
  2. Tested and debugged basic spells --DONE
  3. Code to load spells from disk
  4. Code to save single use items
  5. Code to load single use items
  6. A UI that doesn't suck


Extra stuff that would be cool:

  1. The ability to print items you've made in nice stat blocks
  2. The ability to sort spells by level, basic type (damage, buff, etc), descriptor, level, and alphabetically
  3. The ability to specify multiple sorts
  4. Some automated way to add new spells
  5. Images

And of course, other item types.

Ultimately, I'd like my item maker to be better than the existing one.

Right now I have code that loads the spells from an XML file, but it's pretty brittle. If an entry in the spell data is missing or not in the right order it croaks.

I really have to watch myself. I'm trying, unsuccessfully, to keep things simple. YAGNI. So far I've made a SpellWriter, which writes out spell data in the appropriate XML format. I don't need it. I wrote it to play with more of the .NET XML classes. Oh well, maybe I'll be able to use it for something else later on.

At 6 you can learn Python

Or at least enough python to write a game about vampires.

HAARG!

The whole thing is pretty entertaining.

Thursday, October 12, 2006

The latest in cube war technology

Even though I work from home, I so need this:

USB Missle Launcher

Sunday, October 08, 2006

Source Control and Visual C# Express

I'm continuing my work on my Arcana Evolved ItemMaker after a long break.

I'm still using C#, but right now I'm considering using this app to learn .NET 3.0 / WinFX / Avalon.

I'm using Visual C# Express, which is pretty nice, but I have one big complaint.

The worst part by far is that, like all of the Express downloads, VC# Express doesn't do plugins. This means that it can't do source control integration, which is a big pain. I'm working around this right now by checking out everything when I want to work, and using Perforce's "Revert Unchanged" feature to clear out the files I didn't edit when I want to check everything in. This works for the ItemMaker, but that's only because it's trivially small now.

ItemMaker now consists of about 10 core classes, plus 6 test classes. I haven't started on the UI yet. So far, that's 16 class files plus associated project files that I check out, revert, and check in every time I make changes. And doing TDD, I make a lot of small changes.

Any software developer needs source control. Joel Spolsky covers why (briefly) in the Joel Test. Eric Sink also has a post about it. If nothing else, source control is a great undo feature. Those changes you made aren't working? Can't remember what you changed? Check source control. Is it still unclear? Revert and start over. Without source control, you don't know where you've been, you don't know exactly what changed, and you certainly can't recover easily from a bad mistake.

I won't even work on small stuff without source control. For the record, I use Perforce at home because the single user license is free. If you are braver than me, or need a multi-user source control system, check out subversion.

I'm really happy that Microsoft released free versions of its compilers, but not being able to use integrated source control is almost a deal breaker. For C# IDEs, my only other (free) choice is Mono. I'm not yet annoyed enough to make the switch.

Fun game or crazy money making scheme? You make the call

Step 1: The Game of Alien Abduction
Step 2: ?
Step 3: Profit

Switching to blogger beta

I just switched to the new blogger beta so I can start taking advantage of the labels and other new features. This is stuff I've wanted since a few of my buddies went over to livejournal.

THIS BLOG HAS MOVED!

To:
http://martiank9.blogspot.com

The phpwebhosting address will be going away soon.