Ludum Dare 18 this Weekend!

Monday, August 16th, 2010

Dont think I have blogged about this yet, so im doing so now.

Im planning on entering the 18th Ludum Dare compo, starting this sat. This will be my very first entry and im quite excited!

For those not in the know the Ludum Dare competition is a competition for Indie Games Developers. You have 48 to make a game (practically) from scratch. Its a solo competition so I cant call in my partner in crime olip.co.uk to do the artwork for me.

Rules are as follows:

  1. You must work alone (solo).
  2. All game code and content must be created within the 48 hours.
  3. Games must be based on the theme.
  4. All libraries, middleware, content creation, and development tools are allowed.
  5. Source code must be included.

The themes for this edition of the compo are currently being voted on here.

I doubt I will be able to come up with much in the 48 hour limit, but im hoping to get at least something remotely playable!

Tags: , , ,

A Few Site Changes

Friday, August 6th, 2010

As im not out tonight I thought I would do a little work on the site.

I have been meaning to add the retweet and facebook buttons for ages. I have also updates the flash header to make it a little prettier :)

What d’you think?

Tags: , , ,

Gourmet Ranch

Wednesday, August 4th, 2010

I cant believe I haven’t talked about this yet.

I spoke about 6 months ago about joining a new startup called Playdemic as the Lead Flash Developer. I couldn’t say much at the time as we were in stealth mode. As our first product has been out for about a month however, I think its about time I wrote a blog post on the subject.

Gourmet Ranch is Flash game for face book that follows closely on the heels of the other Facebook game successes such as Farmville and Cafeworld. The premise is simple, you grow crops and animals in your fields and then when the time comes you harvest them and use them to bake recipes. Those recipes are then served to your waiting customers by your waiters.

As the lead flash dev on the project its my responsibility to code all the engine and game play elements. Despite my several years worth of experience with flash games this was a challenging project . Making a game that is a multiplayer game but not a multiplayer game (no client pushing) is definately not for the feint of heart.

Despite the challenges and the occasional heated moment during development I think the product we have produced is excellent and is superior to many of the similar games available on Facebook. The stats for the first month of the game are impressive as can be seen from the data gleamed from AppData.

The main challenge now is to continue the early growth we have seen and retain the existing users we have won. So that means players of the game should be looking forward to regular updates with new content and bug fixing :)

Anyways if you wanna check it out head over to facebook –> http://apps.facebook.com/gourmetranch/


Tags: , , , , ,

SWFt – Dependency Injection Component Based Game Framework

Sunday, June 13th, 2010

This is my first post of what I suspect will be many on the subject of SWFt.

What is SWFt I hear you cry? Well in a nut shell SWFt is an Entity-Component based game framework powered by Dependency Injection. Still confused? Well basically its a really nice neat method for making flash games. Still interested? Read on!

(more…)

Tags: , , , , , , , , , , , , ,

Funk IoC – A New Dependency Injection Framework

Thursday, April 8th, 2010

Twitter can be a funny beast, what makes it great can also make it poor. I use Twhirl which keeps me updated any time one of the people I follow tweets about something, the only problem is that so many people tweet that if I dont happen to see it within about and hour or so of the Tweet, ill miss it. This time however I was lucky enough to catch a tweet by @Joa about his new Inversion of Control and functional-programming-like library, Funk AS3.

As I have been getting well into RobotLegs (a Dependency Injection MVCS framework) recently I was extremely interested to hear about this new project by Joa who I respect very much as a brilliant coder not least because of his excellent work on low-level Flash byte-code optimisation (see Apparat).

Joa has taken a different approach to doing dependency injection. The approach most frequently used (and the one used in SwiftSuspenders / RobotLegs) is to use meta-data to declare to a number of variables for injection. You then map a class to be injected and instantiate it using the injector.

As an example, with Swift Suspenders you would define a class for injection with something like the following:

  1. class MyInjectedClass
  2. {
  3. public function sayHello(toSay:String)
  4. {
  5. trace("Hello "+toStay);
  6. }
  7. }
  8.  
  9. var injector : Injector = new Injector();
  10. injector.mapSingleton(MyInjectedClass);

Here we are telling the Injector to make a single instance of our class and hold it internally ready for when it is next requested, such as:

  1. class MyDependantClass
  2. {
  3. [Inject] public var myClass : MyInjectedClass;
  4.  
  5. public function performAction()
  6. {
  7. myClass.sayHello("World");
  8. }
  9. }

