Tuesday, November 2, 2010

Event based world clock.

When I decided to implement gnome migration into your city in Gnome Mountain, I needed to come up with a world clock class, I came up with a pretty cool event based class that is very simple to implement and turns out to work very well.

Here is the code for the class: http://mage360.pastebin.com/9sNdwEjb

And here is an example of implementation: http://mage360.pastebin.com/b0yBYwtn

Tile edge detection for a smooth environment.

I found a great new artist for the Gnome Mountain project, and with that came new tiles for my environment, which meant I needed to add edge detection to make a smooth and better looking world.

Here is what the new Gnome Mountain is looking like with edge detection, new tiles and also new sprites: http://i52.tinypic.com/ny5t6w.png

For anybody that is curious, here is the code I use to detect edges: http://mage360.pastebin.com/6gEe3McP

Sunday, March 21, 2010

Event based KeyboardManager

I've written a keyboard manager class that calls events when a keyboard key is pressed, it uses the C# version of function pointers, called "delegates". It makes input handling much easier and cleaner, and provides events that are more useful than the raw XNA keyboard checking.

Class: http://mage360.pastebin.com/bRX9qd2s

Implementation example: http://mage360.pastebin.com/dAgsCEkn

Sunday, March 7, 2010

AStarPathfinder Implementation - Custom collisions and terrain.

I previously posted a customizable AStarPathfinder class for my PandaXNA game engine. Here I'm going to post an example of how it is implemented into Gnome Mountain in a customized way. The gnomes need to use ladders to move up and down in the game, but of course the PandaXNA engine doesn't know this, and it doesn't need to know. By implementing the getNodeMovementPenalty function in a derived class, you can specify how movement and collisions work in your game, while still using the core path finding of PandaXNA.

Updated AStarPathfinder class: http://mage360.pastebin.com/ckXfaeBB

Gnome Mountain Implementation (GnomePathfinder.cs): http://mage360.pastebin.com/nrBdV2GQ

Friday, February 26, 2010

AStarPathfinder

I've created an extensible and fairly simple implementation of A* pathfinding for the PandaXNA engine.

Video:
http://www.screentoaster.com/watch/stWE5RRUdIR19YQVRfWllcUVJc/simple_a_pathfinding

Here is the class:
http://mage360.pastebin.com/34xSMVby

Here is the implementation in Gnome Mountain:
http://mage360.pastebin.com/2QaAgT9p

Example of usage:

pathFinder = new GnomePathfinder(world);
pathFinder.initialise(worldRect.Width, worldRect.Height);

testPath = pathFinder.generatePath(new Vector2(0, 49), new Vector2(3, 35));

In case anybody is wondering about the basic theory behind A* pathfinding, here is a cool tutorial I found lying around the internet. It's very easy to understand and very informative: http://www.policyalmanac.org/games/aStarTutorial.htm

Saturday, February 20, 2010

BasicCamera2D

Another part of the game engine developed with the Gnome Mountain mini-project. This is a basic 2D camera class that can be easily extended.

Source:
http://mage360.pastebin.com/f3798a7d8

You'll also notice that the engine classes have been moved to a new project and namespace called "PandaXNA". This is now the name of the game engine that will be used by M.A.G.E.

Attribute tag personality

With my Gnome Mountain mini-project (using this to build up all the 2D parts of the game engine) I've decided to develop an attribute tag based personality system. This will be used for the Gnome AI.

The personality class:

An example of the use, checking if a gnome is a miner and finding him a job:
if (gnome.personality.hasAttribute(PersonalityAttribute.Miner))
{
if (findMiningActionForGnome(gnome, world))
return;
}

The system basically works using a Dictionary< Attribute, Skill Level > collection.

Wednesday, February 17, 2010

AnimatedSprite and an amazing video hosting website.

Here is my AnimatedSprite class:
http://mage360.pastebin.com/f2c03daf1

And here is a video showing it off, on an amazing video hosting website that lets you record your screen:
http://www.screentoaster.com/watch/stWE5RRUdIR19ZRFhYWFJdVlZV/sprite_animation_and_movement

Thursday, February 11, 2010

Sprite class v4

Just a small Sprite class update, I've added a flashing effect.

Source:

Game state management

I've created a class to manage the current game state. It's a very simple but flexible way to manage the current state of the game. I can just derive classes from the GameState class for anything from the main menu to the game in progress, and easily switch between states.

Here is a link to the GameState class source:

Monday, February 1, 2010

SpriteList v1

I've created a simple class to handle variable amounts of sprites from a single simple interface. This is called SpriteList.

Link to the SpriteList class:
http://mage360.pastebin.com/f3aaf313

Sprite class v3

The sprite class now has a scaling effect. Testing all effects together I have the sprite fading from 50 alpha to 255 alpha over 2 seconds, at the same time it is rotating counterclockwise by 180 degrees over 2 seconds. While both of those are happening it is also scaling to 3x the original size over 2 seconds.

This is the code being used to test the effects together:
test = new Sprite(Content.Load("Sprites\\Statues"));
test.position = new Vector2(50.0f, 50.0f);
test.setTransparency(50);
test.beginFadeEffect(255.0f, 2000.0f);
test.beginRotationEffect(MathHelper.ToRadians(-180.0f), 2000.0f);
test.beginScalingEffect(3.0f, 2000.0f);



Here is a link to the sprite class:
http://mage360.pastebin.com/f427b2e0b

Sprite class v2

The sprite class now has a rotation effect. Testing them together I have the sprite fading from 50 alpha to 255 alpha over 2 seconds, at the same time it is rotating counterclockwise by 180 degrees over 2 seconds.

This is the code being used to test the 2 effects together:

test = new Sprite(Content.Load("Sprites\\Statues"));
test.position = new Vector2(50.0f, 50.0f);
test.setTransparency(50);
test.beginFadeEffect(255.0f, 2000.0f);
test.beginRotationEffect(MathHelper.ToRadians(-180.0f), 2000.0f);

Here is a link to the sprite class:
http://pastebin.com/f68be73c6

Sprite class v1

Here is a video of my sprite class for doing 2D graphics, demonstrating the fade effect.



The sprite class source:

http://pastebin.com/f6fd08893

Early artwork.

What is M.A.G.E?

MAGE is an Xbox 360 indie game. I'm developing this to see if I can make a game that will pass the XNA Creator's Club review process and get onto the indie marketplace.

The game is about a fight between magicians in an arena setting. It's based on the idea of those mini games we've all played before where you need to somehow push an enemy off of a platform to win.

In this game you need to strategically use magic spells to cause all the enemy magicians to fall off of the main platform.

In this blog I'll be posting development information and maybe tutorials etc. Just things that I learn about XNA as I'm making this, because this is my first attempt at using XNA to build something.