Archive for the 'programming' Category

Bow Street Runner wins Flashforward award!

HOORAY!

I’m very happy to say that the epic Bow Street Runner game we made for Channel 4 has just won a Flashforward award at Flashforward San Francisco 2008 :)

Thanks to everyone involved!

Edit: This is our second Flashforward award :)

Bookmark and Share

iPhone 2.0 as a gaming platform?

iPhone 2.0 I managed to resist the last iPhone, but this time i’m not too sure i’ll be able. What’s different this time? The combination of 3G, GPS, and an accelerometer. This could seriously be the start of a new – maybe even revolutionary – gaming platform.

Location-aware gaming might take off now. I’m thinking that companies that are already doing similar things (like Locomatrix) might see a lot more interest in the coming months. Perhaps a mix between GPS gaming and PMOG (Passively Multiplayer Online Game) could be interesting? I’ve got to get one of these and start experimenting..

Of course, the combination of 3G, GPS, and accelerometer has been done before in a few phones, including the excellent N95, but -assuming the GPS works on the iPhone 2.0 – there’s one huge difference here: The ludicrous fanboy factor. Any interesting apps and games for the iPhone are going to be lapped up by a very vocal, very active, very influential fanbase.

Will we see Flash on this? With Adobe’s Open Screen Project, I can only hope :) Talking of wishful thinking, perhaps Apple will drop the walled garden approach. I seriously doubt it though..

[Update] I see Mashable gets what i’m talking about.

Bookmark and Share

Flash 3D: Alternativa3D Engine Launched

The Alternativa3D engine has been launched! The demos on the site are astounding. While Papervision 3D is excellent, these guys really seem to have set the bar in visual terms. I think that competition can only be a good thing, eh guys? :)

I can’t wait to try this engine out, it looks really promising.

Respect to the Russians!

[via drawlogic]

[edit: Simon, a colleague and games journalist writes about this too at ChewingPixels.]

Bookmark and Share

Flash + Papervision 3D + Arduino

In my second little project today, I modified the circuit I built for the Flash etch-a-sketch, by adding another potentiometer and 3 LEDs, each of which represents the voltage of each pot (using pulse-width modulation to ‘dim’ the LED).

Each pot is responsible for either the pitch, yaw, or roll of a cube in PV3D.

Simple stuff that’s been done before! I think I need to think of something a bit more interesting now :D

Flash + Papervision 3D + Arduino

Flash + Papervision 3D + Arduino

Bookmark and Share

Getting Flash and Arduino talking, and problems with AS3

Over the last year, i’ve heard a lot about Arduino, so I was quite gutted when I missed out on both the Arduino talk at BarcampBrighton2, and also on the Arduino session a few days later at FlashBrighton!
Nevertheless, I had to get an Arduino board and start experimenting. Jo had a few Arduino boards, so kindly dropped one round for me.

For me, the most interesting aspect is using the Arduino in conjunction with Flash, sending and recieiving data betwen the two. I realy like the twitter > flash > arduino > LCD display that Mario made. I found it quite inspirational.

Getting Flash and the Arduino talking is initially very, very easy. It takes no time at all to initially write your first “hello world” app – in this case a blinking LED. After that, I turned my attention to reading the output of a potentiometer, and display that in Flash. Again, this is very easy, espically when people have done it already, and you can copy and paste their code! Thanks Beltran, Brett, and Aral for sharing your code!
In no time I had a potentiometer controlling the brightness of an LED, and the Arduino writing the data to the serial port, which Flash was trace()ing to the output window.

Nothing’s that easy though, right? Indeed. I’m expecting values between 0 and 1023, and specifically in this instance, around 1023. This is what I got:

15:37:53:104 = 102
15:37:53:135 = 3
15:37:54:104 = 1023
15:37:55:119 = 1023
15:37:56:135 = 1023
15:37:57:119 = 102
15:37:57:135 = 3
15:37:58:119 = 1023
15:37:59:135 = 1023
15:38:0:151 = 1023
15:38:1:135 = 10
15:38:1:151 = 23
15:38:2:151 = 1023

