Tag Archive for 'actionscript'

From Flash to Unity: My first Unity game – Iron Man Upgraded

Unity has been on my radar for a few years now, but it was only when it was released for PC that I started to get involved. Over the past few months I’ve been working on a number of prototype games, and this is the first game that’s now live. So here we go! It’s called Iron Man Upgraded, and it was produced for Marvel by BAFTA-winning Brighton studio Littleloud.

Play it in your browser now!

Play it in your browser now!

Moving from Flash to Unity has been a fantastic experience, and the one thing that sticks out the most is that it’s so much fun! There’s also a huge wealth of Unity resources on the web, and the community is incredibly helpful. With the choice between JavaScript, C#, and Boo, it’s not difficult to move from making Flash content in ActionScript 3 to producing exciting projects in Unity. Did I mention there’s a free version of Unity? Go and get it. Now!

Unity has to be the hottest technology out there. With version 3 – out in summer – you’ll be able to export for PC, Mac, web, iPhone, iPad, Android, PS3, Wii, 360.. it’s stunning, and it’s a far cry from anything that could be produced in Papervision / Away3D.

Unity has to be the hottest technology out there. With version 3 – out in summer – you’ll be able to export for PC, Mac, web, iPhone, iPad, Android, PS3, Wii, 360.. it’s stunning, and it’s a far cry from anything that could be produced in Papervision / Away3D.

I have a session in a few weeks at FlashBrighton called ‘An Introduction to Unity’, if you’re local it would be great to see you there! I’ll answer any questions I can.
I’ll also be posting tutorials on Unity, on here and www.unitybrighton.com – so stay tuned!
Bookmark and Share

Flash Apps for iPhone announced!

Amongst other exciting announcements at the Adobe Max conference they’ve just announced Flash Apps for iPhone!

This is absolutely awesome news – ActionScript programmers can create apps for the iPhone. There’s more information here.

A few questions spring to mind:

  • What will performance be like?
  • Can we take advantage of all the hardware, such as accelerometers, GPS, etc?
  • When can I get my hands on it!?

For a while I’d been saying this was the most logical thing for Adobe to do, but I never thought they’d actually do it..

Yey!

[UPDATE]

Funnily enough, all my questions are answered in the Developer FAQ!

Performance:

The iPhone and iPod touch have processors significantly slower than those found on most desktop PCs and Macs. Thus, content may run slower than it does when running on a desktop personal computer. However, the exact differences will depend on the specific content.

In addition, the hardware specifications vary greatly between different versions of the iPhone and iPod touch. Because of this, it is important that you test your content early and often across all devices which you plan to target.

The hardware that’s supported:

  • MultiTouch
  • Screen Orientation
  • Saving images to Photo Library
  • Accelerometer
  • Geo-location
  • Cut / Copy / Paste

Additionally, we can take advantage of OpenGL ES. This could be extremely important for games!

In order to make development of high-performance applications easier, applications built for the iPhone also can take advantage of an augmented rendering pipeline that uses OpenGL ES. This augmented rendering pipeline enhances the Flash rendering model to allow developers to take advantage of the GPU on iPhones. By enabling this rendering path, you have the ability to modify your display objects to put them on a hardware surface

Flash suddenly got a lot more exciting.

Bookmark and Share

MinimalDesigner – Layout tool for Bit101’s MinimalComps

Keith has released a layout tool for the excellent MinimalComps.

MinimalDesigner

I prefer to write pure AS3 inFlashDevelop, using the Flex SDK to compile. I’ve used MinimalComps on occasion, and I’ve been happy with the results. However when it comes to laying out anything particularly complex, I’ve had to fall back to Flex or CS3.

The release of MinimalDesigner should make using MinimalComps even easier now. Thanks Keith!

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

Useful stuff: Papervision GUI, AS3 Code Snippet, UML editor, Firefox Plugin

Here’s a few useful things I’ve seen recently. Thought I’d share..

VizualPV3D

