jump to navigation

long time no see May 17, 2009

Posted by winden in demoscene, in real life, metablog.
add a comment

It has been now more than half a year since I last wrote, it’s funny to look back and see how sooo many things happened realise that time flies… so I think I’ll make a quick recap.

Christmas vacations:

Nice to have a few days of work from the comfort of the family couch, and the crazy glances when going for drinks at the Alameda at 3am with a t-shirt while everyone else was trying to avoid freezing with their jackets. The only negative point would be that I had to work during 1st Jan so I could not part all night long…

New android phone:

A nice treat for Christmas. At first it could not stay up for one complete day without going out of battery, but the new code version has improved a lot on that, and the photo application with the automatic GPS is really handy.

New blog:

I started the code for a new blog which I plan to host on my own domain, mainly motivated by now wanting to be held hostage anymore by pre-packaged systems. It’s not ready yet, but it will come for sure. At the very least I already have the code handy to slurp the contents off this blog, which is a plus.

Malaga offsite:

I had a quick 2 day trip to Malaga with my work team mates, we had lots of fun going around the city with Leunam and Niani hosting us around. Amonst the highlights of the trip were meeting Alex’s sister and the good time at the beach when both James and Kuba could not resist taking an small siesta :)


Contributed to the brokepoint sponsoring and took a good visit there… it was already almost two years since I last went to a big party, and was sorely missing it… It was nice meeting HAM, IQ, BP and all the others… for bonus points, I got to chat for a while Tron/Sanity^TRSI^Artwork of Interference fame  :)

Travel to California:

This time only for two weeks… too short trip, I think next time I’ll spend at least 1 month or so. The return was specially killer, I got so jetlagged I decided to take a few days off to cool down, which also helped plan future developments. While there I did my obligatory visits to San Francisco for drinks with Ryan/CTL, the Zeitgeist beer garden and new for this ocasion the Google San Francisco office. As improvements for next time, I think I’ll take a room at the city instead of Mountain View and also stay at least 1 month.

Social networking:

I’ve spent a bit of time tunning my Reader subscriptions and using it more and more to share links and comments. Also got back to using twitter to quickly broadcast stuff to the friends… back when I started using it almost no one nearby did so it was a bit of wasted time… now it had better value since more nearby people are already using it now…

Chromium for Linux and Mac:

The Linux and Mac versions have become stable enough that I can start to use them as primary browsers, the linux one at my work desktop and the mac one for my home laptop.

Some funky stuff is still happening: the mac version can’t load flash yet, which is good since it avoids unwelcome flashing stuff all over the screen but also means I have to copy-paste to firefox to watch youtube videos :/


Lots of good things happened… and while I may post more frequently from now on, it is not a given… as they say on financial advertising: past performance should not be taken as guarantees of coming performance.

Noise is dead, long live noise! August 31, 2008

Posted by winden in coding, demoscene.

Apparently Perlin noise, even the real Ken Perlin one that no demoscener ever uses due to being too compute intensive, is long dead in the high end and has been replaced by wavelet noise.

What I find really amazing is that all these variants shown on the paper describing good noise look somewhat different to the naked eye but are amazingly different when analyzed via frequencies at page 7.

I think it may be cool to try doing inverse noise synthesis by creating an spectral texture and doing an inverse frequency transform, something that I remember hearing was sometimes done for sound synthesis.

ps. paper found via the Pixar online library

Shaving bits off a float, the shiny way August 30, 2008

Posted by winden in coding, demoscene.
1 comment so far

One of the most used tricks for space optimization on 4k intros is to mangle floating point values on the executables before compressing.

Recap on standard floating point number storage

To recap, a float is stored in memory using 4 bytes, with bit-fields packed like this:

  • 1 bit for sign, s
  • 8 bits for exponent, e
  • 23 bits for mantissa, m

The exponent is stored with 127 added to it, so the final value is basically

  • value = power(2, e – 127) * (1.0 + m)

What this means is that the exponent is used to select which bracket to use:

  • e = 125 –> value is between 0.25 and 0.5
  • e = 126 –> value is between 0.5 and1
  • e = 127 –> value is between 1 and 2
  • e = 128 –> value is between 2 and 4
  • e = 129 –> value is betweem 4 and 8

And then the mantissa is used to select a number inside than bracket.

Shaving off bits

Compressor engines work by detecting repeating patterns and encoding them in non-obvious ways. The most obvious pattern to detect are strings of zero bits or zero bytes.

That can be used in our advantage: the executable or datafile will compress better if there are many zero bytes, and that is easy to do if we somehow force some bits on the float values to zero. Let’s say we blank out the 2 lower bytes on a float. That means that we end up with this floating point representation:

  • 1 bit for sign
  • 8 bits for exponent
  • 7 bits for mantissa

You could say that this forces us to use numbers other than what we wanted, but that was already the case since floats are only an approximation. How do you store π on a normal float? You can’t, since a float is just a 23-binary digits approximation to the value we want!

I really need a value that is not available by using fewer bits… Help!

That’s so wrong it hurts, you don’t really need them for making a demo. A demo is created by faking, fudging and tweaking until it looks good. You can probably achieve what you want by mangling either that number, another number or the whole formula in a random way.

How to shave bits, the shiny way (aka “in the future the compilers will obsolete the coders”)

Ideally, we would want to automate the whole process of shaving off bytes. One of the nicest parts of C++ is that compilers can detect and eliminate operations at compile time if they can prove that the result will be the same as doing it at run time. Given C++ templates and reasonably modern C++ compilers such as gcc 4, we can try this way:

class f16 {
union {
mutable unsigned int _iv;
mutable float _v;
inline f16(float const v) {
_v = v;
_iv = _iv & mask;
inline operator float() const {
return _v;
inline operator unsigned int() const {
return _iv;

What is happening here is that we create an object from a float, and the constructor stores that value with the lower 16 bits forced to zero. As the real storage place is marked as private and thus hidden from any other code, the compiler is able to optimise it and the resulting executable only has the masked value.

How to shave bits, the reliable way (aka “compilers are evil and does things behind my back”)

A big problem with the previous method is that it depends on the compiler realizing that he can optimize the code that way. If you need to be sure that the compiler only stores truncated numbers in the executable, the easiest way is to simply never feed him numbers other than the ones that are already in the format we want.

There are two ways:

  1. Place the proper numbers my hand or by preprocessor macros
  2. Make a filter that reads the source code, detects the floating point values and outputs the code to another file with truncated numbers.

How to shave bits, the backhanded way (aka “compilers are dumb, I better fix their output afterwards”)

Nowadays the leading executable compressor Crinkler is capable of automatically truncating bits. This is done by using the name of the variable as a hint to the compressor, which dutifully takes the variable and masks off lower bits before starting to compress anything. While nice and really automatic, I’d consider this a catch-all rule and just use any of the previous techniques in addition to achieve better control of the numbers.

Relevant links:

Wikipedia article on floating point numbers

IQ/RGBA article on truncating floating point numbers by hand

in4k article on truncating floating point numbers both by hand and by script

Crinkler executable linker and compressor

Reducing number of divisions for polygon mappers – part 5 April 26, 2008

Posted by winden in coding, demoscene.
1 comment so far

NOTE: moving to my new winden homepage

Reducing number of divisions for polygon mappers – part 4 March 29, 2008

Posted by winden in coding, demoscene.

NOTE: moving to my new winden homepage

Reducing number of divisions for polygon mappers – part 3 March 27, 2008

Posted by winden in coding, demoscene.
add a comment

NOTE: moving to my new winden homepage

Reducing number of divisions for polygon mappers – part 2 March 24, 2008

Posted by winden in coding, demoscene.

NOTE: moving to my new winden homepage

Reducing number of divisions for polygon mappers – part 1 March 23, 2008

Posted by winden in coding, demoscene.
add a comment

NOTE: moved to my new winden homepage

Your demomaking style ends up reflecting on your CV style September 8, 2007

Posted by winden in demoscene, in real life.

I’ve been reading a bit about how to make the proper format for your CV, and most guides placed great importance on making sure it doesn’t go futher than 2 pages. I decided to try to print out mine, and guess what, it takes up 9 pages!

Discussing that with leunam/network today, he also doesn’t like that “2 page limit” very much, which I think somwhow reflects our shared preference towards 8 minute long demos full of everything under the sun instead of mostly-one-routine 3 minute demos (take for example roots/sanity vs c42).

Maybe it’s related to the short attention span syndrome that plagues the masses of the MTV generation?

BcnParty 2006 newschool amiga demos slides are available September 2, 2007

Posted by winden in demoscene, Linklog.
add a comment

Since buying my new MBP with a copy of keynote, I wanted to polish and publish my newschool amiga demos presentation slides I gave at the part, so here are they finally!

Edited later on: have also uplinked the live video to the pouet page.