Tag Archives: performance

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):
Continue reading Optimal scrolling for 2D games or UIs


 

Boosting Unity performance on mobile devices





 

Mobile devices are becoming more and more powerful. However, not all your users will have high-end mobile devices, so you should keep a low-powered device handy for testing the performance of your games.

Here are 10 ways not usually mentioned on how to improve mobile Unity performance. The usual advice (use low-poly models, minimal lights, few effect, etc) is good. But if you still need need to increase performance, try these tricks: Continue reading Boosting Unity performance on mobile devices

Sneaky tricks for developing on small devices: ‘Bitmap Folding’

One of the most problematic constraints when developing applications for resource constrained devices, such as mobile or Set Top Box is ‘video memory’.

You often will not have control over how much video memory is allocated to your application, or what the fallback behaviour is when your application uses too much. Continue reading Sneaky tricks for developing on small devices: ‘Bitmap Folding’

YouView – Smart TV UI

YouView is a Smart TV service in the UK, a spin-off of a BBC RnD project which runs on Set Top Boxes and certain Smart TVs. I worked on the core UI for years and thought I’d share some insights into best practices when building applications for such resource constrained devices.

Continue reading YouView – Smart TV UI

CODING WRONGS – Where do I start with the bad?

It gets scary out there sometimes. During my freelance career I’ve worked at a lot of different companies and have seen such coding horrors as you cannot imagine. So I thought I’d start immortalising some of them – so that we can all learn better coding practices, by looking at the bad.

Starter for 10 – What’s wrong with this picture?

Did you spot the fubar? It’s not an obvious one. Continue reading CODING WRONGS – Where do I start with the bad?

Loan Shark – fast object pooling utility

LoanShark AS3 Object Pooling UtilityA couple of years ago, I created an object pooling utility for a games project I was building in AS3. Since then, I’ve used it quite a few times, in order to speed up apps and improve resource management, easing the load on the garbage collector by reusing objects instead of recreating them. Continue reading Loan Shark – fast object pooling utility

Fastest way to add multiple elements to an Array / Vector in AS3

In a simple situation, where you wish to add many elements to an Array or Vector, you might just do:

However, the sizes of both Arrays are manipulated for each loop, which will have an adverse impact on speed and memory usage. So, we could cache the length of the input Array and not manipulate it:

But we’re still growing the size of the output Array incrementally, which is very bad. Since we know input.length in advance, we could grow the output Array to its new size just once, before the loop:

This is OK, but still involves a loop. If only we could push multiple elements into the push method in one go. Well, we can – enter the apply method. Since Array.push accepts multiple arguments (something rarely used) and apply allows us to pass an Array of arguments to any Function, one line and we’re done:

This works out faster and more memory efficient than the other methods. It works nicely for Vectors, too. If anyone has a faster method of doing this, do let me know.

SWFIdle – simple flash idling utility

If you’re still churning out Flash banners, please use this!

swfidleI created this simple utility, called SWFIdle, to enable the Flash Player to lower its CPU usage while the user is not interacting with it. Since it’s possible to have multiple Flash instances embedded in one page (for example, a game and a couple of banners), I recommend using this in your projects, so that Flash instances needn’t fight for CPU and give Flash a worse name than it has already 😉

I know there’s the hasPriority embed attribute now. But:

  • That assumes you have access to the HTML that embeds your SWF
  • If no other players are present, it has no effect
  • There’s still usually little reason to be running your SWF at a high framerate if the user isn’t interacting with it
  • Flash banners with wastefully unoptimised drawing routines are probably one of the key reasons that Flash got poo-pooed off of mobile platforms and disabled on everyone’s laptops – CPU usage = battery usage!