Sunday, 28 September 2008

The feeling that is gone..

This is a complement to the previous post. It's all about this magic feeling of the demoscene, the demos doing the impossible thing and how it is gone. Not because of age, not because of modern hardware, not because of any cliche reason you'd think (like the scene is dead). Because it's different when you watch the first demos, trying to code your first effect and imagining how the hardware works. It's different when you go to your first demoparties, it's different when everything is new for you than when the demoscene is all you were doing for years.

I still can stare back at C64 achievements, CPC effects or 386 demos and respect the effort and genious behind some "impossible" ideas. But they will never give me back the same feeling as during the first times. The feeling of the impossible, the feeling of my dreams.

Someone said that democoding is like magician's work. You are trying to do something which in the far end can be explained but seems to be impossible. It's programming and trickery combined. The young democoder starts as a newbie, trying to learn the basic trick with the cards while staring with awe upon the cut in half with a saw high level magicians, wondering if it's really a trick or they have sold their soul to the devil. As they learn more, they figure out that even the most amazing tricks are nothing really extreme in reality. The magic is gone.



We used to stare at effects like the above done on an 8bit and wonder how is it possible? Today, most of my favorite C64 effects (bitmap manipulating, precalculated mapping, etc) are just big unrolled codes of LDA/STA. It only remains to precalculate the 3d to 2d coordinates and correlate the pixels of a bitmap to the positions of the screen for a bunch of pixels to be written. Then you only scroll the bitmap or increase/decrease an index register (depends on the size of your bitmap and what you want to achieve), rerun the unrolled codes for each frame and voila! It's no big deal (the biggest pain is to generate the unroll codes and fit them in memory I think), though the first time I would see this effect on an 8bit I would think it's impossible. Now the magic is gone.

The magic is gone even for the more clever codes. Or at least, I have seen now what a C64 can really achieve, I even know that if these things are possible on the C64 they can easilly be done in the CPC too at similar speeds, I have a big idea of what is possible in 8bits, 16bits or early 32bits today, so it's really hard for me to feel the magic. I may still be impressed, especially when C64 coders continue to do slightly better versions of these effects today, as they continue to improve when you first think there is nothing more to be done. I think the best times for someone in the demoscene are maybe the first years.

The magic was getting even bigger as someone started learning to code. During the first years I didn't know much about optimizing Z80 assembly, my code was slow, I didn't even thought someone would unroll codes to the last pixel and that would save him from other things too (no need for compare/jump, values could be given directly instead read from tables, etc) and when I tried to scroll say 1000 bytes the screen was almost refreshed once and then I thought "If I need a vbl to move 1kb then how can they move and even manipulate whole screens? I never expected it to be soooo slow..". Then everything seemed more impossible because I didn't had the experience to know the tricks and the limits.

I believe that small fractions of the feeling can come back at times. At rare times someone tries not to do a slightly better version of an effect but something new, not done before especially in this speed (for example, the free directional tunnel of Error 23, not seen before on the C64 and thought it was PC territory because it needs floating point calcs even with subdivision). It's not because the scene has changed and people code less impressive things, it's because you have seen everything and have a wider view of why they are possible. Maybe it really is because we have done a lot and it's harder to impress (like in music when a new genre appears and everything after that is copies, because the original is done once) but maybe this feeling was always present at any age and maybe when people age in these territories they feel that everything is stagnating unlike their first years. Maybe it's just a feeling. But one I can never experience in the same sense again. I just long for those rare impossible effects that can bring the feeling back for a while..

Thursday, 25 September 2008

Why I love the demoscene?

Some funny things I have heard from people with old computers hating hardware requirements.

"Hardware requirements are illogical. It's a conspiracy of the software and hardware companies. 386 is enough for everyone!"

"I can't understand why 3d studio needs an FPU coprocessor. It doesn't do anything extreme that can't run on my 386."

"3D graphics are 2D really. Projected on screen. So, they should run as fast as 2D games.


"Myst has better graphics than Quake but it only needs a 386 while the latter requires a Pentium. It's a conspiracy!"

"My TV set can show movies with perfect video featuring explosions and a lot of crazy action and it's just a cheap chipset. Why can't FPS on my 386 do that?


