I started playing around with Siverlight earlier this week. From what I've seen so far, it looks like a very nice environment - it has (most of) the power of WPF for building user interfaces, and (most of) the power of the .NET Base Class Library to implement whatever it is that your application needs to do.

There are a few gotchas, though - especially if you have any experience with WPF. There are some subtle features that are missing, that you don't realize how nice they are until they're gone (such as binding to a static property, for example).

I encountered one such incident of this when trying to get data binding working. I first wrote my Model class, which looked something like this:

namespace SilverlightTestApp
{
    class Model : INotifyPropertyChanged
    {
        public Model()
        {
        }

        private string firstName = string.Empty;
        public string FirstName
        {
            get { return this.firstName; }
            set
            {
                this.firstName = value;
                this.OnPropertyChanged("FirstName");
            }
        }

        private string lastName = string.Empty;
        public string LastName
        {
            get { return this.lastName; }
            set
            {
                this.lastName = value;
                this.OnPropertyChanged("LastName");
            }
        }
        
        /* INotifyPropertyChanged Implementation */
    }
}

So far, so good. I then wrote some XAML to bind display this information in the UI:

<UserControl>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0">First Name:</TextBlock>
        <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=FirstName}" />
        <TextBlock Grid.Row="1" Grid.Column="0">Last Name:</TextBlock>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=LastName}" />
        <Button Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right">
            <TextBlock>Click Me</TextBlock>
        </Button>
    </Grid>
</UserControl>

In the code behind, an instance of the Model class is set as the DataContext of the UserControl, and in the click handler for the button a MessageBox is display with the name entered.

Looks good, right? Except when I run the program I get a MethodAccessException. No matter what I did, I could not figure out how to fix this error. The only thing I did know is that it had something do with my bindings, since if I took those out the error would go away. A search on the Internet didn't help much, either.

Then, on a hunch, I changed the Model class to be public instead of private, and that fixed it! Apparently in Silverlight binding only works with public classes (which isn't the case in WPF). My guess is that this is due to security - since Silverlight only runs in the browser (at least today) in a partial trust environment, Reflection (which is how binding retrieves the values it needs) on non-public members must not be allowed.

While this was frustrating, it was a good learning experience. It seems like I need to keep security in mind more with Silverlight development than with WPF.

Review: Resident Evil 5 (Xbox 360)

| No Comments

The main game that came with my Xbox 360 bundle is Resident Evil 5. I actually finished the single player game pretty quickly - I started playing on Friday night, and I finished it just before bedtime on Sunday. Overall, it's a pretty good game (although I had never played a Resident Evil game before, FWIW). That's not to say that I'm done playing it, however. There are plenty of other things to do.

The game has definitely shifted more towards a standard action game than survival horror - I don't know if that is a good thing or not. I'm not a huge fan of horror movies or games, so I guess for me personally that's a good thing. I could see long-time fans of the series upset by this change, though. There are plenty of big, bad monsters to destroy, though - just nothing where you jump out of your seat due to the events in the game (at least for me).

The events in the game are very much based on what has happened previously in the series. To make sure that I could actually understand what was going on, before I got the game I read up on the series itself. Both the GameTrailers Retrospective and Resident Evil Wikipedia page helped out a great deal. I could see being completely confused by the story if I hadn't done this research before hand. For better or for worse, newcomers to the series would be very confused regarding the events in the game.

One thing that sets RE5 apart from other action games is that you can't move and shoot at the same time. The left analog stick controls your movement, while the right analog stick controls the camera. Once you press the Right Trigger, though, that keeps you in place and now the left analog stick aims your current weapon of choice. While this is a drastic change from other games, at the same time it makes sense - your accuracy is greatly improved if you don't move when shooting in real life, for example. The game does help you out a bit here - most enemies come at you somewhat slowly, and tend to stop for a second or so when they get close. While that isn't necessarily realistic, it does make the game more playable. The controls didn't really bother me that much, once I got used to them.

The other big feature of RE5 is co-op play. The entire game is spent with the two main characters - Chris Redfield and Sheva Alomar. When playing solo, you play as Chris (although you can also play as Sheva once you've beaten the game). In co-op, each player takes one of the characters and you can work together to finish the levels. While I have mostly played solo, the times that I did play co-op were great - I could see that this is how the game was meant to be played. The AI did a passable job at assisting you, but it just doesn't come close to playing with someone else. It tends to go through ammo quickly, and heals you more often than is necessary. It's definitely good that a solo option is in place, though, for those who can't (or don't want to) play with another human. This is available both online and off, and while I haven't played local co-op, from the screenshots it seems like it wouldn't work very well (due to the smaller viewing area for each player).

Once you've finished the main game, there are still many things to do. There are 30 BSAA emblems hidden though the levels (the BSAA is the organization that employs Chris and Sheva). Once you get some of these, you can "buy" various items from the points that you earn for finishing levels - extra costumes for Chris and Sheva, figurines of creatures in the game, and a few other things too. There are also extra weapons to buy, and all weapons can be upgraded (once fully upgraded, you can purchase unlimited ammo for that weapon with points).

In addition, a new game mode is unlocked - Mercenaries. The objective of Mercenaries is to survive as long as possible, and killing as many zombies as you can in the process. This can also be played solo or co-op, however if you're going solo you don't have an AI partner tagging along this time. It's timed, and by default you only have two minutes (I think) to kill zombies. Scattered throughout each level is a time bonus which you can use to add time to the clock. There are also characters and levels to unlock here, too.

Overall, I'm really happy with Resident Evil 5. I could see not liking some of the changes if I were a long-time fan of the series, however given that I'm new to Resident Evil I didn't have any complaints about them. It's a great game, and it looks great too. It's definitely one that I'll be playing for a while. :)

Thoughts on the Xbox 360

| No Comments

Last week, my Xbox 360 finally arrived. It even arrived on the day it was released in stores, even though I pre-ordered it through Amazon. I opted for 3-5 day shipping via UPS, and even though it shipped out on Wednesday, I got it two days later. I have to hand it to Amazon - that was way more than I expected. Great job! :)

Unfortunately, I misunderstood what cables cam in the box, and I needed to buy the HD VGA cable separately. While that did add an additional $40 to the total cost, it's worth it - as I said before, I can get a much better picture on my monitor than on my TV. For sound, I had an adapter that I could use - 2 RCA female on one end, and 1 1/8" stereo jack on the other (although it turns out that the VGA cable comes with this adapter as well, which is a nice touch). I did need to buy a 1/8" to 1/8" female coupler in order to connect all that to my speakers. This all works quite well, though.

Since I bought the Resident Evil 5 bundle, I got a copy of Resident Evil 5 and Super Street Fighter II Turbo HD Remix. There were also a variety of Xbox Live Arcade trials included on the hard drive, which was nice.

While I was setting up my Xbox, I opted to start my one month Xbox Live Gold trial. While I haven't done much online yet, I really need to hand it to Microsoft - they've set up a great online system with Xbox Live. You can see what all of your friends on your friends list are doing, see what games they have, and compare achievements. PLus, all online games have built-in voice chat (there was a headset included with my Xbox, which I think is the case for most/all Xboxes too). While it isn't free ($50/year through Microsoft, although Amazon is currently offering 13 months for $40), it's definitely worth it in my opinon.

My GamerTag is Adeese, if you want to add me to your friends list, or play online with me sometime. :)

The main problem that I have right now is that I don't have many games to play. :) That will change in time, of course. I'm most likely going to get a subscription to GameFly, which is basically the Netflix of games (you can have so many games rented at a time, for as long as you want; send them back in the mail when you're done, and the next game in your queue is shipped to you). This is much more economical than buying all of the games that I want to play, since many I would only want to play once and never again (which isn't worth the $60 that most new games cost). If I do end up liking the game, there is an option to buy the game outright so I don't need to buy it separately - that's a nice touch.

Overall, I'm very happy with my purchase - Microsoft has done a great job putting the Xbox 360 together. While the Xbox 360 has had its share of technical problems (with another potential issue on the horizon, unfortunately), hopefully the worst is behind us. I also hope that my console won't fall victim to either of these issues, but only time will tell. If nothing else, hopefully Microsoft has learned its lesson, and will build the Xbox 360's successor better to avoid these issues in the future.

Win7HotKeys v1.0.2

| No Comments

Win7HotKeys v1.0.2 has been released. The following changes are in this release:

  • [BUG]Do not attempt to minimize or maximize a window that does not allow this operation

As always, if you have any questions, comments, bugs, etc. please let me know. :)

Review: Mirror's Edge for PC

| No Comments

I recently won a copy of Mirror's Edge for the PC, so I figured I would give it a try and see how it is. Given the reviews that I had read for the game, I didn't set my hopes very high. While it's not the best game ever, it was pretty good. I am glad that I didn't pay full price for it, though.

Hardware specs:

  • Pentium 4 3.0gHz
  • ATI Radeon 2400 Pro
  • 2GB RAM

At first, I thought that I wouldn't be able to play the game at all, since my PC doesn't meet the minimum requirements for the game. Thankfully, M was gracious enough to allow me to borrow her computer so that I could play through the game. It's a little under three years old, and playing at 1024x768 with most settings at "Medium", the PC couldn't always keep up with the game. If I played for a long time, the game would periodically freeze, and come back a few seconds later (generally at the worst possible time, naturally). I did get a few blue screens, but updating to the latest video drivers fixed that problem. There were still some hangs (generally when loading after dying), and every time that I exited the game it wouldn't properly reset my resolution.

Other than that, I didn't encounter any bugs in the game at all - it was very playable. The graphics were good enough, but I didn't get any of the nifty PhysX effects since I wasn't playing with an NVidia card. In any event, the graphics did their job, and weren't at all distracting.

The premise of the game is that you are Faith, and she is a runner. The idea is to keep your speed up, and then pull off some pretty crazy stunts - leaping between buildings, running along walls, etc. When it works, the gameplay is great fun. Objects in the environment turn red to indicate the direction that you can go, which helps to keep downtime to a minimum (a must in this game). There were still a few spots where I didn't know where to go, but these were few and far between.

In addition to running, there is also combat. From the beginning of the game, it encourages you to not fight the enemies, but rather run away from them. This is generally good advice, since against the tougher enemies you can go down in as little as two hits. While this is a great idea, the problem is that there are some enemies that you must kill before proceeding (generally indicated by a red glow on the mob, and sometimes a voice over from another indicator telling you that you need to fight them). If there is only one enemy around, it's not too hard - you have a variety of movies, including a one hit take down that also disarms your opponent if you time it right.

The problem comes when there are multiple enemies attacking you at once. Since you can die pretty easily, this makes your actions crucial. Your disarm attack is quite involved, and if another enemy is shooting at you while your disarm his friend, you can easily die before the animation is done. This can get quite frustrating, since late in the game it will routinely throw four, five, or more enemies at you at once. While this is doable, it does cause you to replay the same segment many times until you get lucky and kill all of the enemies perfectly without dying.

The story is good enough, but largely forgettable. It did enough to keep you playing, but nothing spectacular.

While the combat has issues, when the game works it is really amazing. When you get moving, and perform all of the movies perfectly, it's great fun and shows exactly what this game is capable of. Since there is going to be a sequel, hopefully they'll improve on the running, and downplay the combat. That would make one amazing game.

Video Games Consoles vs PCs, Part II

| No Comments

Last month, I was considering whether to upgrade my PC or buy an Xbox 360. At the time, I came to the conclusion that I should stick with the PC (for a variety of reasons).

However, since then the topic has still been on my mind. While I have much history with gaming on the PC, the lure of the Xbox was very tempting. Not to mention that the PC is treated more and more as a second class citizen when it comes to gaming (with a few exceptions, of course).

What got me thinking about this even more is a new Xbox 360 bundle that will be released in a few weeks. It's a really good deal - for the price of the normal Xbox 360 Elite (the highest end model), Resident Evil 5, Super Street Fighter II Turbo HD Remix, and a Resident Evil theme for the Xbox dashboard.

The more I thought about it, the more that seemed like the right way to go. Nearly all of the talk on the gaming websites is only regarding consoles, and while there is the occasional PC story you really don't hear much about PC gaming anymore. Not to mention the fact that figuring out the "best" system to build or buy is extremely challenging in and of itself.

So today I placed a pre-order for the bundle. I will likely not worry about my PC at this point, and buy a copy of VMWare Fusion for my Mac so that I can continue doing Windows programming at home (likely using the copy of XP currently on my PC).

My plan is to use my 17" LCD (currently my PC monitor) for the Xbox, since it comes with a VGA adapter. This should give me a better picture than using our TV, since that is an old ~25" SD TV. I'd also like to use my computer speakers as well (which are pretty decent, and include a subwoofer), but I need to research an adapter for that. If nothing else, I can always use a headset and not worry about normal sound.

Now I just need to wait a few weeks for it to get here, and I can enter the world of games on an Xbox. Good stuff! :)

Hardcore Gaming and the Wii

| No Comments

M and I got our Wii last April (I think it even arrived on April 1, if you can believe that). Since they were still scarce at the time, we pre-orded a Wii bundle from EB Games. It included the Wii (with all the normal stuff - a Wiimote, nunchuck, Wii Sports), Wii Play, a second nunchuck, a Wiimote charger, Zelda: Twilight Princess, and Metroid Prime 3: Corruption. While it ended up costing us something like $450, it was nearly all stuff that we would buy anyway (well, maybe not Wii Play, but it's a good deal on a 2nd Wiimote, so it worked), and since it would get us a Wii without going to a million stores, it was a good way to go.

About the time that I finished Zelda and Metroid, Mario Kart Wii was coming out, so I pre-ordered it and it arrived shortly after its release date. Now that's a really good game - it has lots of re-playability to unlock everything. Its online play is great as well, since lag is pretty much nonexistent. Sure, it uses the evil friend codes, but that's just how Nintendo does things, sadly.

Luckily for me, right when I was starting to get bored with Mario Kart, Amazon had a sale on Wii games and I picked up Super Mario Galaxy and Super Smash Bros Brawl. Super Mario Galaxy is amazing (plus it was cool that M could assist as the second player), and Smash Bros has a ton of things to unlock, too. Good games.

Also during all this, M and I played through all of the Lego games - Lego Star Wars, Lego Indiana Jones, and Lego Batman. While Indiana Jones was very short, Lego Star Wars was insanely long. They're all pretty fun.

But after that...nothing. There just wasn't anything on the Wii that interested me after those games. It's like Nintendo front-loaded all of their game releases early in the Wii's life cycle because they thought no one would want to play them later, or something. The only game I've played since then is Force Unleashed, which wasn't all that great - so much promise, and it didn't follow through. At least I got it on sale, though.

Part of the problem might have been that third party developers and publishers assumed that the Wii would be just like the Nintendo 64 and Game Cube - not all that popular. Sure, the games by Nintendo would be good, but other than that no one would really care. Apparently no one was expecting it to be this popular.

Another problem is its hardware. While to some extent "graphics don't matter", when it comes to pure horsepower, there are things that the Wii just can't do that the Xbox 360 and PS3 can. This, naturally, limits the number of games that can be ported to the Wii from the other consoles.

In any event, the net result is that I haven't had much of a reason to use our Wii for the last six months or so. That is definitely not a good thing.

However, things are definitely looking up for 2009. The poster boy of hardcore Wii games, The Conduit, finally got a release date of June 9, which is excellent news. Thankfully there are other interesting games coming, too:

  • Tenchu: Shadow Assassins (out last week) sounds promising, but there are some mixed reviews initially. If nothing else, it's a step that this game got released on the Wii at all, though.
  • MadWorld, which isn't something that I would play, it's still good to see mature content developed for the Wii. That should help it shed its "kid only" stereotype, hopefully.
  • Muramasa: The Demon Blade also looks promising from what I've seen/read of it to date.
  • Sin & Punishment 2 looks like it was born to be played on the Wii. I picked up the original last fall on the Virtual Console, and it was a solid title. Sure, it was a bit hard to follow, but this was basically a Japanese release. I'm sure the sequel will be better suited to a non-Japanese audience.
  • House of the Dead: Overkill seems like it was tailor-made for the Wii, as well. The whole run and gun genre should work really well with the Wiimote.
  • And finally, the shocker last week that EA will be bringing Dark Space to the Wii. I don't think that anyone saw this coming, but it's definitely good news. I'm not sure how good/bad it will turn out, but hopefully EA will do it properly and not just blindly port the game. Given how much effort they are planning to put into the Wii this year, they will likely do it right.

At least from where I am looking now, 2009 looks to be much better than 2008 for the Wii. One interesting thing about this list is that only one game there is published by Nintendo (Sin & Punishment 2), and none are developed by them. While supposedly their developement teams are busy working away in Japan, nothing much has been announced yet. While it would be nice to see something from them in 2009, it's probably much more likely going to be 2010 before any of their games are released. If nothing else, this should give third party developers a chance to shine on the system without any competition from Nintendo. That is definitely a good thing.

New Program - Win7HotKeys

| No Comments

Since Windows 7 will finally add shortcut keys for minimizing, maximizing, and restoring the active window, I figured that it would be useful for me to get into the habit of using those keys. To that end, I wrote Win7HotKeys. It implements the same hotkeys as Windows 7 to minimize, maximize, and restore the active window.

Go to the Win7HotKeys page for more information. If you have any questions, comments, or suggestions, please let me know. :)

My Next Programming Project

| 2 Comments

Now that Yahtzee is nearly complete, my thoughts have started to turn to what to work on next. I have a few ideas.

The one idea that has been in my head since I started Yahtzee was to port/re-write it for Windows, using WPF. Not only would this let more people be able to use it (sadly, not everyone in my family has a Mac...for shame! ;), but it would give me more experience with using WPF. I'd say that I am doing pretty good with WPF currently, but my only experience with it has really been rewriting small personal apps that I use at work to automate a variety of activities (filling out my time sheet, entering bug reports, etc.). While that is good and all, they are all pretty small and don't do all that much. Yahtzee would be more complicated than that - but not too complicated.

Another idea I've had would be to automate how I keep track of our finances. For some history, I use a Numbers to do this currently. Yes, it would (probably) be better to buy an app to do this, but I haven't found one that I liked that also works how I want it to. Besides, I have a system, and it works, so I can't complain too much.

Granted, there is some room for error in my system which is never a good thing. While I have toyed with the idea of writing my own finances app in the past (and failed/gave up, multiple times), a better approach might be to come up with something that would make my current system more efficient. If nothing else, I wouldn't need to write much in the way of presentation and storage, since Numbers take care of that for me.

Now that Numbers '09 finally has support for AppleScript, one option would be to write a set of AppleScripts that would automate what I do manually. To take that idea one step further, maybe that should be a "real" app instead, that uses AppleScripts to put the data that I enter into Numbers for me. That could work.

Of course, at this point I'm getting perilously close to basically writing my own finances app. But, this does take a number of annoying issues out of the equation - how to store the data, and how to manage such large amounts of it that I will accumulate over time. Maybe it would be best to start with the AppleScripts themselves (since I would need to write those anyway), and if prompting for data there isn't working too well, write a Cocoa UI to wrap them.

The one downside to all this is that I currently own Numbers '08, which doesn't have said AppleScript support. Since I don't use Pages or Keynote much (the other two apps in the iWork suite), I would basically be buying AppleScript support in Numbers for $80. I haven't decided yet if that's worth that price or not.

In any event, I do have a few ideas to go with, so hopefully I'll be able to keep my programming juices flowing at home for the near future.

Yahtzee Progress

| No Comments

I've made some good progress on Yahtzee this past week. In fact, I think that I am mostly done with it! Players can take turns, and they're even notified when the game is over (and who won, of course). I have a work around for the bug that I mentioned last time (just tell the NSArrayController in the second window to update itself - not the best in the world, but it'll work). I need to test it with M a few times, but it should be mostly good to go.

I've had a few offers to test it as well, from people across the Internet. That will be a good test too, although I'm not sure why it wouldn't work. Only one way to know for sure, though.

The one feature that I've thought of that might be good to add would be some sort of chat feature. Currently, there is no in-game way for the players to communicate with each other. Sure, they could start up a separate IM chat or Skype call, but that doesn't seem to be the best way to handle things.

While chatting is easy enough to implement, the problem that I have doing so is how to display the text. I'm using an NSTableView to display the messages, and all is well if they are short. However, if the text is longer than is visible, the control appends "..." to what's visible instead of auto-sizing the column. Even better, I can't find any way to set the column to auto-sizing to contents. Nor can I find an easy way to tell it to wrap the text (I'd have to compute the height of the row myself, which is more work than I'd like to do, really).

Maybe for now I'll just leave things as-is and require a separate communication method of some sort. This just a quick and dirty app, after all - not something that I'm looking to sell or anything.

Overall, I think that this project went really well. The UI part of it was finished very quickly - that shows that I'm finally starting to get the hang of Cocoa for UI, thankfully. The client/server communication wasn't too bad, but it was definitely hindered by my lack of knowledge of general Cocoa/Objective-C APIs. That part should also get better with time and practice.

Recent Comments

  • Andy: The best way that I've found is to open an read more
  • Peter: Hi Andy, I loved your OmniFocus Applescripts. I was wondering, read more
  • Jared: Hi Andy, I got to your site through Stack Overflow read more
  • Andy: I fixed the typo. Thanks for pointing it out. :) read more
  • Anonymous: thanks for these. There's a minor typo that will break read more
  • Andy: Yahtzee just needs OS X 10.5, in theory PPC or read more
  • Bill Schott: Interesting. What are the requirement for Yahtzee? I wouldn't mind read more
  • Andy: Testing comments, just in case. read more