How strange. As you can see, occasionally the output is split over more than one line. It also does the same on my laptop.
After a lot of hair-pulling, I’ve made a couple of examples, which you can test if you wish. You’ll need to change the port to the one serproxy (or equivalent) is set up to use.

Arduino code:
[code]
void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.println("hello");
delay(100);
}
[/code]

Actionscript 3 code:
[code]
import flash.events.*;
import flash.net.Socket;

trace("__AS3 Example__");
var socket:Socket = new Socket("localhost",5335);
socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
function socketDataHandler(event:ProgressEvent):void {
var now = new Date();
trace(now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+":"+now.getMilliseconds()+" = "+socket.readUTFBytes(socket.bytesAvailable));
}
[/code]

Actionscript 2 code:
[code]
trace("__AS2 Example__");
var socket:XMLSocket = new XMLSocket();
socket.connect("localhost",5335);
socket.onData = function (data) {
var now = new Date();
trace(now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+":"+now.getMilliseconds()+" = "+data);
}

[/code]

AS3 Output:

12:10:43:140 = hello

12:10:43:234 = hel
12:10:43:250 = lo

12:10:43:359 = hello

12:10:43:453 = h
12:10:43:453 = ello

12:10:43:562 = hello

AS2 Output:

12:11:25:406 = hello

12:11:25:515 = hello

12:11:25:625 = hello

12:11:25:718 = hello

12:11:25:812 = hello

12:11:25:921 = hello

AS3 has odd output, and AS2 has the expected output. It’s almost as if ProgressEvent.SOCKET_DATA is called too frequently?
I’ve looked at this, which may be a similar problem. Here’s my post on the Arduino forum which I wrote as I experienced the problem.

In the end I found AS3Glue, which “is an ActionScript 3 library that enables communication between Flash/Flex/AIR applications and Arduino boards”. This changes the way in which AS3 and the Arduino communicate, and fortunately solves the problem described above.

If you use AS3glue, you’ll also need to use the Arduino Firmata firmware. The firmware page also briefly mentions:

It turns out that the USB-serial drivers are optimized for fast bulk data transfer, and those optimizations actually wreak havoc with the timing of the messages over the USB-serial.

Perhaps that’s the problem i’ve experienced? If I can, i’d like to find out exactly what’s going on, but for now, as3glue will suffice :)
If you can, please have a test and let me know if you get the same output!

Bookmark and Share

View Flickr Images Fullscreen

Snowdon panorama

After uploading a few panoramic photos to Flickr, I found that I really wasn’t too fond of the small image it displays. Asking a user to click all sizes > original just doesn’t cut it for me either.
I found myself thinking “Wouldn’t it be good if i could just click on a link to a fullscreen, panning image?” Well, what with Flickr’s API, and Flash’s StageDisplayState.FULL_SCREEN, I did just that..

This is only something i knocked up in the last couple of hours, so don’t be too harsh, it’s just alpha :D

Here’s a link directly to my app

Here’s a bookmarklet: View Fullscreen (add this to your favourites or drag and drop to your toolbar)

Here’s a link to an image of mine on Flickr

Of course, adding that bookmarklet to your toolbar means you can view anyone’s (public) image fullscreen. Just browse to their image and hit the bookmarklet :)

Bookmark and Share

Second Life

Linden Labs are setting up offices in Brighton, and I see Second Life mentioned almost every day by someone, so I thought I might as well see what all the fuss is about.

I did try to give it a go a long time ago, but was put off when I had to put my card number in, so I bailed. However, they’ve cleverly decided to remove that part of the process, so I signed up, downloaded the client, and logged in..

I’ve played a lot of 3D games over the years, but I realise this isn’t a game, so although comparisons are inevitable, they’re not really that valid. Yes the graphics are of Quake 2 standard. Yes there’s lag. No, the whole thing doesn’t feel that refined. But I kinda like it.

I haven’t signed up yet.. but it’s not that expensive, and it might be interesting to give it a go for a while. I really enjoyed building things in second life (lets not ask what i built), and things can be scripted. I had a quick look at the language, and it doesnt seem that bad.

