Development

Groovy quicksort

0

Very short post.. even my blogging style is aligning itself to the way groovy allows me to write code – i.e. quickly.

Shamelessly copied from Dierk Konig’s excellent book “Groovy in Action’, I bring you the groovy implementation of the quick sort algorithm…

def quicksort(list)
{
    if ( list.size() < 2 ) 
        return list
    
    def pivot    = list[list.size().intdiv(2)]
    def left     = list.findAll {item -> item < pivot}
    def middle   = list.findAll {item -> item == pivot}
    def right    = list.findAll {item -> item > pivot}
    
    return (quicksort(left) + middle + quicksort(right))
}

(For those not familiar with Groovy, findAll, closures and ranges are standard language features and this algorithm ties these concepts up so nicely…)
I’m quickly falling in love with Groovy… I can’t wait to see whats waiting for me in the Grails framework… (more on this when I have time to post)

A pre-alpha screenshot of my swarm in the game.

Sometimes, you just have to go with it…

0

A few weeks ago, I was chatting to Spencer (the designer of the MindHunters game I’m working on) about the cocos2d-x framework and how I would like to port Lumi over to the framework to allow Android users to be able to experience the game. The beauty of the framework is that it is an almost direct port to C++ from the original cocos2d-iphone framework which Lumi was built on, and since all of the game logic had been written in C++, all I needed to do was rewrite the Presentation Layer code to sit on top of cocos2d-x.

(more…)

The Deck Builder UI

MindHunters – Deck building

1

Today I’m going to tell you about the Deck Building feature in MindHunters.

As with any trading card game, the meta-game of deck building is vital, and is a direct reflection of a player’s intended strategy. It is likely that most players will spend a fair amount of time building one or more decks, and it is important that the interface is slick, pleasant, intuitive and most importantly, functional.

(more…)

Go go SFML!!

Picking a library…

2

Progress is being made on MindHunters (the Trading Card Game I’m working on). In fact, progress has been really good.

Effects are working on the server, and the game is much more playable (and enjoyable) via the testbed client. Its time to move onto developing the actual game client. This is where I am, and where I’ve been since last week Friday. Well, actually, last Friday I was wondering which framework I should use (if any) for developing the client. My choices were:

  • SDL
  • SFML
  • Cinder
  • Qt
  • Write my own OpenGL framework (not really an option)

(more…)

Progress on MindHunters

0

Tonight I finished the first functionally complete version of my Card and Effect designer for MindHunters. To say I’m happy with the result is an understatement. With this tool, I’ll be able to import updated versions of the card library and effects database quickly whenever they are sent to me and in the meanwhile focus on integrating effect resolution into the game.

Once the effects are integrated and working, I’ll have to move into serious development on the game client. Still aiming for early alpha near the end of the year.

MindHunters development

0

Lately I’ve been working on a new game that a friend of mine has designed. Its been grinding along quite nicely, and I’m really looking forward to getting to an alpha stage where we can open this up to a few people to help play.

Anyway, if you’re interested in following the overall development blog of the game, head over to http://mindhunters.icarus7.net

Lumi v1.5 with solution sharing…

0

The latest version of Lumi (and Lumi HD) has been released on the AppStore.
The most exciting part of this release is that I have finally provided players with the ability to share their solutions with others.

The solutions are submitted to the Lumi web portal located at http://lumi.icarus7.net and the solution are viewable under the (more…)

cocos2d-iphone: A Binary Clock

0

Here is a CCScene based Binary Clock implementation in cocos2d-iphone. I used 0.99.5 for this, but it should compile flawlessly on 0.99.4 as well…

ClockScene.h

//
//  ClockScene.h
//  BinaryClock
//
//  Created by Peter Mares on 23/02/2011.
//  Copyright 2011. All rights reserved.
//


// When you import this file, you import all the cocos2d classes
#import "cocos2d.h"

// HelloWorld Layer
@interface ClockScene : CCScene
{
	CCLabelTTF *_arrLabels[6];
}

+(id) scene;

@end

ClockScene.m

//
//  ClockScene.m
//  BinaryClock
//
//  Created by Peter Mares on 23/02/2011.
//  Copyright 2011. All rights reserved.
//

// Import the interfaces
#import "ClockScene.h"

////////////////////////////////////////////////////////////////////////////////////////////////

@interface ClockScene ()
- (void) onTick:(ccTime)dt;
- (void) updateClockDisplay;
@end

////////////////////////////////////////////////////////////////////////////////////////////////

// HelloWorld implementation
@implementation ClockScene

+(id) scene
{
	ClockScene *scene = [ClockScene node];
	return scene;
}

////////////////////////////////////////////////////////////////////////////////////////////////

-(id) init
{
	if( (self=[super init] )) 
	{
		CGSize winSize = [[CCDirector sharedDirector] winSize];
		CCLabelTTF *label = nil;
		float yOffset = 0;
		
		for ( int i = 0; i < 6; i++ )
		{
			yOffset = (i % 2) * 25;
			label = [CCLabelTTF labelWithString:@"0000" fontName:@"Helvetica-Bold" fontSize:16];
			// some arbitrary magic numbers to make it work - you can make this more dynamic...
			label.position = ccp( winSize.width / 2 - ( (1-(i/2)) * 100 ), winSize.height / 2 - yOffset);
			[label setColor:ccc3(255, 255, 255)];
			_arrLabels[i] = label;
			
			[self addChild:label];
		}
		
		[self updateClockDisplay];
		[self schedule:@selector(onTick:) interval:1];
	}
	return self;
}

////////////////////////////////////////////////////////////////////////////////////////////////

- (void) dealloc
{
	[super dealloc];
}

////////////////////////////////////////////////////////////////////////////////////////////////

- (void) onTick:(ccTime)dt
{
	[self updateClockDisplay];
}

////////////////////////////////////////////////////////////////////////////////////////////////

- (void) updateClockDisplay
{
	NSDate *now = [NSDate date];
	NSCalendar *calendar = [NSCalendar currentCalendar];
	NSDateComponents *components = [calendar components:NSHourCalendarUnit|NSMinuteCalendarUnit|NSSecondCalendarUnit fromDate:now];
	int timeComponents[6];

	// now transform the hours, minutes and seconds into binary nibbles
	timeComponents[0] = [components hour] / 10;
	timeComponents[1] = [components hour] % 10;
	timeComponents[2] = [components minute] / 10;
	timeComponents[3] = [components minute] % 10;
	timeComponents[4] = [components second] / 10;
	timeComponents[5] = [components second] % 10;
	
	// translate each component into a binary nibble string
	for (int i = 0; i < 6; i++ )
	{
		NSMutableString* str = [NSMutableString string];
		
		for ( int bit = 8; bit > 0; bit >>= 1 )
			timeComponents[i] & bit ? [str appendString:@"1"] : [str appendString:@"0"];
			
		[_arrLabels[i] setString:str];
	}
}

@end

cocos2d-iphone: Sliding menu (from Lumi)

15

When Lumi was being designed, I wanted to make the navigation through the level packs and levels as slick as possible. I had played enough iOS games to know that navigation makes a huge difference to a games impact on a player. We were aiming for a simple, almost obvious paradigm to allow players to navigate through the level packs and levels.
I realised that during the discussions, the word ‘pages’ was constantly mentioned, as in ‘when the player goes from this page to this page’ or ‘maybe we should let the player flip through pages of levels’… this was so obvious – we were even using it while discussing WHAT the navigation would be. So, pages it was. With that out of the way, I decided to go with a UI mechanism similar to what Angry Birds had done for their level selection mechanics, which was to allow the user to slide left/right to flip ‘pages’.

Initially I had the code doing the same thing (sliding left and right), and that worked really well, but after I saw the graphic assets and we discussed how the level pack graphics would look, I realised I had to move to an up/down sliding mechanism. Not a problem, a quick refactor, a new enumeration and voila!

So now that Lumi has been released, and is doing well, I thought I’d share the code behind Lumi’s sliding menu system.

WARNING! LOTS OF CODE COMING NOW…

(more…)

Lumi and Lumi HD have been approved and released on the App Store!

0

I’m extremely proud and happy to announce that our second game, Lumi, has been released for both iPhone and iPad this evening.

You can grab your free copy at the following links:

Lumi
Lumi HD

Go to Top