Archive for the 'programming' Category

Introducing UnityBrighton

I’ve been watching Unity for several years now (thanks to James from Futurlab), but the fact that it was Mac-only was an instant turn-off. Earlier this year they released a PC version, which piqued my interest again, but I was unable to devote enough of my time to the free trial to actually learn anything. However,  as of October 28, 2009, they’ve scrapped the Indie version of Unity and released a free version!

This is great news for anyone who’s been interested in creating content in Unity. Not only is the plugin just over 3MB, but it’s an almost seamless install in all the browsers I’ve tried it in.

What’s so great about Unity? Excellent 3D support, and you can use either JavaScript or C# for development, which makes transition from programming Flash games quite attractive.

Check out the island demo over on lab.iestyn.net

Unity demo

So, this leads me to UnityBrighton.com. Back in March I registered the domain, but did nothing with it. I’m guessing there will be renewed interest in Unity, so I’ve finally got round to setting it up. For now it’s a basic Wordpress blog and a Google groups mailing list. If you’re interested in Unity, please join and say hello!

Bookmark and Share

AS3 BitmapData.hitTest() with rotation

I saw a tweet from @mesh today, asking about hitTest when one object is rotated. A bit of horrible hackery, and here’s the result. Warning, nasty thrown-together code! ;)

var red:Sprite = new Sprite();
red.graphics.beginFill(0xFF0000);
red.graphics.lineTo(40, 0);
red.graphics.lineTo(40, 150);
red.graphics.lineTo(0,150);
red.graphics.lineTo(0,0);

red.x = 40;
red.y = 40;

addChild(red);

var green:Sprite = new Sprite();

green.graphics.beginFill(0x00FF00);
green.graphics.lineTo(40, 0);
green.graphics.lineTo(40, 150);
green.graphics.lineTo(0,150);
green.graphics.lineTo(0,0);

green.x = 300;
green.y = 40;

addChild(green);

var useRotation:Number=10;

var redBmpData = new BitmapData(red.width, red.height, true, 0);
redBmpData.draw(red);

var useDimension:int = Math.ceil(Math.sqrt((green.width * green.width) + (green.height * green.height)));
var diffWidth:int = useDimension - green.width;
var diffHeight:int = useDimension - green.height;
var newBD:BitmapData = new BitmapData(useDimension,useDimension,true,0);
var angle_in_radians:Number = Math.PI * 2 * (useRotation / 360);
var m:Matrix = new Matrix();
m.translate((green.width / 2) * -1, (green.height / 2) * -1);
m.rotate(angle_in_radians);
m.translate(green.width / 2, green.height / 2);
m.translate(diffWidth / 2, diffHeight / 2);
var translatedPoint:Point = m.transformPoint(new Point(0,0));

trace(useDimension);
var greenBmpData = new BitmapData(useDimension,useDimension,true,0);
greenBmpData.draw(green,m);

/*var sampleGreen:Bitmap =new Bitmap(greenBmpData);
addChild(sampleGreen);
sampleGreen.x=200;
sampleGreen.y=200;
*/
green.rotation=useRotation;

stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

function onMouseMove(e:MouseEvent):void {
	green.x = mouseX;
	green.y = mouseY;

	if (redBmpData.hitTest(new Point(red.x, red.y),
	255,
	greenBmpData,
	new Point(green.x-translatedPoint.x, green.y-translatedPoint.y),
	255

	  )) {
		trace("hit");
		red.filters = [new GlowFilter()];
	} else {
		red.filters = [];
	}
}

I’ll blog a better example of this, with comments and an explanation of what it’s doing in the next few days.

Bookmark and Share

Fluid Dynamics in Flash

This is one of the most entrancing Flash experiments I’ve ever seen. Eugine Zatepyakin, a Flash Developer in Moscow, has created a rather stunning fluid simulation in AS3.  It’s a fantastic toy, and really quite inspiring. I must take a look through the code when I get some time.

Fluid dynamics

Simply stunning.

It’s based on work by Mehmet Akten, which in turn is based on this paper: Real-Time Fluid Dynamics for Games.

Bookmark and Share

Processing: Traer Cloth

Matt has posted another good abstract video of  some generative art created in Processing. This is a cloth simulation using the Traer Physics engine (correct me if i’m wrong!).

Here’s another great video by Matt:

Bookmark and Share

Hacker Spaces

Found on the Wired blog. Brighton so needs one of these!

Hacker Space
[update]: I see The Skiff is listed in the HackerSpaces wiki. Is it really a hacker space? Surely it’s more of a co-working thing? Perhaps they’re one and the same. Perhaps I just like the look of the photographs in the article.
Bookmark and Share

Arduino, Wii, Flash, Servos, Lasers, Papervision..

Recently I’ve been getting into all things electronic again. Strangely, I was doing this a year ago

Creating the Shopper 13 game sparked my enthusiasm, and I’ve been gathering new parts to experiment with:
Servos and header pins Making things talk

In addition to that, I’ve also got a Wii Nunchuck hooked up to my Arduino which I’m currently controlling Flash and Servos via the accelerometer and analog joystick. Oh, and a Laser.. and some Papervision too. When I’ve got something interesting, I’ll post it. Hopefully that’ll be in the next few days :)

Well I have to start building my robot army somewhere..

Bookmark and Share

Papervision experiment #3: 3D colour cube v2

A combination of the last two posts, with a few extra tweaks. This time it produces quite a pleasing blur if you click and hold down.

cube_blur

Bookmark and Share

Papervision experiment #2: 3D colour cube

Here’s another experiment along the same lines as the last one, with the same mouse controls. 

This time it’s 15,625 Pixel3D points, and the position in the cube defines the colour. 

I really like the moirre effect.

cube_1

Bookmark and Share

Papervision Experiment #1: Fire sphere

Recently I’ve been inspired to create some experimental things in Papervision. I think that it’s mainly down to Matt’s talk on generative art at FlashBrighton a few weeks back. 

Well, here’s the first.  in brief:

- Plot 9902 Pixel3D points evenly around the surface of a sphere
- Colour each one a random red
- Rotate the sphere depending on where the mouse is
- Apply a blur effect to a BitmapEffectLayer
- Change the clippingPoint 

I kinda liked the effect, so here we go. Hold the mouse down to push the sphere away.

Fire Sphere

Bookmark and Share

BAFTA nomination!

I’ve just had some great news. The Bow Street Runner Flash game that I worked on for Channel 4 earlier this year at Littleloud has been nominated for a Children’s BAFTA!
The competition is pretty tough, but, well, fingers crossed eh! :)

Update: We won!

Bookmark and Share