Monday, October 15, 2007

Log Visualiser using a particle system

I carried on my attempts to make logging output look a bit interesting, and what I think I wanted was a stream of pixels flowing down from a server name to give a waterfall effect. Each pixel streaming down would represent one log event, and the colour of the pixel would be determined by the log level of that event.

I set out to implement this, but then thought that someone else must have come up with a particle system for XNA already. And they have, check out this particle sample on the XNA Creators Club.

This sample shows how you can make explosions and smoke effects in XNA, and the end result is surprisingly realistic. I took this example and derived my own class from the abstract ParticleSystem class. It took some experimentation with the parameters I used, but now I've got a stream of pixels flowing in the way that I planned.

I've also got a mock application that just generates log entries for the XNA application, and I've generated 10,000 logging events in a very quick sequence. As the XNA application doesn't store the events for very long there doesn't appear to be much slow down, but it would be interesting to load test it against a number of servers generating a high volume of logs. At the moment I think there would be a slow down but I'm pretty sure I can refactor the event handling so that it will be more scalable.

There's some cleaning up to do, mainly with the positioning of new server entries and externalising a number of parameters to a config file, but I think I'm mostly there.

No comments: