CAB OutlookBar

Friday April 21st, 2006 @ 11:19 AM by Chris

CAB OutlookBar

One of the things I’ve seen asked about Component Application UI Block, with a fair degree of regularity, is how to implement an OutlookBar style navigation control. This happened to be something I wanted to do as well, so I dug into the CAB a bit and wrote a pretty simple version of it.

You can download the code here.

This control does not implement any functionality for the thin, blue “grabber” bar in Outlook that allows you to hide some of the buttons. That was a functionality that I haven’t needed yet, and being short on time I haven’t been able to poke around and figure out how to do it. If anyone implements it I’d love to see the results.

How It Works

This control implements the necessary CAB infrastructure so that you can treat it just like a ToolStrip or MenuStrip. Your Modules & WorkItems can dynamically create and add buttons to the OutlookBar and attach CommandHandlers. It also exposes, through a property, a DeckWorkspace in the non-button area. When you create the OutlookBar in your shell you need to add the DeckWorkspace to the RootWorkItem’s Workspace collection so all Modules & WorkItems have access to it. They can then create SmartParts to plug into this space. In the screenshot above the PayrollWorkItem has created a SmartPart with a ListView that is displaying my name and a little “male” icon.

Implementation Details

This control requires the implementation of four classes: ItemCollection (so the OutlookBar can manage its items, but more importantly so the CAB can add/remove items via the UIAdapter), ItemCommandAdapter, UIAdapter and the UIAdapterFactory.

The OutlookBar implements the ISmartPartInfoProvider interface as well. By default it has a ZoneName of “OutlookBarZone”. However, the ZoneName is exposed through a property so you can change it at creation (prior to adding to WorkItem.Items collection) and plant it on a different zone if you so choose. Or you can just plant it on any other Workspace.

The background images for the header and buttons are .bmp files embedded into the project as resources. Feel free to replace them, write custom drawing code, or take advantage of XP themes. If you do, I’d like to see the results!

Using The OutlookBar

First thing that needs to be done is to register the OutlookBarUIAdapterFactory and the OutlookBarItemCommandAdapter with the CAB (best done by overriding the AfterShellCreated method in the ShellApplication class):

IUIElementAdapterFactoryCatalog catalog = RootWorkItem.Services.Get<IUIElementAdapterFactoryCatalog>();
catalog.RegisterFactory(new OutlookBarUIAdapterFactory());
ICommandAdapterMapService mapService = RootWorkItem.Services.Get<ICommandAdapterMapService>();
mapService.Register(typeof(Button), typeof(OutlookBarItemCommandAdapter));

Then I create my OutlookBar:

OutlookBar outlookBar = RootWorkItem.Items.AddNew<OutlookBar>();
RootWorkItem.UIExtensionSites.RegisterSite("OutlookBar", outlookBar);
RootWorkItem.Workspaces.Add(outlookBar.WorkSpace, "OutlookBarDeckWorkspace");
RootWorkItem.Workspaces["ShellZoneWorkspace"].show(outlookBar);

Adding a button from a Module:

Button button = new Button();
button.Text = "Payroll";
button.Image = MyProject.Modules.Payroll.Properties.Resources.payroll;
RootWorkItem.UIExtensionSites["OutlookBar"].Add<Button>(button);
RootWorkItem.Commands["LoadPayrollWorkItem"].AddInvoker(button, "Click");

And then provide a CommandHandler…

Adding a SmartPart to the OutlookBar’s DeckWorkspace (from a WorkItem):

SomeSmartPart smartPart = this.Items.AddNew<SomeSmartPart>("OutlookBarSmartPart");
RootWorkItem.Workspaces["OutlookBarDeckWorkspace"].Show(smartPart);

Conclusion

That’s my implementation. There’s probably better ways to do it. I’d be very interested in seeing what others have done. I’m always looking for ways to improve my code.

If my code helps you at all, please drop me a note and let me know.

Posted in | 9 Comments »

PowerTabs.net Has Been Shut Down

Wednesday April 19th, 2006 @ 9:35 AM by Chris


PowerTab

This is a sad development. Yesterday I logged on to powertabs.net to see if anyone had managed to tab Dream Theater’s Raise the knife, only to find that I needed to login to the site, something I’ve never had to do before. I went through the process of establishing a username and password, browsed to the Dream Theater section and then discovered that all of the tabs on PowerTabs.net were no longer available.

What the heck?

It turns out that the Music Publisher’s Association has taken it’s legal battle to the web and are shutting down sites that provide musicians with song transcriptions.
Their complaint is that these web sites rob artists of a valuable revenue stream that comes from selling guitar tabs and song scores. Lauren Keiser, president of the MPA says (via the BBC news):

“The Xerox machine was the big usurper of our potential income,” he said. “But now the internet is taking more of a bite out of sheet music and printed music sales so we’re taking a more proactive stance.”

There’s just one problem with all of this: the tabs available on Powertabs.net are not copies from legitimate books sold by publishers. They are, in fact, hand-constructed tabs that musicans have deciphered by ear. The folks at PowerTabs.net have always been very explicit in their instructions that files uploaded to PowerTabs.net be the work of the person submitting it, and not a copy of an existing tablature book.

Musicians all over the world have used their own skill, brains and ears to decipher the recordings of their favorite artists and songs since music was invented. The only difference now is that they can take these deciphered scores (that they have created by themselves) and transcribe them into a PowerTab files so that the program can play them back in realtime using MIDI technology. This is not a trivial process. The files are then uploaded to a website (like powertabs.net) to share with other players, for free. This is an invaluable resource for musicians who want to learn songs from their favorite artists, but lack the time or skill to decipher such songs themselves. And as far as revenue is concerned, most of the songs on PowerTabs.net don’t even exist in a legitimate tablature book in the first place!

The MPA’s claim on this issue is absurd and wrong. This is nothing like Xeroxing an existing tablature book. These musicians are doing this using their own resources, namely their ears, brains and skill. They are robbing no one.

What I don’t understand is, how can an entity like the MPA legally tell someone not to transcribe a song if they so choose? Where is the legal precidence that says a person cannot decipher another person’s musical work? And once the song is transcribed, why can’t that person share it with a friend? If they are making no money from it, then there’s no legal infraction here. And that is precisely what guitar players are doing. They are sharing their own creations with each other. Instead of doing it one-on-one, they use the web.

I hope when this goes to court that the MPA gets exactly what they deserve: a good ass-reaming from the judge for being a bunch of jerkoffs. They should be ashamed of themselves. If they want to attack people who are copying published work then I’m all for that. I hate piracy. But I’ve been using the PowerTab archive for a couple years now and I know how it works. These are not copies of published work. These are musician’s interpretations. There are songs on PowerTabs.net that I’ve never seen in any tablature book anywhere; I’d gladly buy them if they existed. But they don’t, so I use Powertabs. Many times the transcriptions on PowerTabs.net are imperfect. That should be clue #1 that artists are not having their official tab books “Xeroxed”.

Fortunately, if you’re like me and you’re still looking for PowerTabs you can find mirrored archives:

pta.acidpit.org
powertabs.phiross.org
www.allpowertabs.com (courtesy of Jack Holmns)

P.S. Bonus points if you name the artist and song of the transcription at the top of this post.

Posted in | 13 Comments »

On Oblivion: Part I (Combat)

Monday April 17th, 2006 @ 8:03 PM by Chris

Oblivion Combat

There’s no doubt that Oblivion looks great. It’s setting a pretty high bar for future video games; substandard graphics are not going to be acceptable for much longer. But how does it play? I’ve had a week to dig into this game and it’s time for some real analysis.

The first thing to note is that combat has been revamped from Morrowind, and this is a welcome change. Morrowind (Oblivion’s predicessor) had overly simplistic combat; just click a button and your weapon would swing. You could perform three different attacks with a sword: lunge, horizontal slash or overhead chop. Each weapon in the game would tell you specific attack that did the best damage and there was a setting in the game that would allow you to always attack with the best attack, like Horizontal Slash. Thus, you could simply click a button and make your best attack every time. Due to that, combat was boring.

Oblivion’s combat has been significantly changed. Weapons don’t have different values of damage based on attack style now, they just have a base damage rating. This makes it easier to determine which weapon is better when comparing loot or items in a store. But that’s not the really great change. The best part is that the action has changed; you no longer just click your button and swing your sword. There’s more to it than that. Things have become a bit more complex since Morrowind.

The base attack is still made by clicking your mouse and this will cause your weapon to swing. A couple fast clicks with cause your character to make two quick attacks in rapid succession. But the real improvement is that characters now have access to several “Power” attacks in addition to the standard attack and that has changed combat significantly.

