ritz' thoughts about 4k intro coding

ritz[ND-44-ZH]

adok asked me about new trends in 4k intro coding just as a question in an email discussion of ours. contrary to his expectations i replied with quite a long piece of text about 4k introcoding and the effects of pizza and democoding in general. so here it is. i edited it a little bit because emails are not diskmag articles [or so i've heard].


i was actually quite optimistic about the 4k intro scene. but after this email discussion i went to bizarre2000. it was the first demoparty i went to without an actual production, but i decided against hacking together a 4k intro over night because it wouldn't meet my standards anyway. two days later i saw the 4k introcompo, and i was very very very disappointed. two entries, and they sucked. guess other people have different $tandard$.


so anyway, my article. my opinion is that you can fit much more in 4k intros than what's seen today. to adok, i stated that you can fit as many effects in a 4k as there were in 64k's a few years back. i also stated that the same thing goes for 64k's and demos, btw. while this is not entirely true, for example you can't fit .xm's or a lot of pixeled gfx in a 4k, the effects can all be coded in asm and therefore be very small. size optimizing is not that hard if you think of smart ways to represent static data (calculate it) and try to make your algorithms as small as possible (and still running at a decent framerate of course).

another new trend is the fact that 4k intros are slowly moving to windows. it's no surprise that 4k's are the last of the demo/intro categories to move to windows. after all everybody knows that you get an awfully big header and annoying file-alignment added to your filesize under windows. well that's not really necessary, because with a few hacks and slashes you can make windows executables really small. read franky's article in this issue for more information.

so what do you need to do to make a kickass 4k? the keyword here is: synthesis. if you calculate everything you need, instead of storing it in raw data, you save a LOT of space! instead of having data, you just take a few starting variables and 25 bytes of asm code and you have a nice texture. or a sound. or maybe even a piece of music.

a very important thing that is often 'forgotten' in 4k's [read: don't know how to make it small] is music and sound. in the old days people sometimes used adlib or GUS to make sound in 4k's. i have never heard 4k GUS music, because i don't own a GUS, but i suppose it's not that much better than adlib sound :) [in a 4k of course] anyway the keyword here is again: synthesis. you need to do sound-synthesis in realtime [or maybe precalc it, but it's fun to do it realtime :) ]. this way you can generate complex sounds in very small pieces of asm code. to get started on sound synthesis, read 'yehars dsp tutorial for the braindead' in hugi#20, get your ass to www.harmony-central.com and start following links everywhere.

another thing you need in order to make a good 4k is design. actually you always need design to make anything good, so this also goes for 4k's. so how do you fit design in a 4k?

i'm not sure if synthesis is the keyword here again, but you might wanna think of synthesizing design elements into your 4k. for example if you have the song in your 4k, you can make the effects react automagically to the music, like a winamp plugin especially made for this song.

to accomplish this, you need effects that can look very different when variables change. this brings us to a new keyword in successful 4k introcoding: reusability. this is not the OOP kind of reusability, unreadable code is allowed in 4k's and often necessary to gain those few bytes you desperately need to put in that last word of that excellent piece of text you thought up to fit the music. :) here it means that you want to use the same routines in most of your effects. a good example of this is in my 4k 'organic'. the backgrounds you see there are all generated using a simple plasmagenerator coded in about 100 bytes. also i have made a texturemapped polygon routine that i use for the tentacle effect, the particles AND to render the font in weird shapes. and the lightning effect can also be interpreted as reusing code, because it is a recursive procedure, so it actually reuses its OWN code!! :) as a last example of reusing code and to plug more of my 4k intros, 'meuk' uses one channel in the musicplayer routine to display the text on the screen. this is possible because of the way i designed the player, for every channel/instrument there is a procedure which is called when a notehit occurs.

as a last subject i want to present some ideas which i haven't implemented myself yet, but which can be very cool for 4k intros. you can use stochastical algorithms to generate complex things. for example a random music generator can be much smaller than the actual pattern data. to make this sound good, you should not just generate random notes and random bassdrum and hihat hits. you actually need a lot of knowledge about statistics and music theory, but it is possible. don't hesitate to invest some time in research to create fantastical new things. with research i don't mean that you should read as many demoscene docs as possible, but you might actually want to download those weird postscript documents professors have written about stuff that has slightly something to do with the subject you are exploring. i have spent a lot of time reading about wavelets or non-photorealistic rendering. just take a look at the stuff while having in mind: "i can do that shit... in realtime!". instead of stochastical algos, you could also try and use genetic algorithms, although i'm not sure if the fitness function of the data you want to create can be coded smaller than the statistical function if you would use a stochastical method... another thing i miss lately in 4k's is the use of fractals..

of course a realtime fractalzoomer is not a big deal anymore, with the amount of processorpower these days, but that's not what i want to say. i would like to see beautiful one-frame shots of the mandelbrot-fractal, used as a designy [blackwhite or something] background for a cool effect [look for an example at the first few editions of wilby4k diskmag]. animated fractals suck anyway. oh, and please quit using that old XOR-pattern in 4k's, even though it _is_ fractal, it sucks and you can do better. :)

well that's about all i can think of concerning 4k's at the moment.. it's also 01:20 so i should stop :) i hope you enjoyed my first article for hugi. don't hesitate to email me for stupid questions, intelligent questions, irrelevant questions or no questions at all. btw, if you expect to see a 4k release of me soon, i don't promise anything.. currently ND-44-ZH is working on a innovative 64k to be released at mekkasymposium2001, so i may not have time..

if you want to take a look at my 4k intros, please visit http://pcmuon.phys.rug.nl/~ritz and vote for me while filling in your votesheet :) [btw the site still says i'm a member of revolution, but i left them and started ND-44-ZH with some more motivated ppl who also happen to live closer to me]


ritz[ND-44-ZH]