Archive for Development tag

Shrinking JS or CSS is premature optimization

November 27th 2007 • .NET (, , ) • 1,189 views • 7 responses

Rick Strahl has a post on a JavaScript minifier utility the sole job of which is to shrink the size of your JavaScript whilst making it almost impossible to read in order to save a few kilobytes.I thought I’d take a quick look at what the gain would be and fed it the latest version (1.6) of the very popular Prototype library:

File (KB) GZip (KB)
Standard 121.0 26.7
Shrunk/minified 90.5 22.0
Saving 30.7 4.7

The 30.7 KB saving looks great at first glance but bear in mind that external JavaScript files are cached on the client between page requests and it looses some appeal.If you also consider the fact that most browsers and clients support GZip compression and the savings there are around 4.7 KB and you might wonder if you are wasting your time.In computer science there is a term for blindly attempting to optimize systems without adequate measurement or justification and that term is premature optimization.As Sir Tony Hoare wrote (and Donald Knuth paraphrased)

We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.

And he was working on computers throughout the 60′s and 70′s that had much less resources than those today.By all means if your server bandwidth is an issue delve into the stats, identify the cause and take it from there. Going with Yahoo’s YSlow plug-in for Firefox/Firebug is a great starting point but remember to analyse the statistics from your own context.

Rick’s tool had shortcomings with non-ASCII characters such as accents, symbols and non-US currency symbols which goes to show how optimization can have other unintended and undesirable effects.

[)amien

Commoditising game production

August 3rd 2006 • Entertainment (, ) • 704 views • one response

Building realistic worlds

As the power of next generation systems increases so does the complexity and realism they can portray.

For some time now consumers have been unhappy with the rising prices of computer games whilst publishers are citing spiralling production costs as the excuse for sticking with “tried and tested” formulas and franchises.

Nintendo has been able to ride the wave somewhat by being more experimental on game play and cutting costs on realism.

Middle ware already exists for graphics, networking, sound, physics, AI and scripting – indeed engines such as Unreal and Steam bundle all these things you need into one of you own but you’re still left to deliver the content itself single-handedly.

Every object – be it building, car, character even lamp-post and trash can – needs a 3D model, appropriate textures, sounds for impact and detailed lists of how it should move and behave with regards to the physics.

Commoditising elements of digital content

What must arise is an industry providing elements of digital content.

For real-life licence objects such as cars it may well be the manufacturer providing high poly 3D models of the cars from their own CAD systems, audio samples from the engine and perhaps shaders from the companies supplying their paints.

Actors agents might commission and licence approved 3D body and face models with textures. Specific motion captured movements and audio dialog sold separately*

Other content might be provided by their real-world counterparts too. Houses provided by real-world architects and populated with furniture from designer brands.

These real-world objects can provide a whole new level of realism to the games they occupy whilst at the same time providing a more subtle form of advertising – the product placement.

Add an inquire” option that lets you point at the nice bookcase you blew to pieces and get some product details up from the manufacturer. Maybe it’s in your price range, maybe not… or maybe it’s a design being considered with a note thanking you for your interest…

Once the cost of building digital worlds has dropped then production houses can be more experimental. If not, the door is open for the indie developer to compete on the same playing field.

If these savings can also be passed onto the consumer maybe they can afford more than one game and will be happy to try new genre’s too…

[)amien