Monday 10 January 2011

Mariiiiines! We are leavinnnnggg!!!

So that I can post news, tutorials and you can see updates in some sort of organised manor, I bring you...

My new web site!

https://sites.google.com/site/sparkyallmighty/

This blog has become obsolete and will therefore no longer be updated! You'll have to check the website/forum for any updates from now on! Go nuts!

Thursday 6 January 2011

Collision Detection

I've been playing with a few features of blogspot and it seems I can keep track of how many visits each post has had, from what part of the world they came from, what OS and browser was used etc etc. Looking through all this I noticed quite a few people interested in the "Collision Detection" posts. One person even went as far as typing "Sparky's collision detection tutorials" into google. Though I gotta say originally this wasn't anywhere near the top of my list of priorities, it's now been shunted up to the top so that these people actually find what they are looking for. Check back again over the next couple of day's and I'll have some tutorials for you regarding collision and collision mapping.

Seeing through the problem

Well this colour issue was a bit of an anti climax. I was expecting it to take the entire evening but it seems I've actually done a good job in making the program thus far and as such I only needed to create a new method and then change 2 lines of existing code! Awesome!

Seeing as that took such a short time you'll be pleased to know that I've also restarted the particle engine. With new idea's rushing at me as usual it may become the case that I'll need a "Particle System" tool to create some funky new particle effects for use on the map and in battle scenes. Shiny shiny stuff.



For some lost folk who may end up here through google here's how to work with transparency in XNA 4.0:

Before in XNA 3.1 and below we could simply do the following to get a semi transparent white:

Color C = new Color(Color.White, 0.5f);

Nice and simple right? Create the colour "white" and set it's alpha channel to 0.5
Well it seemed that some people were getting a bit confused with Color's other constructors and the constructor

public Color(byte R, byte G, byte B, byte A)

had to be changed to accept int's instead of byte's. Why this affected the constructor that accepts a colour and a float is beyond me, but the constructor no longer exists. Visit our old friend Shawn Hargreave's for a bit more info on what confused people:
Shawn Hargreave's Blog

Worse still, you gotta jump through hoops to get the same effect. a sensible person would assume that creating a semi transparent white colour with the new constructors would be as simple as

Color C = new Color(255, 255, 255, 127);

Full Red, Full Green, Full Blue, Half Alpha
Errrrrmmmmm.....no.

The actual code you would need is

Color C = new Color(127, 127, 127, 127);

Why? Well wrap your head around this:
In XNA 4.0 we now need to apply the alpha to the individual colour components. In the case above the alpha is set to half. 255 being 100% and 127 being 50% so we needed to half the colour components as well. It seems a bit cack handed to me and I don't know why the old constructor was removed, but I decided to remake it in the form of a static method so that I can create semi transparent colours nice and easy

public static Color ColorCreator(Color colour, float Opacity)
        {
            int Alpha = (int)(255 * Opacity);
            int Red = (int)(colour.R * Opacity);
            int Green = (int)(colour.G * Opacity);
            int Blue = (int)(colour.B * Opacity);
            return new Color(Red, Green, Blue, Alpha);
        }

Notice how the opacity is taken as a float so that I can easily depict the opacity as a fraction between 0-1

This fraction then gets applied to the colour components of the colour that was passed through and a new set of int's are created to construct a colour using the new 4.0 constructor

XNA 4 point .....ohhhhhhhhhhh....

It seems upgrading to XNA 4.0 has gone smoothly in some respects and has caused some problems in another. It seems that they have fixed a few bugs in 4.0 and as such changed the way the code has to be used (basically accounting for the people who had no clue what they were doing, Microsoft decided to change some of the code so that it cannot be broken). This causes problems for me as these changes revolve around "Colour". Luckily in my case the only thing affected is transparency, but it means I have to sift through all the code I've done so far looking for instances where I may make something semi transparent. Not fun...

Up until now I've been working with Visual Studio 2008. Since 4.0 is only compatible with the new 2010 edition, I've also had to totally recreate the projects. Most of this was a simple copy and paste, but ye gods some of it was a pain in the bum!

Hopefully it will all be sorted tomorrow and I won't run into any more hiccups!

Tuesday 4 January 2011

Happy new year!

Well folks it's back to work tomorrow and therefore back to work on the game as well! (Yayyyy!) Just a quick update to let you know what's in the pipeline:

Updating to XNA 4.0
After doing a bit of research it seems they have made nice strides in terms of audio in the past few updates. Enough that I will benefit from it at least. For this reason everything will be updated to run with XNA 4.0. This may or may not cause a few issues at first but I'm sure it won't be too much trouble...he says...

Updating the particle engine
The particle engine does everything I want it to do, but it isn't the most elegant library in the world. I'll be updating the engine so that it's a bit more friendly and nicer to look at when calling it's methods! Seeing as how I need to update it to XNA 4.0 it seems like a good opportunity to re-factor the whole thing

Graphics and Audio engine
There are still a few things needed to make the map maker complete. Particles and water for example. But before I finish that I'll be starting on the game engine. More specifically, sprites and animated sprites (characters, treasuer chests etc...) and the music engine.

PC's (Playable Characters)
Once I've got the sprite classes sorted I'll start looking at creating everything needed for playable characters. Name, level, portrait, bio, position in party, anything that is going to be needed or could ever possibly be needed for a playable character whether it gets used or not will have to be accounted for.

So that's what you'll be seeing over the coming months. As things progress you'll start to see a lot more video's. Let's see what problems the new year brings ;)

Wednesday 29 December 2010

Boxes wrapped in shiny paper

Howdy folks. What with christmas being a time of fun and relaxation you may not be surprised to find that I haven't done an awful lot of work! That isn't to say that I've done nothing however. My annual visit to the grandparents on boxing day let me start off making the engine for the game. Or...at least that was the plan. I got side tracked looking at the new features of XNA 3.0 (well...I guess they're actually old features seeing as the latest version is 4.0) It seems I can use MP3's in the sound engine! Booya!! This is good news as it's gonna reduce the size of the game by a lot!

I didn't actually get round to making a lot mainly because I was researching these new features. It seems they come with there pro's and cons. Some of which were solved in 3.1, but if my memory serves, I've been making the libraries in 3.0 which means I'd have to recompile everything....that'd be a pain...

Look for more updates in the new year!

Monday 29 November 2010

Overdue

Well it seems that I completely forgot about making a video and went straight on to making more parts of the project! Thankfully a certain James Boote was there in a pinch to shout at me for not making said video. Things like particle effects and shaders are still missing along with the ability to save entire projects, but most stuff is covered. Have a butchers: