Archive for the ‘Climate Conflict’ Category

Silverlight experimental edition out :)

Friday, December 4th, 2009

Jesper Niedermann has ported Klima Konflikt to a SilverLight edition for web using the SilverSprite engine.

Klima Konflikt in a browser - SilverSprite style

Klima Konflikt in a browser - SilverSprite style

It's really cool that it is possible to create a game that will run in both a browser, on an XBOX360, a PC and a Zune. Of course with modifications, etc. but stil...

(And yes - I know that's been possible with Java for years using Applets ;-))

Check it out : )

Plug-n-Play pathfinding

Wednesday, November 4th, 2009

I once implemented the A* (A-star) pathfinding algorithm in Java, and was ready to do it again in C# for the Klima Konflikt game, but while Googling a bit for referenceimplementations I stumbled across Eric Lippert's very, very elegant solution.
He has basically created a class with a static generic method which will pathfind on anything if you just supply:

1) Items which can tell what their neighbors are - by implementing:
interface IHasNeighbours
{
IEnumerable Neighbours { get; }
}
2) A "Begin" and "End" item
3) A function which gives an estimate on the expected distance from an item to an item (WalledTiles in my case).
The distance can be calculated easily using the Pythagorean theorem.
4) [optional] A function which returns a cost for a tile (based on a weighting system you decide).

Here's the signature for the method:

static public Path FindPath(
Node start, Node destination,
Func distance,
Func estimate)
where Node : IHasNeighbours

It took me 20 minutes to implement, just because I am fairly new to the idea of the Func keyword. Thank you Jesper for walking me through it :)
Pathfinding takes approximately 46 ms on our 10x10 tile board.

Screenshot from the current version of the game

Screenshot from the current version of the game

A very, very elegant solution - thanks Eric!

Playable singleplayer version out :)

Sunday, November 1st, 2009

It's amazing what you can do with a few wellplaced questions. The AI for controlling the Oilbarrel in Climate Conflict only has a handful of IF's, but actually does an okay job :)

I will write a proper AI, breadth-first A* algorithm or similar, weighting tiles that are in the opponent's possesion higher.

The entire game also needs some finish as the graphics and music still don't give a cohesive appearance. But we're still building the framework for reuse as we go along.

I'm pretty happy with the AI implementation. My idea is that it should be possible to instantiate a Controller class which then gives input to the gamecomponent to control. The Controller is so far implemented in three different types:

  • KeyBoardController - listens for the users Up/Down/Left/Right keys and request to move in that direction (if possible).
  • RandomController - tries to go in one of the open directions when it enters a tile
  • SimpleDirectionController - tries to move towards a specific tile. This is used to steer the opponent around after his restock-place, but is just as usable to make enemies chase you :)

The abstract base class GameBoardControllerBase is implemented with a method that moves a playing piece forward, and if the piece crosses the center of the tile it calls the methods that are to be implemented in the specific controllers:

protected abstract void SetWantedDirection(Sprite controllee);
protected abstract void UpdateDirection(Sprite controllee);

The first method asks for a wanted direction (e.g. random, based on keyboard, networkplayer's input, recorded, etc...) and then UpdateDirection checks to see whether that is possible right now and adjusts for the current state of the gameboard.

It's working a charm though I've had to write a LOT more Console.WriteLine's than I have in a long time to figure out what the */(¤%(/% the AI was thinking at times :)

Go download the newest release at http://klimakonflikt.codeplex.com and let us have some feedback.

</Jakob>

Our game is published on codeplex

Monday, October 26th, 2009

The weekend 16-18 October I attended the Indie 9000 game coding competition.

The concept is intriguingly simple. Be there friday by 1600 hours, find out who else codes in your language (flash/xna/java/gamemaker/etc.) and chat for a couple of hours.

In the evening the theme of the competition is announced. Last time (February) it was "Horror", this time it was "Climate disaster". That set the frame for entries in the competition and we were given till midnight to come up with ideas and at midnight the first competition was held: The Pitching Competition.
Competitors were given up to 10 minutes to pitch their idea. There were some very interesting ones, ranging from "Destroy the earth" where all people must be punished for destroying earth, using only the powers of Nature. Others put you in the role of Law Enforcer where you had to beat up demonstrators at a climate summit. Lotsa fun ideas being tossed around.
Here's a video from our pitching (yes - we were the only ones who made a little play ;-)) http://www.youtube.com/watch?v=HojmWezSkW8

People teamed up and found graphics artists, sound producers and coders. Till sunday morning we barely slept, making up for it with plenty of strong coffee and bad jokes :)

We didn't win either "Best GrafX", "Best Original Sound" nor "Best Game", but we would have won "Had The Most Fun" if there was such a prize :))

The game we ended up making is "Climate Conflict" where the Oil industry dukes it out realtime with the TreeHuggers. The fractions are symbolized by an oil barrel and a sack of seeds respectively spreading oilpuddles and sowing flowers. Check it out - we are currently building a level editor (Jesper Niedermann) and improving both handling and AI. As we improve the game the lessons learnt will find their way into this blog.

The title screen for Climate Conflict

The title screen for Climate Conflict

It is the first time I've worked with a project hosted on CodePlex, but it worked a charm. Using Visual Studio.net 2008 and AnkhSVN for synchronizing with CodePlex was a great learning experience.

The project is at : http://klimakonflikt.codeplex.com/

Keep ideas and comments coming :)

- Jakob