ClanWATCH – v0.2.0 BETA

January 27th, 2012 No comments

Download and try ClanWATCH v0.2.0 BETA: Click Here

Those of you who in the know will be aware that myself and Jabbslad have been working on a joint project for the use by clan members.

ClanWatch_Main

Starting with a PC version we decided to create a ‘messenger’ style application which would be used to see who out of the clan is online at any time.

The  application launches and you are given the GUI shown to the left which lists all of the clan members and various details about them. These include things such as the gamer picture, gamer score, gamer tag and last known status e.g “Playing Battlefield 3 in the menus”.

The application also distinguishes which users are online and groups them together at the top of the list as well as changing the highlight behind the gamer tag from yellow to green.

The way it gathers this information is using a web service which Jabbslad wrote. The web service polls the XBOX Live website to gather the information and then provides it as a JSON stream. ClanWATCH queries the web service and interprets the data to produce the list.

ClanWatch_Popup

As well as the GUI, the application has a notification system which will give a small popup from the system tray to let you know when a user comes online. It is still very basic in what it shows (see right) but there is plenty of scope for future additions.

There are quite a few ideas in the pipeline about how the application can grow with other details we could show such as reputation etc and possibly implementing some sort of messaging as well.

The eventual aim will be to port the application to iOS so that it can be used on iPhone. This will be a longer term goal for the project though.

For now you can download and try ClanWATCH v0.2.0 BETA: Click Here

Categories: Uncategorized Tags:

Tutorial: XNA Log file

October 23rd, 2011 1 comment

Download logfile.cs

This tutorial covers how to create a simple yet effective log file for your XNA projects. First of all I must pass some credit to David Amador, who first gave me the idea for doing it.

The class itself is not really specific to XNA, it is more a generic C# log file class. However, as I use it primarily for XNA and that is often what get’s ‘Googled’ I figured that was the best way to put it to a tutorial.

Before starting, it should be noted that in it’s current form it is designed for use on a Windows PC. With some work it could probably be used as a framework for use on XBOX etc.

So what namespaces do we need for this class? Answer – not many just a few basic ones most importantly the IO one for actually writing out to the file.

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

Next we require a couple of enums for the class. The first of them being LogType which is used to tell the class what type of message is being sent to the log file writer

public enum LogType
{
    ERROR,
    WARNING,
    INFO
};

Next is an enum which ‘filters’ the messages beings sent to the log file. for example in a Debug build you would most likely want to see all messages INFO, WARNING and ERROR but in a release build you would only want to see ERROR messages.

public enum LogLevel
{
    NONE,
    ERROR_ONLY,
    ERROR_WARNING,
    ERROR_WARNING_INFO
}

Finally the class itself. The code is reasonable well documented and easy to follow so just go ahead and have a look. If you do have problems I will happily assist.

public class Logfile
{
    #region Fields and Properties

    /// Name of the log file
    const string LOGNAME = "Log.html";

    /// <summary>
    /// Is logging active.
    /// </summary>
    static public bool Active
    {
        get { return _active; }
        set { _active = value; }
    }
    static bool _active = false;

    /// <summary>
    /// Filter level at which to log messages
    /// </summary>
    static public LogLevel DebugLevel
    {
        get { return _debugLevel; }
        set { _debugLevel = value; }
    }
    static LogLevel _debugLevel;

    // internal flag to show the log file is ready for use
    static bool _initialised = false;

    #endregion

    #region Functions

    /// <summary>
    /// Initialise the the log writer.
    /// </summary>
    static public void Initialise()
    {
        _active = true;
WINDOWS
        StreamWriter textOut = new StreamWriter(new FileStream(LOGNAME, FileMode.Create, FileAccess.Write));
        textOut.WriteLine("<span style=\"font-family: Kootenay; color: #000000;\">");
        textOut.WriteLine("ZAM Engine Logging - Zamlab Productions. ");
        textOut.WriteLine("Log started at " + System.DateTime.Now.ToLongTimeString() + "</span><hr />");
        textOut.Close();
if

DEBUG
        DebugLevel = LogLevel.ERROR_WARNING_INFO;
e
        DebugLevel = LogLevel.ERROR_ONLY;
if

        _initialised = true;
    }

