Enexis Pipeline Game Online

Today the Enexis pipeline game (Gridded) is going public! I created this game for a game developing agency called ‘Playability‘. The design is done externally. Enexis, an ‘Energy Grid Manager’ company focussed on recruiting technical people.
In this game you can connect pipelines to build a constructive way to your goal. Just a simple game with some complex game mechanisms. The developing process was really fun to do! This game can also be played on the social community site Hyves, for which I created an opensocial gadget and where I used the Hyves API to retrieve the necessary data.

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

25-Line Actionscript Contest

Today I saw a really cool website, called 25-Line ActionScript Contest! Something that I want to share with you. It’s a website (blog) where anyone can upload swf files that contains max 25 lines of code. $%^&* amazing stuff if you ask me! Every month all contributed work will be archived.

One of the work that is created January 2009 is this one (author: Grégoire Divaret):

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

This all in actionscript:

[SWF(width=1000, height=800, backgroundColor=0xffffff, frameRate=30)]
var stw:int = 1000, sth:int = 800, container:Sprite = addChild(new Sprite()) as Sprite, bd:BitmapData = (container.addChild(new Bitmap(new BitmapData(stw, sth))) as Bitmap).bitmapData, sh:Shape = new Shape(), lines:Array = [], nLines:int = 50, nPts:int = 20, ran:Function = Math.random, tmp:Object, acc:Vector3D, fr:Number = 0.87, aPos:Vector3D = new Vector3D(), tPos:Vector3D = new Vector3D, mScale:Number = 15, gr:int = ran() * 175 + 55, gv:int = ran() * 175 + 55, gb:int = ran() * 175 + 55, isNeg:Boolean = container.useHandCursor = container.buttonMode = true, letter:Array, w1:Object = {scale:(tmp = 73), x:stw / 2 - Number(tmp) * 3, y:sth / 2 - Number(tmp) * 2.5, letters:[[0, 0, 1, 0, 2, 0, 2, 1, 2, 2, 1, 2, 0, 2, 0, 3, 0, 4, 1, 4, 2, 4], [6, 0, 5, 0, 4, 0, 4, 1, 4, 2, 5, 2, 6, 2, 6, 3, 6, 4, 5, 4, 4, 4]]}, w2:Object = {scale:(tmp = 40), x:stw / 2 - Number(tmp) * 9, y:sth / 2 - Number(tmp) * 2.5, letters:[[0, 0, 0, 1, 0, 2, 0, 3, 0, 4, 1, 4, 2, 4], [4, 0, 4, 1, 4, 2, 4, 3, 4, 4], [6, 4, 6, 3, 6, 2, 6, 1, 6, 0, 7, 1, 8, 3, 9, 4, 9, 3, 9, 2, 9, 1, 9, 0], [13, 0, 12, 0, 11, 0, 11, 1, 11, 2, 12, 2, 11, 2, 11, 3, 11, 4, 12, 4, 13, 4], [17, 0, 16, 0, 15, 0.5, 15, 1, 15, 1.5, 16, 2, 17, 2.5, 17, 3, 17, 3.5, 16, 4, 15, 4]]}, w:Object = w1;
for (var i:int = 0; i < nLines; i++) for (var j:int = 0; j < nPts; j++) ((lines || (lines = []))[i] = lines[i] || []).push( { pos:new Vector3D(mouseX, mouseY), vel:new Vector3D(), cr:((isNeg = i%2 == 0) ? gr : 0xFF - gr) + ran() * 50 - 25, cv:((isNeg) ? gv : 0xFF - gv) + ran() * 50 - 25, cb:((isNeg) ? gb : 0xFF - gb) + ran() * 50 - 25, dir:(ran() > 0.5) ? -2 : 2, t:0, lPos:int(ran() * w.letters[i % w.letters.length].length / 2) * 2 } );
addEventListener(MouseEvent.MOUSE_DOWN, function():void { w = (w == w1) ? w2 : w1;})
addEventListener(Event.ENTER_FRAME, animate);
function animate(e:Event):void
{
	bd.lock();
	bd.fillRect(bd.rect, 0xFFFFFFFF);
	for (var i:int = 0; i < nLines; i++)
	{
		springTo((tmp = lines[i][0]).pos, tmp.vel, tmp.target = (tmp.t-- <= 0) ? (tmp.t = ran() * 10 + 1) && new Vector3D(Math.random() * 20 - 10 + w.x + w.scale * (letter = w.letters[i % w.letters.length ])[tmp.lPos = Math.max(Math.min(tmp.lPos + (tmp.dir *= ((letter[tmp.lPos + tmp.dir] == undefined) ? -1 : 1)), letter.length - 2), 0)], Math.random() * 20 - 10 + w.y + w.scale * letter[tmp.lPos + 1]) :  tmp.target, 0.05);
		springTo(tmp.pos, tmp.vel, (Vector3D.distance(tmp.pos, new Vector3D(mouseX, mouseY)) < 100) ? new Vector3D(tmp.pos.x - mScale * (mouseX - tmp.pos.x), tmp.pos.y - mScale * (mouseY - tmp.pos.y)) : tmp.pos);
		sh.graphics.moveTo(aPos.x = tmp.pos.x += tmp.vel.x *= fr, aPos.y = tmp.pos.y += tmp.vel.y *= fr);
		for (var j:int = 1 ; j < nPts; j++)
		{
			sh.graphics.lineStyle(15 * (1 - j / nPts) + 1, (j / nPts * lines[i][0].cr << 16) | (j / nPts * lines[i][0].cv <<8) | (j / nPts * lines[i][0].cb));
			tPos = aPos.clone();
			springTo((tmp = lines[i][j]).pos, tmp.vel, ((Vector3D.distance(tmp.pos, new Vector3D(mouseX, mouseY)) < 100) ? new Vector3D(tmp.pos.x - mScale * (mouseX - tmp.pos.x), tmp.pos.y - mScale * (mouseY - tmp.pos.y)) : tmp.pos));
			aPos = new Vector3D(tmp.pos.x += tmp.vel.x *= fr, tmp.pos.y += tmp.vel.y *= fr);
			sh.graphics.lineTo(tmp.pos.x = tPos.x, tmp.pos.y = tPos.y);
		}
	}
	bd.draw(sh);
	sh.graphics.clear();
	bd.unlock();
}
function springTo(pos:Vector3D, vel:Vector3D, target:Vector3D, spr:Number = 0.01):void{vel.incrementBy(Vector3D((acc = target.subtract(pos)).scaleBy(spr)) || acc)}
 
// 25 lines ends here!

Just take a look: http://www.25lines.com

ROXIK Sharikura 3D Physics Lib

Vandaag was ik onderzoek aan het doen naar physics in Actionscipt 3.0. Tijdens het zoeken stuitte ik op deze site terecht: http://temp.roxik.com/ Erg stoer hoe physics en 3D gecombineerd zijn! Zelfs met een depth-of-field filter loopt deze benchmark verbasend goed..

De creatieve Masayuki Kido heeft een as3 library geschreven die dit allemaal eenvoudig mogelijk maakt, zonder dat je een wiskundige genie hoeft te zijn. Helaas is deze library nog niet open-source. Masayuki schrijft op zijn blog dat de engine nog niet volledig af is en dat het nu nog alleen wordt gebruikt om zijn privé werk weer te geven. Over een tijdje zal deze library open-source gaan, zo staat op zijn blog: http://manfred.dschini.org/2008/06/17/sharikura-available-public/