Monday, November 27, 2006
Striding boldly forward into current generation gaming technology
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
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
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.
Wednesday, November 01, 2006
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#
My AE Item Maker has a SingleUseItem class, which uses an enum for each different kind of single use item.
public enum SUTypeAmong 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.
{
INVALID,
POTION,
OIL,
DETONATION,
OTHER,
}
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
- Save the file. That brings up a few options, include "Save As." Click that.
- In the file list, find the file you want and right click it.
- From the right click menu, select Perforce, then "check out."
- 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
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:
- Tested and debugged basic single use types --DONE
- Tested and debugged basic spells --DONE
- Code to load spells from disk
- Code to save single use items
- Code to load single use items
- A UI that doesn't suck
Extra stuff that would be cool:
- The ability to print items you've made in nice stat blocks
- The ability to sort spells by level, basic type (damage, buff, etc), descriptor, level, and alphabetically
- The ability to specify multiple sorts
- Some automated way to add new spells
- 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
HAARG!
The whole thing is pretty entertaining.
Sunday, October 15, 2006
Thursday, October 12, 2006
Sunday, October 08, 2006
Source Control and Visual C# Express
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.
Switching to blogger beta
Where the wild pies roam
Around 9 p.m. I was eating tasty Mac & Cheese and Chicken. Around 3 a.m. I was sad. I blame Salmonella.
The pies, however, were excellent.
Wednesday, October 04, 2006
LOST season 3
I haven't seen the whole second season yet, so I have no idea what's going on.
Two things come to mind.
First, wow. Lost is just cool. As usual, I can't wait for the next episode.
Second, I really dislike TV as it is now. Sitting and watching Lost I was thinking about how I need to either get a TiVo, go old school with a VCR, or just watch the series on DVD.
When we moved back to the Midwest we got TV again. I miss not having it. TV sucks away time. It's so easy to sit and stare at the pretty lights and moving pictures, and wake up 3 months later with very little else having been accomplished.
Watching series on DVD or (I imagine) on TiVo is different. You get to see what you're interested in and you don't have to watch the commercials. To me, DVD's are not quite as bad as TV, because you get to watch them on your own terms.
Anyway, I'm off to play with C# some more. No more TV tonight!
Monday, September 25, 2006
Back where it's sane
You can thank my buddy Ktorrek for giving me the kick in the pants I needed to start blogging again. He had to go and link to my blog.
A lot has happened over the last 4 months.
We landed in Illinois safely. Thanks to Frangelica's father our stuff arrived here before we did. One of my mother's coworkers supplied a variably sized hoard of helpers to unload the truck. Unlike some of my previous moves, everything arrived safely. Or so we thought at the time.
Highlights, in no particular order:
- Frangelica earned her Driver's license, and for the first time ever can legally drive a car by herself
- She is taking a couple of classes at a local community college
- Approximately 1 week after Frangelica got her driver's license someone broke into our new car and stole her purse. Almost everything has been replaced, but it was both time consuming and expensive. I estimate a total cost of nearly $500, just so the thief could get $8 and a useless cell phone. That doesn't include time off work.
- I thought I had cancelled my cell phone, but I had only put it on hold. So I got to pay Sprint for 2 months for a phone I don't have
- We have a cheaper pay as we go plan. The one from sprint was too expensive for what we needed.
- I ended up piecing together a new computer, because my old one was on it's last legs. The final straw was when half of the ram went south. My good friend Ktorrek put it together for me and I'm downloading crazy big data files as I type, including a copy of Visual C# Express, the Windows XNA Beta, The latest DirectX sdk, and the beta of the .NET 3.0 platform (formerly Avalon).
- Frangelica's computer is mostly dead. Ktorrek is attempting some horrific experiment designed to revive it. It will end up as a Frankenstinian combination of my old computer and Frangelica's old computer.
- I have returned to the east coast once to touch base. As always, my return flight was delayed. I had to spend a night with a friend before I could actually come home. Otherwise the trip went well.
- Working from home is awesome.
- My mother was caught in a flash flood a few weeks ago. She's fine but her car died. She bought a newer version of my car.
- The same rains that destroyed my mother's car flooded our storage locker. Fortunately there was minimal damage, but I need to get our furniture cleaned.
- As I expected, since I left work the push for Unit Testing has gone completely. But I still get to test drive what I do, so it's not a total loss.
- I bought Monte Cook's Ptolus. I couldn't help myself. I'm trying to get a group together but it's not going well.
- This website will probably change soon. I think I'm going to go with 1and1 and get an actual domain name. Frangelica might get her own domain name too. Who knows? I'll keep you all posted (hi mom!).
And that in a nutshell is the last four months.
Thursday, June 01, 2006
Pitching TDD
I was expecting to spend 10 or 15 minutes talking about unit tests, TDD, UnitTest++, and how I have already applied unit tests and TDD to some of the code I'm working on. I wrote up a short guide to keep myself on track. I abandoned my guide about 30 seconds in to the presentation, and ended up talking and fielding questions for about 45 minutes.
It was a pretty easy sell. All the questions were along the line of "How do you do X?" and "What about Y?" The hard sell will be to management. The whole thing will be complicated by my move back to Illinois. I'll be working remotely, whch means I won't be around to try and help TDD take hold. Still, I had to try.
I'm very excited to see how this works out.