    /// <summary>
    /// Add an entry to the log.
    /// </summary>
    /// <param name="type">Type of entry to add e.g ERROR</param>
    /// <param name="text">The text to put in the logfile.</param>
    static public void Write(LogType type, string text)
    {
WINDOWS
        if (!_active || !_initialised || (DebugLevel == LogLevel.NONE))
            return;

        string startText = "";

        switch (type)
        {
            case LogType.ERROR:
                if (DebugLevel >= LogLevel.ERROR_ONLY)
                    startText = "<span style=\"color: #660000;\">" + System.DateTime.Now.ToLongTimeString() + " : [ERROR] : ";
                break;
            case LogType.WARNING:
                if (DebugLevel >= LogLevel.ERROR_WARNING)
                    startText = "<span style=\"color: #000099;\">" + System.DateTime.Now.ToLongTimeString() + " : [WARNING] : ";
                break;
            case LogType.INFO:
                if (DebugLevel >= LogLevel.ERROR_WARNING_INFO)
                    startText = "<span style=\"color: #009900;\">" + System.DateTime.Now.ToLongTimeString() + " : [INFO] : ";
                break;
        }

        text = startText + text + "</span><br />";
        Output(text);
if
    }

    /// <summary>
    /// Write the text to the file.
    /// </summary>
    /// <param name="text">Text to be written to file.</param>
    static void Output(string text)
    {
WINDOWS
        try
        {
            StreamWriter textOut = new StreamWriter(new FileStream(LOGNAME, FileMode.Append, FileAccess.Write));
            textOut.WriteLine(text);
            textOut.Close();
        }
        catch (System.Exception e)
        {
            string error = e.Message;
        }
if
    }

    #endregion
}

All that you need to know now is how to use it. It is very very easy. The class is a static one and so all you will need to do is the following: Call Logfile.Initialize() to start the log file and then whenever you want something logging call Logfile.Write(LogType, string).

There is plenty more that you can do to extend/customise the class for yourself for example changing the formatting of the log file including fonts, colours, layouts etc.

The log file is created in the bin folder of the build directory with the name from the constant. For the class as it is now here is an example of how it looks:

logfile

 

Categories: Programming, Tutorial Tags: , ,

New Pictures & Programming Update

October 16th, 2011 No comments

Finding it hard to keep to my promised of a photo a day for the 365 Days gallery. I have been busy with work and just general social stuff but I am taking and uploading pictures as and when I can.

Uploaded a couple more today of some nice flowers that Lindsey has just planted – seemed as good a subject as any to snap.

I have also resurrected my game engine in XNA. The existing engine had some good content but also some ‘borrowed’ code and things which were a bit messy to say the least.

I have decided to take a different approach to it this time and rather than fight to come up with a game to develop, I am treating it like a tech demo. Once the core is ready (which it almost is) I will start building components. For example the first of these will be a particle system. Over time I will eventually build up enough content to make the development of a game much more straight forward (apart from the idea which always stumps me…!).

I have put some placeholder pages down for the programming sections of the site and will start to fill them with content as soon as possible.

Zamma

Photography

October 11th, 2011 No comments

While I try to learn how to use my camera and the techniques which make a good picture a friend made a nifty suggestion. They had another friend who a year or two back was doing the same thing and to help them, they made an effort to post a picture a day along with details of the camera settings.

This to me was a great idea as it serves not only for reference but also as a way to see yourself getting better (hopefully) as time goes by.

With this in mind I went ahead and set it up on this site. So far it has four days worth of photographs. I would love to hear and comments or suggestions about the photos as at the moment I am a complete beginner.

Categories: Photography Tags:

Zombie Einstein Games – Project Emergence

October 11th, 2011 No comments

So I thought I would give a quick mention to this. I recently became involved with some guys who had started to put together a team to work on a game.

I have a history in the industry and ever since leaving to work in a new area I have tried to keep myself interested with little projects (which I will start to include on this site). When the opportunity came up to be part of a group of people working on something which has the potential to be pretty damn good, I jumped at the chance.

We all have full time jobs and live dotted around the UK but with the power of the net this is proving no problem.

Progress has been fairly slow at the moment as the hefty design documents are being thrashed out with the help of Google Docs but hopefully we will be able to start getting our hands dirty soon.

You can find the team blog here – Zombie Einstein Games

A Fresh Start

October 10th, 2011 No comments

Welcome to my 2nd, 3rd… erm who knows what attempt I am up to, at a blog. Up until last week the blog only contained 2 posts of pretty meaningless content, so lets hope for something better this time.

First of all I spent a few days finding a theme I was comfortable/happy with and making a couple of tweaks to fit how I wanted it to work. Then came the important widgets for such important things as Twitter etc. Feel free to ask if you are interested in which I chose.

So what is the blog for? Well I’m not terribly good at dishing out random musings so it is more going to be a place for documenting my hobbies and interests as I develop them, in particular programming and more recently photography.

It’s still very early days for the site and so content is a bit thin on the ground but I hope to change that as quickly as I can.

I look forward to hearing feedback, whether it be good or bad (as long as it is constructive).

Zamma

Categories: Uncategorized Tags: