Archive Page 2

02
Nov
11

Creative Javascript – 3D Tree with Leaf-fall

A HTML5 prototype…

Finally getting around to have a play with HTML5 Canvas – enabled by attending Seb Lee Delisle’s excellent CreativeJS course.

I’m impressed with performance from Canvas nowadays – my first sight of it many moons ago left me pretty disappointed – but now it actually feels useful and some pretty impressive visual effects can be achieved without resorting to WebGL.

The prototype I threw together here demonstrates a growing tree, in 3D with numerous branches, leaves, leaf fall, faux-shading and colour phasing. The demo will re-grow a tree on mouse click, and will allow for left and right rotation by means of mouse position (left/right).

creativeJS

3D Tree with Leaf Fall

To talk through the code a little: The tree is constructed using a recursive buildBranch function. Every branch spawns two new branches, or in the last generation it has a 90% chance of spawning a leaf. The branches are coloured from brown to green related by the recorded generation of the branch.

No 3D libraries were used in this demo – all of the 3D is via a simple scaling calculation for 3D points [ fov / (fov + point.z) ]. This allows for any 3D point to be translated (scaled) onto the 2D canvas.

The Painter’s Algorithm (priority fill) is applied via the sorting of all branches and leaves on their mid-point. This means that those furthest away are drawn to screen first.

Shading is applied by mapping colour to the z value of a branch’s position. This is very simply applied. There is a related alpha to add a fog effect to the furthest away elements, this gives some subtle but nasty artefacts and could be improved.

When a branch is fully grown the leaves will then appear and grow to their full size. When they fall a sine value is applied to rotation to make it rock as it falls. Leaves will collect on the ground.

Performance is pretty good here, but I did have to restrict the number of branch generations to 9. Of course some of the out-of-the-box features that Flash has such as Glow and Blur filters don’t exist – which means work-arounds or approximations have to be used – sound implementation isn’t very consistent across browsers – it is still early days, more and more JS will be used across the web, as it is the browser manufacturers will hopefully drive their products into more useful areas and consistent implementations.

The demo is a fast turn-around ‘prototype’, so not optimal or well formed. Feel free to have a play with the code, offer improvement suggestions or adapt in anyway you wish.

No attempt has been made to cover HTML5 cross-browser issues – so don’t expect this to work in IE!

Direct Link: 3D Tree with Leaf Fall

12
Sep
11

References from Playability: Making Games for Kids

Here are the references from my talk at Flash on the Beach 2011:


Games:

  • Horrible Histories: Moo Spew
  • Horrible Histories: Gong Farmer
  • Shaun the Sheep: Alien Athletics
  • Deadly 60: Deadly Dash
  • Dick and Dom: Let Rip
  • Swingpant's FOTB Flinger



    Your keyboard doesn’t work:

    The functioning key test app. Many keyboards have a mechanical issue that means if two keys are pressed, certain other ones cannot be registered as being used. On the keyboard I am currently typing on if I press [Down], [LEFT] and then [Space], the [Space] fails to work. If I press [A] and [W], then [Q] fails to work.

    Test your keyboard here: http://bit.ly/keytest
    (Sorry users of keyboards that aren’t exactly like the one I have here – I made the app from a pic of this one)


    Accessibility

  • A simple introduction to web accessibility – Ian Hamilton

  • Recommended Reading on Game Design:

    Game Design Books:

  • The Art of Game Design – Jesse Schell
  • A Theory of Fun for Game Design – Raph Koster
  • Challenges for Game Designers – Brenda Brathwaite & Ian Schreiber

  • Academic Papers:

  • MDA: A Formal Approach to Game Design and Game Research (PDF) – by Robin Hunicke, Marc LeBlanc, Robert Zubek
  • Playability: How to Identify the Player Experience in a Video Game – by José Luis González Sánchez, Natalia Padilla Zea, Francisco L. Gutiérrez.
  • From usability to Playability: Introduction to player centred video game development – by José Luis González Sánchez, Natalia Padilla Zea, Francisco L. Gutiérrez.
  • Dissecting Play: Investigating the Cognitive and emotional motivations and affects of computer gameplay – Lindley, Nacke, Sennerston
  • Flash on the Beach Titles by GMunk

    10
    Sep
    11

    Flash on the Beach 2011: My Schedule

    The amazing Flash on the Beach conference is upon us again. A must every year for me to get my fix of the latest tech, design and web game ideas.

    This year I’m speaking on the monday morning – great for me as I don’t have to sweat it for the following few days.

    Some major clashes this year – I may have to miss Seb Lee Delisle, Stray, Joel Gethin Lewis, Keith Peters, Conrad Winchester and Stefan Richter. Sorry guys – my arm is up for being twisted though.

    Mon 12th Sept 2011
    Keynote.
    Jon Howard – Playability: Making games for kids
    Rob Bateman – Flash 11: Get Ready for Gametime
    Eugene Zatepyakin – Natural Features Tracking and Image Pattern Detection / Recognition
    Han Hoogerbrugge – Prostress of the graphic universe of Han Hoogerbrugge
    Jon Burgerman – A short talk about working and not working and how to waste your time proficiently

    Tue 13th
    Tomek Augustyn – Riding the Hislope
    Joa Ebert – The Tale of a travelling salesman and his four colours
    Mike Chambers – Deconstructing theexpressiveweb.com
    David Lenaerts – Keeping It Real
    Remy Sharp – HTML5: Where flash isn’t needed anymore
    Cyriak Harris – Destroying my laptop with After Effects
    Jame Victore – Who died and made me boss

    Wed 14th
    The Elevator Pitch.
    Thomas Vian – All aboard the game engine
    Lee Brimelow – Render for Speed
    Frank Reitberger – Real(hard)time
    Joshua Davis – The Unknown Voyage

    08
    Sep
    11

    Playability: Making games for kids

    I shall be speaking at this year’s Flash on the Beach conference in Brighton, UK (11th to 14th September 2011).

    The subject is playability in relation to making web games for kids. As a lead developer, tech lead and team leader I have had huge amounts of experience working on game design and development with major kid’s TV brands. It is exciting, fun and always a privilege.

    In the session I will be looking at how a gamedev team is made up, the product lifecycle from idea to release. Important points I’ll look at are the specific needs of the game’s audience. How to design the best control method, the most appropriate aesthetics and which mechanics work best.

    I’ll dig into the elements of a successful game – which measures are used to find out if a game is ‘good’ and successful.

    With constantly shifting sands in the world of the web,I’ll touch on what I see as the future of games for a major broadcaster – what technology will be used and on what platforms.

    During the session I’ll be showing examples of games, video examples and I’ve arranged for a Skype call to the TV offices…

    Playability at FOTB2011

    05
    Mar
    11

    Introduction to Mercator Projections, Latitude and Longitude

    Or how to place a map coordinate into 3D space. This post is a brief walk through of the basics from my 2010 presentation “Where in the world? Intercontinental Ballistic Flash”.

    Belgian, Flemish geographer and cartographer Gerardus Mercator, in 1569 presented a cylindrical map projection. The Mercator Projection quickly became the standard map used for nautical purposes. It’s advantages were that the scale is linear in any direction around a point, meaning all angles were preserved (conformal).

    Geographer and cartographer Gerardus Mercator

    Gerardus Mercator

    Around the equator feature shapes are accurately portrayed but as the poles are approached there is a size and shape distortion. The scale increases as the pole is neared, eventually becoming infinite when the pole is reached.

    If you imagine the world as a beach ball. The Mercator Projection is the equivalent of cutting open the ball at each pole and stretching the skin to form a cylinder. Now slice down the cylinder and you have the map.

    The first Mercator projected map. 1569.

    All map projections distort the shape or size of the Earth’s (or for that matter any other planet’s) surface. The Mercator Projection exaggerates areas far from the equator. Greenland seems as large as Africa, but is in fact 1/14 of the size, Antartica appears to be the largest continent but is in fact only 5th in terms of area.

    Despite the obvious distortions, the Mercator Projection makes a great interactive map. Thanks to the conformality it can be zoomed nearly seamlessly.

    So here we have a system that converts a 3D scene, the real world, onto a 2D plane, the map. This system can just as easily convert the 2D back to 3D. It is a coordinate system that requires two positional parameters and one constant: the planet radius.

    The positional parameters are latitude and longitude. As developers we are used to standard coordinates x and y. Across then up. Horizontal then vertical. With latitude and longitude we have to think differently. Latitude is vertical and longitude is across. Up then across. Latitudes run from pole to pole, while longitudes run around the planet.

    There are 180 degrees of latitude from the South Pole to the North pole, and 360 degrees around the planet. Imagine yourself sat at the centre of the Earth with a laser pointer. Point at the Equator then you are at 0 degrees latitude, at the South Pole -90 degrees and at the North Pole 90 degrees. Now point at the Equator again you can turn 180 degrees around the equator to the right (-180 degrees longitude) and to the left (180 degrees longitude).

    With these any point on the surface of the planet can be recorded or indeed any position on a map.

    So we have a system for calculating a position on the surface of a sphere, a 3D coordinate, but how do we convert latitude, longitude and the planet’s radius into a 3D x,y,z coordinate?

    public static function convertLatLonTo3DPos(lat:Number, lon:Number, radius:Number):Vector3D
    {
    var v3d:Vector3D = new Vector3D();

    //Convert Lat Lon Degrees to Radians
    var latRadians:Number = lat * TO_RADIANS;
    var lonRadians:Number = lon * TO_RADIANS;

    v3d.x = radius * Math.cos(lonRadians) * Math.sin(latRadians);
    v3d.z = radius * Math.sin(lonRadians) * Math.sin(latRadians);
    v3d.y = -radius * Math.cos(latRadians);

    return v3d
    }

    Here the latitude and longitude are converted into radians ( TO_RADIANS:Number = Math.PI / 180 ). Then the trigonomic functions are applied to the planet radius to return a vector3D x,y and z.

    16
    Nov
    10

    Adobe User Group XL

    On Nov 17th, I’ll be speaking at the Adobe User Group XL event in Amsterdam. This conference is festooned with glittering array of industry big wigs, not just Flash, but all across the creative spectrum. Belinda van Valkenburg from Pixar (her credits include Monsters Inc., Toy Story 3, Finding Nemo, The Incredibles <- wow!), Roger Stighäll and Daniel Ilic from the amazing North Kingdom, Seb Lee-Delisle from Plug-in Media and Frank Reitberger from Prinzipiell. As well as Northern Europe’s finest and Adobe evangelists Serge Jespers, Mike Jones, et al.

    AUGXL2010

    Adobe User Group XL 2010 Amsterdam


    The event has a theme of ‘Celebrate Creativity’ and feature talks on interactive design and development, cross-media, imaging, gaming, augmented reality and PCB design.

    I shall be doing my Where in the World? Inter-Continental Ballistic Flash talk with a few additions.

    Really looking forward to this conference.

    27
    Oct
    10

    Keyboard Woes

    I came across a problem today. Surely I should should have spotted this sooner – but maybe I just never used these key combinations.

    It seems that there are issues with using ARROW KEYS and SPACE. Specifically on my keyboard the combination LEFT, DOWN and SPACE doesn’t work. I’ve spotted that other key combinations fail on different keyboards. Another laptop I have fails with LEFT, UP and SPACE as does my desktop at work.

    Here is a quick app that will tell you what keys are being accepted. Try different combinations of arrow keys and space to see if you have any fails.

    Seemingly this is nothing to do with Flash and everything to do with keyboard design. The problem varies from model to model, but is VERY common.

    Test your keyboard.

    Keyboards use a matrix to wire up the keys and register presses. The matrix is made up of columns and rows. When a key is pressed the column and row contact each other completing a circuit. The controller for the keyboard detects this and registers the key press. ‘Ghosting’ and ‘Masking’ of key presses can occur with a matrix keyboard. Here is a technical explanation of the issue. This article is from a decade ago, seemingly the drive to fix these keyboard problems hasn’t been strong enough.

    Let’s gauge how bad it is. Try the Keyboard Woes app out and then let me know if there are any issues with your set-up.

    How to fix this? The ONLY solution is not to use the SPACEBAR in combination with the ARROW keys.




    Categories

    Reasons to be Creative 2012

    FITC Amsterdam 2012

    Flash on the Beach 2011

    Flash on the Beach 2010

    Flash on the Beach 2009

    Swingpants at FOTB2009

    Twitter Updates

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.


    Follow

    Get every new post delivered to your Inbox.