A GUI for Papervision! It looks rather similar to Lightwave, although orders of magnitude less powerful. I’ll be interested to see how this evolves. Could come in handy one day!
http://www.juxtinteractive.com/work/vizualpv3d/

Swf Class Explorer

This was a useful utility on a recent project, as there’s no “ApplicationDomain.getAllDefinitions():Array”. Worth bookmarking.
http://flassari.is/2008/07/swf-class-explorer-for-as3/

Violet UML Editor

Jon from Unwrong showed me this rather nifty UML editor. Great for drawing quick, simple diagrams. Cross-platform, and free.
http://alexdp.free.fr/violetumleditor/page.php

Talon: Firefox Plugin

A great plugin for Firefox, which allows you to right-click and capture a page (or region). From there you can upload/share/edit on Aviary, copy to clipboard, or save to desktop.
http://www.readwriteweb.com/archives/aviarys_talon_a_drool-worthy_firefox_plug-in_for_e.php

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

Bow Street Runner up for another award

bsr

It just doesn’t stop. The multiple-award-winning Bow Street Runner we made for Channel 4 is up for another award, this time it’s the Broadcast Digital Awards. We’re in the Best Use of Digital Technology category.

The nominees are:

  • BBC iPlayer
  • Bow Street Runner, Channel4.com
  • Current
  • Freesat
  • Mycbbc
  • Obama: The Inauguration, Sky News

Wow. That’s quite some company to have!

Bookmark and Share

Wallace and Gromit at the Science Museum

I’ve been working on a game for the Wallace and Gromit installation at the Science Museum.

Here’s a photo I took a while back:
My 1337 arcade controller

It was a brilliant project to work on, and one of the most fun things I’ve done for a while. Everyone involved was fantastic, and the exhibition itself looks superb. The game is now installed on a row of consoles and is open to the public. The controls are made from arcade-quality components, and uses a Mini-Pac to talk to the PC via USB.

Here’s a very brief clip of it on BBC News 24 (00:30):

If you’re in the area, do go and check out the exhibition, it’s great!

Bookmark and Share

Red5 – my experience so far

Red5. The promise is: “an Open Source Flash Server written in Java” with support for pretty much everything most people would need. According to Chris Allen’s session I went to at Flash on the Beach, it would be easy enough to get it set up and running. 

Well, that’s not quite my experience with Red5 so far. First of all, there doesn’t seem to be a central resource for information. There’s the following – i’m not sure which are official:

 

 

I also couldn’t find any examples using AS3, which was a little suprising. I see that’s planned for version 0.9.

After downlaoding the most recent release (0.8RC1), I spent several hours attempting to get it up and running on my XP box to no avail. I then tried installing 0.7, which I finally managed to get running. 

One of the many problems I had was finding out how to log into the admin panel. I read that the username and password was admin/admin – however that wasn’t working. It took a lot of scouring mailing lists to find that you need to register a new user first at this URL:
http://localhost:5080/admin/register.html – you’ll then need to restart the Red5 server. I’ve yet to see that mentioned in any tutorial or documentation… although I may well be wrong :)

ANT has also been a real pain to set up. The readme for Red5 says to get this installed, and to run “ant server” – after a few hours of battling with this and having a lot of problems with dependencies and environment variables, I finally settled with just running ’start.bat’ from the Start menu. It seems to work, although i’m confused why the instruction to run ant exists.

I won’t even begin to list the problems i’ve had attempting to create a simple ‘hello world’ application. This is no doubt due to my complete lack of experience with Java, but it’s a real shame there’s a lack of well written, up-to-date tutorials on how to get a simple application up and running.

In the end, I’ve managed to create my own Flash app that connects to one of the existing sample Java apps, but it’s far from ideal. At least i’ve got something to show for my efforts though. 

It turns out I could have saved a lot of time by reading Robert Silverton’s blog, where he details pretty much exactly what i’ve gone through.  Doh! :)

A short message to the Red5 developers: You’ve created something that is no doubt absolutely wonderful. There needs to be a little more documentation and tutorials. Please try and help more of us get involved with using it. If there’s anything I can do to help you, please let me know.
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