Here the [Inject] meta-data indicates that we want the framework to supply the class with an instance of type MyInjectedClass. The final part is to make an instance of the dendant class and inject into it:

  1. var dependant : MyDependantClass = new MyDependantClass();
  2. injector.injectInto(dependant);
  3. dependant.performAction();

As you can see this is a nice way of handling inter-module dependencies in your code, when coupled with a MVC framework such as RobotLegs it becomes and extremely powerful yet elegant way of coding.

It however isnt perfect and Joa, on his google code page mentions three drawbacks of this method:

  • Your injected properties are publicly exposed and mutable.
  • describeType is very expensive.
  • Steep learning curve.

This is where he suggests his alternative method, which is quite ingenious. Using the same example as above you would see something like the following:

  1. class MyInjectedClass
  2. {
  3. public function sayHello(toSay:String)
  4. {
  5. trace("Hello "+toStay);
  6. }
  7. }
  8.  
  9. bind(MyInjectedClass).asSingleton();

Then the dependant class would look like the following:

  1. class MyInjectedClass
  2. {
  3. protected var myClass : MyInjectedClass = inject(MyInjectedClass);
  4.  
  5. public function performAction()
  6. {
  7. myClass.sayHello("World");
  8. }
  9. }

And making an instance of it could be as simple as:

  1. var dependant : MyDependantClass = new MyDependantClass();
  2. dependant.performAction();

As can be seen there are some benefits to this method, the biggest one in my opinion is that injected properties dont have to be public as they are provided by the call from within the class scope rather than from outside.

So how does Joa perform this magic? By abusing a little used ability of the Actionscript programming language known as package-level-functions. These are throwbacks from the old AS1 & AS2 days of global functions. There are actually a couple of common examples in AS3 still such as getTimer() and getQualifiedClassName() still used. What Joa has done is to use these package level functions as a method of generating concise looking code reminiscent of functional programming.

Performance wise, im not entirely sure whether by using package-level functions instead of describeType() calls used in meta-data driven IoC frameworks is any faster as Till Schneidereit of Swift Suspenders suggests:

I don’t think that Funk’s approach is any faster than an optimized
metadata-based IoC container: describeType may be slow (as in “takes a
few dozen microseconds to run”), but is only ever called once for each
class an instance of which is injected into. After that, it’s just a
straight iteration over an array for all injection points instead of
Funk’s multiple method calls for each injection point.

So the next step for me is to run some tests to see how things pan out. Either way im very impressed with both approaches and cant wait to see what kind of exciting advances will be developed in the coming months.

Tags: , , , , , , , , ,

Scribble v0.1 … Harmony, but in Flash.. kinda!

Thursday, March 25th, 2010

Well as you can probably tell from my last few posts, I have been loving the simple browser drawing app called Harmony. Well, while playing with it I thought to myself, “Is there a reason this cant be done in Flash?”. Well this is the answer to my question.

I have called it Scribble and its very basic at the moment, not containing even many of the simple features in Harmony, I do however intend to keep adding to it. So over the course of several weeks I hope to add bit by bit till it becomes a fun little place to Scribble!

Anyways, you can check out the current state of the thing here –> http://www.mikecann.co.uk/flash/Scribble_v0-1/Scribble.html

Splendid!

Tags: , , , , ,

Trance Around The World, Show Downloader

Friday, March 5th, 2010

Had this little idea a while back, thought I would spend an hour tonight and bash it out.

I love the Trance Around The World radio show by Above and Beyond, downloading  it for listening later is very annoying however and involves some fiddling with browser source and other things, so to make life easier I built this little tool. What it does is grab the HTML from the above and beyond page then parse it for the MP3 file, then it uses the FileReference class in flash to download it to your HD.

Anyways, enough jibber jabber. Source is enabled:

Please upgrade your Flash Player This is the content that would be shown if the user does not have Flash Player 9.0.115 or higher installed.

Hope you enjoy!

Tags: , , , , , , , ,

Resizeable Chromeless Window AIR

Monday, February 22nd, 2010

Thought I would share this little ditty. Been working in AIR recently and decided to make the window “chromeless” which means there are no controls so no resizing.

Thankfully however adobe provide the tools to allow for resizing the native window. So I produced this little mxml component to let you resize the window:

The coloured edges indicate where the application is draggable, including the white corner areas.

The component that lets you do this is pretty simple:

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo">
 
<fx:Script>
<![CDATA[
import flash.display.NativeWindowResize;
import flash.events.MouseEvent;
 
import mx.managers.CursorManager;
public static const RESIZE_AREA : int = 10;
 
protected function onRollOver(event:MouseEvent):void
{
}
 
protected function onRollOut(event:MouseEvent):void
{
}
 
protected function onMouseDown(event:MouseEvent):void
{
var grp : Group = event.target as Group;
var resizeFrom:String = "";
 
if (grp==topSide){ resizeFrom=NativeWindowResize.TOP;	}
else if (grp==rightSide) { resizeFrom=NativeWindowResize.RIGHT; }
else if (grp==bottomSide) { resizeFrom=NativeWindowResize.BOTTOM; }
else if (grp==leftSide) { resizeFrom=NativeWindowResize.LEFT;	}
else if (grp==topLeft) { resizeFrom=NativeWindowResize.TOP_LEFT;	}
else if (grp==topRight) { resizeFrom=NativeWindowResize.TOP_RIGHT;	}
else if (grp==bottomRight) { resizeFrom=NativeWindowResize.BOTTOM_RIGHT;	}
else if (grp==bottomLeft) { resizeFrom=NativeWindowResize.BOTTOM_LEFT;	}
else { return; }
 
stage.nativeWindow.startResize(resizeFrom);
}
 
]]>
</fx:Script>
 
<s:Group id="topSide" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="0" y="0" width="{width}" height="{RESIZE_AREA}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0xFF0000" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="rightSide" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="{width-RESIZE_AREA}" y="0" width="{RESIZE_AREA}" height="{height}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0x00FF00" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="bottomSide" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="0" y="{height-RESIZE_AREA}" width="{width}" height="{RESIZE_AREA}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0x0000FF" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="leftSide" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="0" y="0" width="{RESIZE_AREA}" height="{height}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0x000000" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="topLeft" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="0" y="0" width="{RESIZE_AREA}" height="{RESIZE_AREA}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0xffffff" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="topRight" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="{width-RESIZE_AREA}" y="0" width="{RESIZE_AREA}" height="{RESIZE_AREA}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0xffffff" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="bottomRight" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="{width-RESIZE_AREA}" y="{height-RESIZE_AREA}" width="{RESIZE_AREA}" height="{RESIZE_AREA}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0xffffff" />
</s:fill>
</s:Rect>
</s:Group>
 
<s:Group id="bottomLeft" rollOver="onRollOver(event)" rollOut="onRollOut(event)" mouseDown="onMouseDown(event)"
x="0" y="{height-RESIZE_AREA}" width="{RESIZE_AREA}" height="{RESIZE_AREA}">
<s:Rect width="100%" height="100%">
<s:fill>
<s:SolidColor color="0xffffff" />
</s:fill>
</s:Rect>
</s:Group>
 
</s:Group>

To use it in your app just add the component into your existing view somewhere:

<?xml version="1.0" encoding="utf-8"?>
<s:SkinnableContainer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo">
 
<components:WindowResizer width="{width}" height="{height}" alpha="0" buttonMode="true" />
 
</s:SkinnableContainer>

Setting the alpha to zero will obviously hide the coloured areas at the side of the window.

Grab the mxml here: WindowResizer.mxml

Tags: , , , , , ,

The Scale of the Universe in Flash

Wednesday, February 3rd, 2010

Got sent this today by a friend who linked to Newgrounds upload.

I think its actually quite genius:

It reminds me old the old powers of 10 video:

Tags: , , , , ,

Jessie Warden – Flash & Flex Videos

Tuesday, February 2nd, 2010

Thought id mention these videos as I have been watching them and really like the content. They are a series of video blog posts by one of the ‘celebrities’ of the Flash and Flex world, in which he talks about lots of stuff related to whats going on in the industry and the various frameworks he uses or recommends (or doesnt). He also has a few things to say about beer, which is a bonus!

Anyways theres three of them so far, and can be watched over on his blog:

1 vs Many, Mediator vs Presenter, 30 mins – JXLTV – Episode #1
Conferences, Why Frameworks, Cairngorm 3 – JXLTV – Episode #2
Apple’s iPad, HTML5 Video, Gaia Flash Framework – JXLTV – Episode #3

Tags: , , , , ,