Thursday, March 28, 2013

Run Multiple Tasks in a Windows Service

ServicesBase.Run(ServiceBase[] services) ...that sure made me think you could run multiple implementations of ServiceBase in a single Windows Service; but that is not how it works.

One Service, Multiple Tasks

I often have a very simple use case: I needed to run multiple tasks in a single windows service. For example, one task to poll some email notifications, and one task to listen to HTTP requests that might trigger those same notifications.

I like the basic setup of OnStart, Run, and OnStop, but after authoring several windows services I got tired of writing the same code over and over again. Thus I created the WindowServiceTasks library. Now whenever I need to do another task in a service, I just implement the WindowsServiceTaskBase or WindowsServiceLoopBase class, and my code is all ready to go!

WindowsServiceTasks

Run multiple tasks in a single WindowsService, and let the base library do all of the work setup and tear down for you. The WindowsServiceTasks NuGet package is simple, flexible, and extremely light weight.

Example

public static class Program
{
    public static void Main(params string[] args)
    {
        var logger = new Logger("Demo.log");
        var emailTask = new EmailServiceTask(logger);
        var failTask = new FailServiceTask(logger);
 
        var service = new Service1(logger, emailTask, failTask);
        service.Start(args);
    }
}
public class EmailServiceTask : WindowsServiceLoopBase
{
    private readonly ILogger _logger;
 
    public EmailServiceTask(ILogger logger)
    {
        _logger = logger;
    }
 
    protected override int LoopMilliseconds
    {
        get { return 2000; }
    }
 
    protected override void HandleException(Exception exception)
    {
        _logger.Log(exception);
    }
 
    protected override void RunLoop()
    {
        // TODO Send Email!
        _logger.Log("EmailServiceTask.RunLoop - Sending an email");
    }
 
    public override void OnStart(string[] args)
    {
        _logger.Log("EmailServiceTask.OnStart");
    }
 
    public override void OnStop()
    {
        _logger.Log("EmailServiceTask.OnStop");
    }
 
    protected override void DisposeResources()
    {
    }
}
Shout it

Enjoy,
Tom

Sunday, March 17, 2013

Castlevania 3DS - Demo Review

TL;DR - After only 5 minutes, it's pretty terrible.

I had the privilege of attending E3 last year and seeing the premier footage of Castlevania: Lords of Shadow - Mirror of Fate. At the time, was I excited! Enjoy a good Castlevania game, my favorites being Dracula's Curse and Symphony of the Night. These were games that classic hack and slash platforms; they were engaging, colorful, and just down right fun to play.

Before I review the demo, I want to comment on the title, of which this game has three: 1) Castlevania 2) Lords of Shadow 3) Mirror of Fate. This game is a spin off of a reboot of the Castlevania franchise. This name made me wary because it seemed, at least to me, to imply a lack of identity or originality in this game itself.

...but enough hearsay, let's get to the demo!

Starting The Demo

I launched the demo and my first thought of the title screen just looked generic, so I immediately launched the game. First the loading screen popped up and showed me the controls for the game, which seems a like a large number of buttons/abilities to dump on the users one second into the game. Also, it did nothing to help set the atmosphere or tone of the game. On the other hand, I like that there was no distracting, interrupting, or hand holding tutorial.

Once the game loads the then camera zooms around our protagonist in front of a giant castle and then you are left to run across a bridge. There was no dialog or exposition, which could be fine, but then I'm not sure who I am or even if this is Dracula's castle. Some headings or subtitles could have been useful to help set the scene.

Slow Clunky Combat

Once I ran I immediately had to fight some skeletons, one of which had a shield. I took a few swings with my whip, which felt slow and clunky, and it seemed to do very little to no damage to the enemies. I then moved to jump away from their attacks only to find that my character could not move until his attack animation was done, making him get clobbered by the shielded skeleton.

After mindlessly whacking away at the skeletons for a while, and taking a decent amount of damage while I was at it, I finally manged to kill one; and then a big game pausing modal popped up telling me that I had killed an enemy and earned experience points. This completely sucked me out of the immersion of the game, I stopped fighting and had to read a completely useless piece of ugly text telling me something that I already knew...not a good start!

An Under Powered Protagonist

I finally managed to kill other two skeletons and proceed forward. I then killed two more little skeletons, each taking 4 or 5 hits to take down. This was also bothersome because it made my main character feel extremely weak. I am a vampire hunter single-handedly charging into what I can only assume is Dracula's castle, and it takes me 5 attacks to kill a single entry level skeleton? That is not at all impressive.

So now, after struggling to kill 5 skeletons, the first mini boss appears. It is a big fat unmemorable armored guy with a wreaking ball flail, at whom I proceed to swing my whip. Each time that I hit him he flashes red but I there are no damage animations or pauses, nor is there a health meter anyone on the HUD; so even after a dozen attacks I still have no idea how much damage I am doing to him, if any at all. However a tool tip did appear on the screen telling me to press R to hold the enemy, but every time I pressed R absolutely nothing happened.

...and so I died on the first mini boss.
...multiple times.

A Second Opinion

At this point I was very disappointed and frustrated by the demo because, despite any particular complaint I had with the game, I was simply not having fun. My girlfriend was waking up around this time and asked me what I was doing, and so without making any comments or explanations I had passed her my 3DS XL and had her try to demo.

She is usually better than me at most games, and she died on the first set of skeletons! She complained numerous times that she could not jump away from them when they attacked, and she also noted that the tool tip telling her to press R did absolutely nothing. Of course I then explained that I had experienced the exact same problems while I was playing the game, and we both agreed that this was a pretty shitty game,or at least a pretty shitty demo.

(Hours later I had a friend of mine try this demo and got very similar reactions from him. His solution to the shielded skeleton was to jump over it and run away, because he did not think that it could be killed.)

I should have stopped there, but I really wanted to give Castlevania another chance to win me over.

The Boring Boomerang

I finally beat the first mini boss and proceeded into the next room in the castle. Visual this room was bland and boring, and made me run across it for seemly no reason. However at the end of the room, I got my first secondary weapon: the boomerang. This got me excited, that was by far the best secondary weapon in Castlevania 3, and I was immediately stoked about trying it out. Right on queue, some bats broke through a window in the background and volunteered themselves for boomerang target practice.

When I threw the boomerang at the bats, nothing happened. I mean the boomerang left my hand a few into the bat, but the bat did not react! The boomerang just stuck out of him with no auditory or visual queues as to the bat being injured, let alone killed. I had to throw three boomerangs into one bat to kill it, and then three more into another, until finally I was out of boomerangs and had to kill the final bat with my stupid whip.

When you first get the boomerang in Castlevania 3, you use it to fight zombies and a single boomerang rips through and destroys dozens of zombies at a time! It was powerful, it was cool, it was infinitely better than this latest iteration's piece of crap.

Final Verdict

Gameplay - 3/10
The controls are sluggish, the weapons are weak, and ammo is limited. This game does not feel like a fun fast paced Castlevania, it plays like a slow boring iOS clone.

Graphics - 6/10
The game looks pretty good, but it uses a very dark and drab color pallet and none of the art itself stands out in any way. Also, there are no impressive spectacles in the intro, just rooms with flat backgrounds.

Music - 0/10
This soundtrack is so bland and forgettable that I had to go back and replay the demo to just see if there was any music at all. This is elevator music, not what a Castlevania game should sound like.

Story - N/A
I like it when games start out quick and do not get bogged down in complex exposition, but Castlevania: Lords of Shadow - Mirror of Fate -- Demo Edition --- We Love Titles ---- On the 3DS eShop has the opposite problem; I am not even sure what castle I was in.

I really hope that this demo is not indicative of the final game, unfortunately it is a pretty safe bet that it is.

Game on,
Tom

Real Time Web Analytics