Optimal scrolling for 2D games or UIs

I recently stumbled upon an old bit of code which demonstrates a technique I created for an efficient scrolling data grid on the YouView TV platform. I call it ‘Blit Scrolling’. Below is a demo of the concept – click on the window and use the arrow keys to scroll around (Flash required):

How it works

I use a small viewport on 1 larger bitmap, onto which content is blitted. I handle scrolling off the buffer area by shifting the bitmap’s pixels to counter the offset. This results in even fewer draw calls and less CPU-bound logic than the common 4+ tile approach: 2 for shifting pixels (if using a double buffer) and just 1 for the viewport render. It also avoids having to draw items renderers (think data grid items or game sprites) multiple times, if they sit across a tile boundary, for example.

Further optimisations could be made (such as only filling the newly exposed region, ‘locking’ the large bitmap and only updating from the viewed region), but you get the idea.

Random Excerpts

The more I play with Unity, the more it feels like the workflow of Flash Pro, whereby you attach scripts to instances of actors on the stage.
I'm not talking about the 'pure code' approach that all ActionScripters have become used to now; but the decentralised collection of independent scripts associatedUnity project structure - reminds me of Flash Pro

I've been playing around a little with the online Flash building tool, Wonderfl. If you haven't seen it already, I urge you to create an account and have a go. You can browse the weird things that people have created, fork other users' code, or write you own from scratchHow Wonderfl

I recently needed to create something where a chain of spring dynamics points is connected with one smooth, seamless curve. After much mathematical wrangling, here's the result of my efforts - you can grab and drag the grey blobs...
Wobbly springy physics