Power attacks are made by holding the mouse button down for a second before releasing it. This “delayed” mouse click action, performed in conjuction with the movement keys in one of the four basic directions (forwards, backwards, left/right) will cause your character to perform a “Power” attack, that does more damage, yet sacrifices some endurence/stamina. The animations for these attacks are well done and the damage benefit from performing them is significant. On top of that, as you level up the power attacks gain additional abilities, like paralyzation or knockdown.

What’s great about this system is that the Non-player characters (NPC’s) also use it, and by doing so they create a more complex combat encounter. Certain power moves have extended animations that take time to complete. This can create significant delay between attacks as an opponent must finish their current move before beginning another. What this does is open up windows of opportunity for the player to strategically advance or retreat and attack when the opponent is in a compromised position, instead of just charging into the enemy and clicking as fast as possible. It becomes very important while playing Oblivion to try and time your attacks between your enemy’s swings, or to retreat and block attacks while they are swinging at you. Combat as a whole feels a lot more interesting, engaging and fun.

That said, the overall combat system in Oblivion is still much like it was in Morrowind; it’s basically one-on-one, and heaven forbid you have to defend against multiple opponents at the same time, because you’ll be dead. For me, this is a major disappointment.

The area of multiple target engagement is where Morrowind, and now Oblivion, have failed miserably as far as I’m concerned. Games like Everquest 2 and Neverwinter Nights are shining examples of how multi-enemy encounters can (and should) be done. In addition to tough fights against very difficult individual foes, they frequently pit the player against groups of opponents. They do this by throwing weaker enemies at the player. Instead of a fight against one tough monsters, they pit the player against a half-dozen weaker monsters, substituting numbers for strength. This is not only fun (makes the player feel a bit more heroic) but it also opens the door to a whole new range of area-of-effect (AoE) spells and tactics.

Area of effect spells are a blast in pretty much any game environment. I enjoyed Neverwinter Nights: Hoards of the Underdark quite a bit because the higher you get in the Advanced Dungeons and Dragons system, the more access you have to powerful, AoE spells. Being able to fear several enemies so you don’t have to fight them all at the same time is enjoyable from a strategic standpoint. Being able to perform combat moves than whirl your character in a giant arc, slicing all nearby opponents is a blast. Everything about multi-enemy fighting is fun in these games. It also helps make your character feel more “heroic” because they can wade into the thick of battle and come out alive.

Sadly, Oblivion misses this opportunity by miles. The encounters in Oblivion are frequently so difficult that engaging more than one enemy at a time is suicide. Part of the problem with Oblivion is that all encounters scale to the level range of the player, so you are never getting stronger than your opponents. In fact, leveling up in Oblivion is anti-climactic because of this auto-scaling. It robs the player of the sense of satisfaction that comes from beating old enemies. I can’t count how many times in Morrowind I attacked something that wound up kicking my ass. But after several levels I would return to that dungeon/encounter much stronger and exact my revenge. Sadly, this element of gameplay is gone from Oblivion (it did exist in Morrowind and this is one of the few things that its predicessor has over the sequel).

With the auto-scaling of the opponents comes an inability of the game engine to throw multiple, easier enemies at the player. There are simply no encounters where you are pitted against a dozen monsters with an arsenal of AoE spells at your command. If you do find yourself up against four or more opponents in Oblivion (as I have discovered) then you are facing certain death.

And Oblivion’s spell system, almost an exact carbon copy from Morrowind, doens’t do anything to help. Almost all spells are single target spells designed to either aid you (the player) or hurt a single enemy in combat. This makes fighting any more than one opponent a dicy proposition. I’ve died several times already just fighting two enemies at once.

Another very bad aspect of combat in Oblivion is fighting with allies. This was a rare occurance in Morrowind as you spent most of the game alone, pitted against the denizens of evil. But the developers of Oblivion have attempted to enhance the combat experience by frequently placing allies at your side for specific quests and events. This would be very welcome addition to the game play if not for the clumsy combat engine of Oblivion, which has your allies frequently dashing into the middle of the fight right as your sword is trying to come down on an enemy. In nearly every fight I have participated in that involved allies I have wound up slashing my teammates. This causes ones allies to quickly turn into enemies, creating more frustration. Any attempts to “be careful” and not strike your teammates usually causes your allies die quickly from rapid enemy attacks. They simply move around too much to make fighting as a team beneficial or fun.