"That game is a 10 MIPS software while on PC we write code of 3 MIPS, that's why consoles can do it better" (pointing at some lousy prerendered animation on 3DO console =)

A PC Master reader: "I assure you that need for speed can easilly run well on a 286."

Some friend pointing at an arcade coin op: "Mortal Kombat 4 should run on my XT. Why not?

When you are an illiterate user you can't understand the difference between realtime or not, you don't have an internal knowledge of the process that is required for a game to render something on the screen, you only compare the final image thinking that your average 3d engine should be the same fast as a prerendered animation or an action movie on your TV set. There is the moment when a coder comes to explain you how things are, sometimes although the software MIPS dude sounding knowledgable, is enough to make you believe.

I remember that time when two guys were discussing about that 3DO game, I knew nothing about programming then but somehow I was curious about the whole high requirements/performace issue. I wanted to know in deep what is the truth. So, hearing someone speaking the word "MIPS" I was immediately hooked. I couldn't understand though that saying this software runs at 10 MIPS wasn't exactly the right way to say it. But now I understood that he maybe meaned that the consoles were build with more processing power (he didn't mentioned custom chips) or that the game programmers are targetting a machine with lower performance than PC, optimizing their codes for a hardware with less MIPS or something like that.

It doesn't matter. What mattered was that by using some tech-jargon he sounded credible and knowledgable. But most of us users then were either seeing things on the surface (the graphics of Monkey Island are more beautiful than Doom but they are faster, why?) or listening to the "experts" without actually understanding in deep.




I will make a parable here. One that will get me to the point of why demoscene rocks!

Say that the clueless users who maybe wish their C64 could fly are something similar to the people believing in ufos, ghosts, fairies and yetis. They claim things with little or no knowledge, dreaming of their wonderland. The programmers are like the skeptic trying to show them what's the real deal is and land their C64s back on the ground.

Personally, I was into that anti-requirements craze (through some articles in an old greek magazine, PC Master) not because I couldn't afford a computer but somehow I was always fascinated about the software performance/hardware ratio. I have been dreamed of Quake engines running on a 386, SNES games on my CPC, MP3 players on my XT, perfect OS with high performance on low CPUs, just because of the idea of how impossible would that be! It was like a dream, till someone came and grounded me to the floor: "You know, the CPC runs at 19968 cycles per frame and smooth texture mapping would need at least a 4MIPS machine while the CPC isn't even close that!".

This was the time when an expert was talking and you couldn't say much even whether you were literate or not. The thing that I like in the demoscene is that there are times when dreams come true, where the impossible happens, where the expert sounding dude analyzing the limited performance of the hardware and requirements of the software would fail.


Say that someone comes and tells you that he observed an UFO doing impossible manouvers in the sky and then disappearing into the void. Say that you have also photographic or video evidence. He'd probably think that it's either fake or your idea while arguing why it's highly unprobable.

Say that there comes a dude claiming he has a video of the best Amiga demo running like a charm on a C64. He has video on youtube. You can be skeptical but it's the first time someone actually analyzes why it's not possible, how the C64 has not even multiplication and couldn't run 3D so smoothly, sounds (and possibly is) knowledgable, seems logical on how this is impossible on a hardware 10 times slower than Amiga (you could base upon his words if you never had the actual D64s on your hands to see it for yourself) and yet he fails. It's the first time that things we always dreamed and laughed upon are actually real! Things like Desert Dreams for C64 or Second Reality for C64, a windows like OS on the CPC, wolfenstein 3d on AtariST or Doom in spectrum (almost :). Wouldn't you say that's impossible? Wouldn't you be skeptical? Of course it's not the same doom, not the same second reality, not the same windows as in their high versions but would you still believe such a functional windows like OS would work like a charm on the little CPC? It's like the silly dreams of the people quoted in the beginning of this post, but this time it's here and it works!!!


The screenshot above is from Parts by Oxyron, a C64 demo that stroke me with awe. (Unfortunatelly it's nowhere on youtube but check this with similar tricks (Dawnfall by Oxyron)) It's a classic example where if you described the desired effect, the skeptic or knowledgable would argue that it's not possible.

I can do it myself. There is a big zooming and distorting bitmap in one part of Parts, it's not blocky, it's manipulating the bitmap so smoothly and pixel perfect! Now you'd say, C64 has around 17500 cycles free (I really don't remember) and that bitmap say it's 144 pixels * 128 lines = 18432 pixels (haven't counted really but they are a lot). For each pixel we would need 17500 / 18432 = less than 1 cycle left to run this on 50hz. Impossible! Most opcodes take 2 to 4 cycles on the C64. By using 1-2 opcodes per pixel this would even need 4VBLs. You need to do interpolation, calculate the pixel shift to make a byte and write it, maybe little more things, you'd need 6-7 lines of code. Even with LDA/STA style speedcodes you'd never make it 50hz. All the data are against your dreams!

This is why I love the demoscene so much! The impossible becomes possible. It's there in front of your eyes. No magic! And there are two other reasons why I love demos so much (especially those in old computers):


  • 1) For such impossibilities to work, someone should shift his perception of how he stares at things. Because a bitmap manipulation is calculating interpolation for each pixel and writting it, it doesn't mean that what looks like pixel rendering should be done by pixels. Because something is fullscreen it also doesn't mean every byte of the videoram is really updated. You have to think out of the box! The effect in the above screenshot is done by different shifted and zoomed version of various graphics tiles done in char mode on the C64. But it looks like the perfect pixel manipulation effect!

  • 2) The one who claims it to be possible should sit down and code it. This is how the demoscene works! In the parable above, it would be like searching for aliens and then putting a real extraterrestrial body on the top of the table surrounded by skeptics. Of course there is a big difference between searching for the unexplained and democoding. There is where the demoscene gives you the tools to be creative and show the impossible.




Demos do amazing things but why never games, those dudes would say. The craziest letter on the PC Master was one where a reader screamed that Second Reality surprised us in a way that noone in the commercial software companies could ever do even in a Sextium. I liked that one and wondered what is the second reality demo he mentions and if it's sooooo impossibly amazing then why I have never heard about it (similar to what skeptics say, if such crazy unexplained phenomena were real, we'd be fascinated for sure but where are they?). Though it was real! I found it and later discovered the demoscene community too.

There was a time when someone in greece formed a 8088 club. They were angry on the excessive requirements of software and wanted to go backwards. It was mostly about playing games on our XTs and stuff. They say they had a programmer. I sent them some demos and spoke the best words about the demoscene but they didn't seemed to bother. But demos were the means to say that impossible things can be true in even the lowest of hardware! Yet they were not impressed. If second reality was the greatest software ever, then why it's not heard? Now you know..

So great, so magnificent, making my dreams true, yet so few people understand it. And they still worry why Quake can't run on their 386..

Wednesday, 17 September 2008

Teapot mess 2



Here it is and my gouraud shading is not working well yet. Strange that I start from scratch and there I am back at the beginning. There are a lot to be done and I am still messing with 1993 alike treedees ;P

I did more than you can see in the screenshot. And there is still more to be done. Will it ever be a righteous 3d engine?

Monday, 15 September 2008

Teapot mess



Just an ugly test. Some polygon pushing test. To do some speed checks.

I am rewritting my software 3d engine from. Currently I am working on the PC version but there will be ports for GP32, GP2X and GBA too. I have totally rewritten the triangle rendering and setup code, quite different than the old crappy renderer, seems twice faster on PC (I am wondering how well it does in gameparks) and it's organized so that it helps me write various shaders in the future. However there is no clipping, it's buggy with the interpolation, needs subpixel accuracy and a lot of other stuff. Various old data structures are rethought and rewritten, new are added that will help me to easilly define worlds with sets of objects, materials, cameras, etc. Half of the stuff are written and there are a lot to be fixed.

I hope I will finish with it oneday because as it seems, it needs much more work than I originally thought. I am not so much thinking how to optimize (except the triangle renderer), but more dwelling into how to organize the data structures, the functions, the whole logic in the best way possible so that it's easier for me to show stuff with this engine easilly. And everyday I discover a logic that I would prefer from what I have now. And then change my mind. And it's still a bit confusing. And the renderer is buggy and needs a lot of code :P

Maybe I will return back to CPC soon. I totally stopped working on our demo since I started with the PC engine but I needed this as a change. Now I need the CPC as a change :P