Posts Tagged ‘flash’

A simple Flash 3D engine from my past…

Tuesday, February 10th, 2009

Just trawling through a few old Flash folders on my mac and found this little fella’ sitting there all unloved. Came up with the 3D engine in 1998 using Director and made a quick hack to get it into Flash. It’s not particularly neat, hence why there’s no source posted, but suffice to say the heart of he 3D bit is that old ‘fake-doodle-dandy’ equation…

var x = (worldLens*pointX)/(pointZ+worldScale)+xOffset;
var y = (worldLens*pointY)/(pointZ+worldScale)+yOffset;

Like so…

Launch it to fill the browser

If you really want the code, let me know, but I’m secretly ashamed of it… :)

YouTube problem solved…

Monday, December 1st, 2008

I’ve been blighted, as have many others, by YouTube video appearing blank and simply stating “We’re sorry, this video is no longer available.”.

There have been a couple of suggestions, like restarting your router, hard coding your IP, using an IP tunnel application, turning of Google Web Accelerator and so on. Some suggested it was a YouTube caching issue or an IP problem but it was also a bit random. My own Ducati Exhaust video stopped working while my Halo Soundtrack video was fine. When I’m at work, some of the videos that work at home failed, and vice versa. I use a Mac at home and a PC at work. Both use Firefox but all browsers seemed to do the same thing. All-in-all verry confusing.

However, it turns out it’s none of that. I’ve just updated my flash player from 10.0.2.26 to 10.0.12.36 and all’s well again. While I’m happy it’s all working, it’s also a little worrying that the big media owners and entertainment portals are so reliant on something as ‘simple’ as a Flash version issue.

If I was YouTube, I’d make this solution visible on the homepage (that’s if anyone actually visits the homapage). I’m supposed to be clever and if it escaped me, it’ll be escaping a fair few others. My impression of YouTube was suffering if I’m honest, thinking they’d become too big for their architecture to cope with.

But now I can check out all those vidoes of kittens again. Karma restored.

Webcam background removal in Flash

Thursday, November 27th, 2008

If you’re a fan of the EyeToy or you’ve just got You’re In the Movies on Xbox 360, you’ll know what this is all about. How to remove yourself from a web cam image and superimpose you on another background.

The mighty Jop had a bit of a testbed working and I thought I’d get the old brain working again and have a tinker. It’s not pretty code but it’s available below if you’re interested in a few pointers. It’s also not that good, but if it inspires you to do it better (I.e. properly) then it’s done its job.

If the web cam doesn’t initailise. Try this link:

In a nutshell:

1: Grab camera feed

2: Take a snap of the background

3: Use a ‘difference’ filter on them both to fighure out which pixels have changed the most

4: Use a ‘threshold’ filter to remove all the pixels that haven’t changed much

5: ColourTransform the resulting pixels to black

6: Apply a slight blur to help make it less jagged

7: Cache the resulting image as a bitmap (so it can be used as a mask) and put it over a copy of the live feed

8: Cache the live feed as a bitmap and apply the mask

9: And repeat using an interval or similar

Here’s the main function:

function takeSnapshot() {
//grab the cam and render it into a snapshot bitmapData obj
snapshot.draw(output_vid);
}

function checkVid() {
//grab live cam
liveData.draw(output_vid);
// grab snapshot
maskData.draw(snapshot);
// apply difference to 2 images
maskData.draw(liveData, new Matrix(), new ColorTransform(), ‘difference’);
// remove all unchanged pixels. Make them transparent
maskData.threshold(maskData, new Rectangle(0, 0, output_vid.width, output_vid.height), new Point(0, 0), “<=”, (threshVal/100)*0x00ffffff, 0×00000000, 0x00ffffff, true);
// colour what’s left black
maskData.draw(maskData, new Matrix(), new ColorTransform(0, 0, 0, 1, 0, 0, 0, 0))
// Blur to improve quality
maskData.applyFilter(maskData, maskData.rectangle, new Point(0, 0), blurFiltr);
resultData.draw(liveData);
// cache the resulting mask and apply it to the live feed
mask_mc.cacheAsBitmap = result_mc.cacheAsBitmap = true;
result_mc.setMask(mask_mc);

}

Source is here. Have fun!

2 Miniclip launches in a week… Zubo Zurfing!

Thursday, October 16th, 2008

You wait ages then two come along at once! Yep, just 5 days after Corn Pops Challenge was launched, our new baby, ‘Zubo Zurfing‘ has gone live (or Zubo Surfing as Miniclip has it… doh!). It’s very cool to have our games occupying two of the three slots in the Miniclip main promo area!

The game itself is a great achievement. Original gameplay, exciting, high-quality and fun to play. Probably one of the best games we’ve made at Digital Outlook. Big thanks to EA and GoFish for giving us the chance to make it! The aim is to get the 5 Zubo characters across a sound wave. You do this by exploding ‘sound bombs’ above and below the sound wave to cause ripples that fling you in the air. Of course, there are baddies, keys and bonuses in there to keep you on your toes.

What would I improve? Simple, more levels! What a great compliment to a game. It’s a great game engine that can ramp up and allow for mini-puzzles and level designs to test your skill. I think 20 levels should do it.

Anyways, I suggest you play it… play it now… and visit the Zubo web site, it’s quite fun.

Beware the Android!

Monday, September 29th, 2008

I had a fiddle with the Apple iPhone developer kit last week and it was a relatively painless experience. I had an app, albeit a useless one, up and running within an hour, like so. Apple applied the same philosophy to their development tools as they did to their consumer-facing products. It was fun, simple and even a Visual C newbie like me could figure the basic out.

Just done the same to Google’s Android developer platform. Wow, what a difference. Where Apple installs lots of applications, tools and nic-nacs to fiddle with, Android can barely bring itself to unzip the scattering of .jar files and nasty looking anonymous files into a snappily named folder “android-sdk-mac-x86-1.0_r1″.

Hmmm ok. Discarding my own “if you need to look at the manual, it’s not very good” philosophy, I followed the ugly-as-hell installation instructions. What a can of worms I’ve just opened. I need to download a third-party development environment such as Eclipse 3.4. I Google it, visit their website but can’t figure out what to download. Eclipse IDE for Java Developers? Eclipse Classic 3.4.1? Don’t know. Didn’t bother… boredom setting in…

Once you’ve installed Eclipse, you also have to install the Eclipse Plugin (ADT) with it’s own set of tecno-babble installation instructions.

So now I’m ready for my “Hello Android” starter experience. I believe the expression in OMFG! How nasty and difficult can they make it?

Ok, what’s my point? My point is the internet exploded because of two things. Creatives and Flash. Before flash, developers used stuff like C++ or HTML. Some used Javascript but on the whole, they smelled of wee and old pastry and knew the names of all the planets in Star Wars. Coders stayed in their cave and designers stayed in theirs. Then designers found a tool they could play with without too much programming. They could make content for the internet that was fun, irreverent, thought-provoking, high quality and cheap. Tradition coders didn’t get involved as ‘Actions’ were too crude to make anything out of. I loved it and so did many others. I made Flash 4 games, sites, I solved problems and people started to see the internet as a fun place rather than a place where games had interfaces made with grey Windows UI buttons. Here’s the first site I ever made in Flash 4 btw, and it ran off text files! :)

The beauty happens when people cross the lines. The epiphany where code and creativity combine to create something greater than the sum of the parts. Content exploded. Games, videos, animations, crazy (and often pointless) websites popped up at an astonishing rate to feed the new demand of the first dot-com boom. I’d been using the web for 6 years before flash came out and in one year, it was astonishing what was happening.

Spool forward a few years and Flash updated its coding engine to Actionscript, then Actionscript 2… and now Actionscript 3. Coders can come to flash from C++, Java etc. and get developing straight away. Unfortunately, flash has started to get too complex for those pioneers of creativity, the bedroom creatives out there. Coders now have a bigger cave to sit in and designers are too busy playing with their iPhones to notice the gap that’s opening up again. Most are too young to know how it ‘used to be’. Those of us that remember know it was a sterile, fractured, dysfunctional and ugly place to be. If someone has an idea, it’s imperative they have the tools to express themselves without barriers. Creativity isn’t just for designers, it’s for everyone. I can’t express how important it is to offer tools to allow those with ideas to create them, to innovate, to inspire and drive the internet forward.

As an example, look at the winners of Android’s $10 million Developer Challenge. I’m sure they’re very clever, but please, these were judged the best in the world!

What Google have offered in this case is embarrassing and depressing. I’m a big fan of a bunch of their stuff but this smacks of slapping their name on someone else’s technology and turning a blind eye to their values. I cannot use their ‘open platform’ as it’s closed to anyone other than hardcore coders. Ok, you can argue that the Apple Xcode Visual C experience is pretty nasty, but the doors are wide open and welcoming. Google has locked theirs, dug a couple of moats and put a huge, angry robot on guard to quickly beat the enthusiasm out of any passer by.

Maybe that’s why they called it Android…

Miniclip Games Arcade widget

Friday, September 19th, 2008

I deal with these guys a lot at Digital Outlook but never actually embedded their Arcade widget… easily rectified. It’s not rocket science, just go here, choose a game and get the code… except the embeddable flash apps are bigger than the ‘standard’ 450 pixel width of WordPress (this blog). You can alter the flash tags to be 450 width but it does come out a bit small. Works though…

You can do it to single games too…

Here’s an embeddable promo for a game we did for Mr. Men. Last time we checked it had done 32 million game plays in about a year. Not bad! Why not add a few to the total…

Games at Miniclip.com - Mr Men Pinball
Mr Men Pinball

Activate multiple targets for bonus points in Mr Bump Pinball!

Play this free game now!!