There’s such huge potential in Second Life and it’s inevitable clones, that it would be madness to ignore or dismiss it. I’ll be logging in again soon, so let me know if you’re already there, or thinking of joining!

Bookmark and Share

Looking for the ultimate text editor

After talking to Del about jQuery and editors with intelliSense, I thought i’d take a look at Aptana – “a free, open-source, cross-platform, JavaScript-focused development environment for building Ajax applications”. While downloading this, it occurred to me that I currently use 4 different text editors, and really, I could probably just use one. After all, it’s just text!

I currently use the following editors: Notepad++ (for PHP and editing scripts when I dont want to fire up a full-blown IDE to eat system resources), HomeSite (for XHTML, CSS, JS,ASP), FlashDevelop (for Actionscript), and IDLE (for Python. So rarely do i use this i’ll forget about it for now).

Here’s a short write-up for each editor i’ve been reviewing and their good and bad points:

Notepad++

Lightweight editor, supports multiple languages, extremely fast to load up. Missing some features like a file browser and (s)FTP. Overall very impressed. £Free

HomeSite

I dont think this has been updated for years. I’m using 4.5 which was released in 1999-2000! That IS old! Still, it works reasonably well, with an integrated IE browser, and supports multiple languages. I’d really like to get away from using Homesite. £102

FlashDevelop

I used to use SEPY for editing Actionscript, but something drove me towards FD instead. It’s good at what it does… but of course, it only supports Actionscript, which is a pain. It’s not the speediest editor to load either. £free

E- TextEditor

The Windows equivalent of TextMate. Reasonably fast to load, and supports multiple languages through the use of TextMate bundles. I haven’t managed to get it working with the Actionscript bundle yet :(
There’s a good screencast on their site which is worth watching. TextEditor has the most amazing feature i’ve seen so far: Select multiple areas of text, and then start typing. Watch the screencast to see it in action: I think it’s amazing! $35 per year.

Aptana [screenshots] [videos]

I really like this open-source editor. It’s extremely good for XHTML, CSS, and JavaScript. It’ll even show you which browsers support different properties. It supports (s)FTP. No support for Actionscript yet though :( Slow to load, but worth it. It’s built on Eclipse, yet I find it easier to use than Eclipse. £free

Eclipse

From it’s credentials Eclipse should be the best editor out there. At the moment I find it impenetrable and unintuitive. If someone who uses it regularly spent an hour guiding me through it, i’d probably get on with it better, but until then, I can’t consider it an option. A shame as it’s free, and via the enormous amount of plugins available, it supports all the languages I need! £free

Conclusion
Well, I can’t draw a definitive conclusion on this, as i’ll continue evaluating more text editors, and hopefully one day I’ll learn to live with Eclipse. It’s got to be the way forward, as it’s so powerful, and its available for Windows, Mac, and Linux.

For now? I’ll continue using Notepad++ for quick and easy editing of most files, and use FlashDevelop for Actionscript. I guess the only change will be using Aptana for web development. Perhaps that’ll help me get into the Eclipse IDE as well.

Bookmark and Share

How easy is JSON?

Although i’ve done a few AJAX’y things over the past year, i’ve yet to touch AJAJ.

After reading about Aral’s SWXFormat, I thought it would be a good idea to familiarise myself with JSON, so when it looked like i’d have to use some AJAX in my portfolio, I looked up a JSON example, and I must say i’m pleasantly surprised that using JSON with jQuery can be so simple.

Here’s the JSON:
[js]
{
“wintitle”: “Window Title”,
“url”: “http://domain.com”,
“height”: 415, “width”: 720
}
[/js]

And this is JS loading the JSON (using jQuery):
[js]
$.getJSON(”http://domain.com/script.php”,
{ field: “value” }, // send field value pairs
function(json){//return function
GB_showCenter(json.wintitle, json.url,json.height,json.width)
});
[/js]

How simple is that! All that time i spent parsing XML in javascript is over, yey!

As soon as i have a spare minute i’m going to create some swxformat tests – looks like it could be an even easier way to get data into flash!

Bookmark and Share