Overall, the combat in Oblivion is still lacking in several areas. I find it rather disappointing considering the sheer number of contemporary games that have better encounter systems. How come no one at Bethesda (the developers of Oblivion) noticed this? Even very old games, like Baldur’s Gate, have combat that is more fun and involves more enemies. Bethesda has done a remarkable job with the graphics of the game (and the AI of the NPC’s, but that’s another post) and they have improved Oblivion’s combat compared to Morrowind in a significant way. But video games do not live in isolation, and it is more than fair to compare Oblivion’s combat to other games. When you make that comparison it becomes very clear that Oblivion just doesn’t stack up.

It’s better than Morrowind, and that’s a start. But I think Bethesda has a long way to go in the combat department.

Posted in | 1 Comment »

You’ve Never Seen An Easter Egg Hunt Like This

Friday April 14th, 2006 @ 2:27 PM by Chris


Octavarium

Sometimes genius isn’t appreciated until long past its time. Such was the the plight for legendary film director Orson Wells. His movies were often met with lukewarm critical praise and commercial failure. Yet today, the man responsible for Citizen Kane, often regarded as one of the best, if not the best, film of all time, is regarded as a genius. Entertainment Weekly ran a nice piece this week on Wells concerning his film Arkadin. Hollywood didn’t truly appreciate Wells until he was gone, and apparently Wells knew that would be his fate. EW quotes him as saying, “God, how they’ll love me when I’m dead….”

And Wells was right.

The same fate probably awaits Dream Theater, the group responsible for Octavarium.

I’ve long thought that the members of Dream Theater are the modern day equivalent of Bach, Motzart and Beethoven. They are the most theoritically knowledgeable and technically sound musicians of the modern day. Heck, they’re probably better than anyone has been for 100 years. And the music they create is unlike anything you’ve probably ever heard. It is the most complex, sophisiticated, intelligent and technicially proficient stuff to come along - ever. On top of all of that, they write great songs too.

Dream Theater released Octavarium last year (2005). When I first listened to it I thought it was good; certain songs and passages immediately vaulted to the top of my favorite list. But I didn’t see the genius behind it. I didn’t think it was anything more than another solid effort from a group of musicians who had long ago surpassed the writing and performing skills of every other modern musical act on the planet. After all, these are the guys that make the Dave Matthews Band look like 12-year-olds practicing for the state fair in their garage.

But then I ran across this website. It is nothing short of a fully detailed analysis of all the hidden nuggets, Easter Eggs if you will, embedded in the album Octavarium. And boy, are there a lot of Easter Eggs…

If you’re familiar with the Circle of Fifths then you will enjoy the theme underneath Octavarium. For those of you who don’t know a lot about music theory, let me give you a quick explanation:

An octave on the piano consists of five black keys and eight white keys. An octave begins and ends on the same note, completing a circle. It is that circle, that concept of ending where we begin, that is the basis for the album Octavarium. The numbers 5 and 8 reoccur all over the album; they are embedded everywhere.

But the Circle of Fifths isn’t the only hidden theme of the album. There are references to the Alcoholic’s Anonymous 12-step program (a theme that was started in an earlier album and is continued here) as well as references to other musical acts that have inspired/influence Dream Theater. The opening to the song Octavarium sounds eerily like the beginning of Pink Floyd’s Shine On You Crazy Diamond, one of many intentional immitations/references. There comes a point later in the song where James LeBrea (lead singer) does an impression of Megadeath’s Dave Mustain that is so perfect in its tone and inflection that one wonders why Mustain’s band never sounded this good. Even the lyrics to the song have embedded references:

sailing on the seven seize the day tripper diem’s ready
jack the ripper owens wilson phillips and my supper’s ready
lucy in the sky with diamond dave’s not here I come to save the
day for nightmare cinema show me the way to get back home
again

Can you count the number of references in that section? Don’t cheat. Think singing that might be a problem? Listen to the track and you’ll be blown away at what Dream Theater achieves with this song.

And they aren’t done yet. A heartbeat at the end of the song These Walls beats at 58 bpm. The starting piano note to the first song of the album is F, the same note that ended the previous Dream Theater album. Not to leave the circle open, the final song on the album also begins and ends in F.

I’ve touched about 2% of the Easter Eggs.

You really have to check out the dissection to appreciate everything Dream Theater achieved with this work. Once you see it all layed out in staggeringly accurate detail it becomes clear that Octavarium is a work of sheer musical genius.

Now listen to the album. To hear the actual music is mind-blowing. How anyone could create this work is beyond me. Yet they did it. Motzart would weep with joy if he could hear this.

Seeing the dissection of Octavarium reminded me of the ending of The Sixth Sense. I thought it was a good movie, I liked Bruce Willis and Haley Joel Osment, but I didn’t see the genius of the movie right away while I was watching it. That is, until the final moments of the film when The Twist is revealed. It was in that moment when the true genius of the film comes into focus. I saw it for the brilliant work it really was. If that ending wasn’t there it would simply have been another decent movie, but greatness would have eluded it.

Listening to Octavarium without being aware of the nuggets is like watching the first 90 minutes of The Sixth Sense. It’s good, but you can’t appreciate the greatness of it without knowing all the details. Only after you know The Rest Of The Story does the genius of the work come into focus.

Octavarium probably won’t be appreciated by the mainstream music culture while the members of Dream Theater are alive. Only prog-geeks like myself will have much respect and admiration for it. But this is an album, and more specifically a song, that music historians will point to, debate and dissect for decades, if not centuries. There is no doubt in my mind that Octavarium is a landmark in the history of music. It’s like the Beatles White Album, or Beethoven’s Fifth. It’s just that special.

Enjoy the Easter Egg hunt.

Posted in | No Comments »

Welcome To Oblivion

Wednesday April 12th, 2006 @ 10:39 AM by Chris

When I first started playing PC games (about 15 years ago) there was a game called Betrayal at Krondor. It was a game based on a book by Raymond E. Feist, a fantasy author of some renown. It was also my introduction into the world of Fantasy gaming. Up to that point I’d never played a fantasy game or even sat down at a table and ventured with friends in an imaginary Dungeons and Dragons world. It was a completely new experience for me.

Compared to other games released around the same time Betrayal at Krondor was a technological step backwards. It wasn’t nearly as graphically inspiring as other contemporary games. But it had a charm and magic to it that I later learned were wholly unique to the world of fantasy roleplaying games. It was a game based around characters and story instead of shooting things. I found the whole experience to be wildly entertaining and would frequently find myself staring at the computer screen in the early hours of the morning after a long night of game play wondering where the time had gone.

My only real complaint with Betrayal at Krondor was the game world itself. It was a completely flat world with sharp “mountains” that blocked passage, forcing the character along the game’s roadways. These “mountains” were merely triangles pointed skyward, the most rudimentary of geometric objects. This sort of design was necessary because computers in that day and age didn’t have the power to create photo-realistic worlds.

Betrayal at Krondor (1993)

Betrayal at Krondor

I loved playing Betrayal at Krondor because of the story, character development and combat, but in my mind I always yearned for the future of gaming, hoping that one day processing power, graphics development and programming prowess would bring me a more realistic world.

That day has arrived.

Yesterday I picked up Oblivion, the fourth title in the Elder Scrolls saga. I’ve played the previous installments, Daggerfall and Morrowind, and really enjoyed them. But like their predecessors before them, those titles had a flat world with triangle “mountains” in the way. Oh, Morrowind looked real enough - it was by far the best looking game I’ve seen when it came out. And the landscape was not “flat” either. But the mountain ranges in Morrowind were simply updated copies of the impassable triangles from 1993. You couldn’t actually climb over most of them.

Oblivion has changed that.

Elder Scrolls IV: Oblivion (2006)


Oblivion

What you see in the screenshot above doesn’t just look like a mountain range you might find in Idaho, Washington or Oregon, but it behaves like one too. You can actually ‘hike’ your character up and down every ridge you see. It is utterly amazing.

I spent about four hours playing Oblivion yesterday. The first couple of hours are spend underground in some catacombs, and indeed a vast majority of the gameplay takes place in various well-designed and awesome-looking dungeons. But what blew me away immediately was my exit from the catacombs and the sheer breathtaking beauty of the outside world. The province of Cyrodiil, where Oblivion takes place, is amazing to behold. Never before have a seen a game world this realistic. I’ve spent a good portion of my life bowhunting and attending archery tournaments in various locations throughout Idaho and Washington. I never thought I’d ever see a game that could come close to mimicking the sort of outdoor environments that I am accustom to seeing in the real world. But finally I have.

Oblivion has raised the bar for all games that must now follow it. And not only graphically, but in other areas. However, I’ll save those commeents for another post, otherwise this one will become far too long to read. For now, I’m just basking in the beauty of the game world itself and slowly plodding along, taking it all in. I’ve never seen anything like this. It is a crowning achievement in video game design.

Posted in | 1 Comment »

« Previous Entries Next Entries »