Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Graphics Software Programming IT Technology

Hacking Hi-Def Graphics and Camerawork Into 4Kb 255

TRNick writes "The old home-computing art of hacking elaborate graphics and camerawork into tiny amounts of memory has been lost, right? Not so. The demoscene is keeping ingenious coding skills alive, and TechRadar finds out the latest developments. Winner of the 4kb competition at 2009's Breakpoint party was RGBA's demo 'Elevated,' a gorgeous scrolling demo featuring photo realistic landscapes and music, which fits into the memory used by one of your PC's desktop icons. This is really impressive stuff."
This discussion has been archived. No new comments can be posted.

Hacking Hi-Def Graphics and Camerawork Into 4Kb

Comments Filter:
  • TROJAN?! (Score:0, Insightful)

    by Anonymous Coward on Monday July 20, 2009 @11:58AM (#28757037)

    Downloaded the exe.

    Tried to run.

    SAM quarantined the file, claiming it contains a trojan.

    Damn! Photo-realistic rendering -and- a trojan in 4kb? _THAT_ is impressive!

  • by Anonymous Coward on Monday July 20, 2009 @12:04PM (#28757127)
    running on an operating system is kind of cheating, no?
  • I wish (Score:4, Insightful)

    by Khyber ( 864651 ) <techkitsune@gmail.com> on Monday July 20, 2009 @12:06PM (#28757149) Homepage Journal

    I wish more developers would try doing things like this. I can imagine a game along the designs of Doom3 or Quake4 that would fit on a floppy disc with some proper code crunching.

    Of course, the downside is that it'd be all too easy to snag tiny files like that on a torrent site.

  • Re:TROJAN?! (Score:1, Insightful)

    by Anonymous Coward on Monday July 20, 2009 @12:08PM (#28757177)
    All that means is that your antivirus software sucks.
  • Meh (Score:3, Insightful)

    by abigsmurf ( 919188 ) on Monday July 20, 2009 @12:22PM (#28757359)
    I don't deny these demos are impressive but the fact they use existing libraries lessens the achievement for me.

    When DirectX basically has it's own 3D engine, you're basically turning the task of creating a demo into generating sounds, textures and models from formulae.

    Libraries used should be limited to the minimum needed to create a window or change the display mode and shouldn't do any real grunt work or, there should be a second metric of RAM and swap files used.
  • Re:I wish (Score:2, Insightful)

    by RobVB ( 1566105 ) on Monday July 20, 2009 @12:23PM (#28757383)

    Of course, the downside is that it'd be all too easy to snag tiny files like that on a torrent site.

    That, and games would take 4 hours to start on today's processors.

  • by Anonymous Coward on Monday July 20, 2009 @12:23PM (#28757391)

    No that is impossible. The number that tells your program to stop generating would be 1MB in size.

  • by slim ( 1652 ) <{ten.puntrah} {ta} {nhoj}> on Monday July 20, 2009 @12:25PM (#28757417) Homepage

    How else do you expect people to access the graphics card? They're cheating if they don't write their own GPU driver and OpenGL implementation? Should they even be allowed to run on an existing OS, or should they have to write their own?

    To be fair, the old C64 demos probably overwrote a lot of the OS with their own code. DOS demos wrote directly to the graphics hardware (and hence often had very specific hardware requirements).

    However, I think it's entirely fair to set competition rules that allow you to use OpenGL / DirectX etc.

  • Re:Cheating (Score:2, Insightful)

    by hattig ( 47930 ) on Monday July 20, 2009 @12:25PM (#28757419) Journal

    Indeed, it's not exactly hitting the hardware at a register level like all the proper old-school 8/16/32 bit demos in the 80s and 90s.

    It's an OpenGL or DirectX demo at best, not a hardware demo.

    It is still impressive of course. Especially when you consider the music engine that's taking up some of that 4KB.

  • by Maxmin ( 921568 ) on Monday July 20, 2009 @12:26PM (#28757425)

    On second viewing, two things come to mind:

    1) the opening scene from LOTR: The Two Towers, an amazing piece of design and rendering.

    2) Audio player visualizations. The giveaway is the contrails appearing in sync to the music.

    Is it possible RGBA are using a built-in visualization library, possibly from WMP? That would explain the high level of detail and apparent use of texture maps, which I'm guessing wouldn't fit into 4kb, algorithmic or not.

    This (admittedly weak) theory can be verified by disabling the visualization library for Windows Media Player [techspot.com].

    Anyone want to volunteer to verify this?

  • libraries (Score:5, Insightful)

    by Anonymous Coward on Monday July 20, 2009 @12:31PM (#28757487)

    Everyone going on here about how stupid it is that they used existing libraries mind you that typical compo rules state that it must run on a base install. Nobody here is linking to myuberleetcode.dll or anything. That and think about the freaking sound for a second or better yet try and write a 4k and then come back and talk about how stupid it is

  • KC explored (Score:5, Insightful)

    by eddy ( 18759 ) on Monday July 20, 2009 @12:32PM (#28757501) Homepage Journal

    Yes, and that'd be very neat and much much harder than you seem to think. Try it, go looking for that magical random seed that creates a 1MB blob of code that does something impressive. Maybe you should expand your idea to first generate a filtering program that can determine if a code sequence, when run over some data, creates a demo? :-)

    4K demos are sort of an artistic exploration of Kolmogorov complexity [wikipedia.org].

    Remember also that, if the judges die of old age before your demo appear, you're unlikely to place well in the compo.

  • by fishbowl ( 7759 ) on Monday July 20, 2009 @12:32PM (#28757507)

    >The only way to access fancy features like shaders is through the driver's API.

    The API gets there somehow other than magic.

  • by Anonymous Coward on Monday July 20, 2009 @12:34PM (#28757533)

    While i certainly admire the technical skill involved, the demoscene is more than that. It's a form of art.

    Just look at http://www.pouet.net/prod.php?which=31571 [pouet.net]

  • No, they wouldn't (Score:5, Insightful)

    by Sycraft-fu ( 314770 ) on Monday July 20, 2009 @12:44PM (#28757695)

    While demos like this are extremely neat, there are also some real limitations to what you can do. This is by no means an all inclusive list but some of the major limitations of making something like this:

    1) All graphics are completely procedural, as in mathematically described. That means you don't get to have an artist sit down and draw them. Puts limits on how they can look and demands a fair bit of self similarity.

    2) You use a MASSIVE amount of memory in relation to your file size. You may have noticed it sits at a black screen for a bit before running. Why? It is doing all its calculations, decompressing in to memory. When running on my system, it took 350MB. Rather than storing lots on disk and streaming as needed, you store little on disk and have to use tons of RAM.

    3) You can't have things like voices and such in the game, takes too much space. Even with extremely efficient compression (which produces audible artifacts) voices will quickly make your game larger.

    4) All assembly coding. To do this, you are writing everything as efficient as you can. That's wonderful, but hard to maintain. For a large project that is going to need to run on a lot of systems, be patched and so on, you want a higher level language. Doing everything in assembly would be a nightmare to maintain.

    I could go on, this is just an example. What it comes down to is that this is neat for demos. I -love- stuff like this, Farbrausch is one of my favourties for this sort of thing. However it is not a realistic exercise for normal applications. You do not want to sacrifice everything just to try and have a small program footprint. On the contrary, if increasing the on disk size makes it better or more efficient, then you want to do that. Disk space is extremely cheap. Better to use more of it than to sacrifice in another area.

  • Re:Cheating (Score:2, Insightful)

    by Goaway ( 82658 ) on Monday July 20, 2009 @01:11PM (#28758167) Homepage

    Ok, you go do it and show us all how easy it is.

  • Re:finally! (Score:4, Insightful)

    by Goaway ( 82658 ) on Monday July 20, 2009 @01:20PM (#28758345) Homepage

    No, don't. Then we'll have to listen to the "THEY JUST USED BUILT-IN DIRECTX FUNCTIONS FOR THIS THEY TOTALLY SUCK" crowd all over again. There's no lack of people around here who don't have a single clue what it takes to do something like that, but will yak on and on about how it is nothing impressive.

  • by Anonymous Coward on Monday July 20, 2009 @01:25PM (#28758423)

    The difference is, the old C64 demos would run on any C64.

    This '4K' demo requires gigabytes of other code to run, so you need to install a hell of a lot of other software before it will work.

    It will only work on certain PCs with the right configurations too, and will break when the external libraries it uses change.

  • Re:YouTube version (Score:2, Insightful)

    by Anonymous Coward on Monday July 20, 2009 @01:47PM (#28758827)

    Wouldn't it be more appropriate to post a tinyurl than the direct youtube link?

    no, because then you wouldn't know what you are clicking on

  • by ls671 ( 1122017 ) * on Monday July 20, 2009 @02:24PM (#28759489) Homepage

    What is wrong today with this burst of people taking others for imbeciles ?

    I did not quote the GP while saying it was 4 KB ! There was some confusion on this thread about 4kb vs 4KB so I just mentioned:

    "By the way, the article says it is 4 KB not 4 kb".

    You need to understand that some people may write comments in a different way that some others do when they try to prove the other poster is stupid.

    To summarize I wrote :

    1) The "executable" is 4KB but it must require much more memory than what is needed to display an icon. I used the term "source" in a video/audio context where there is usually a source involved in order to provide playback. I ain't stupid enough to ignore that the 4 KB must actually be machine code. I ain't stupid enough to ignore that 4*1024=4096 either...

    2) "By the way, the article says it is 4 KB not 4 kb" in order to clarify apparent confusion due to some other posters mentioning 4 kb and also due to the fact that 4 kb was used in the summary posted on /. front page, not to try to prove the GP stupid.

  • Re:libraries (Score:2, Insightful)

    by illm ( 1106673 ) on Monday July 20, 2009 @02:33PM (#28759669)
    Actually, it's using it's own soft synth to generate the sounds along with the textures at startup. This is commonplace in 4K and 64K intros today. After the sounds have been generated, it's just about triggering the notes. If you listen again, you'll notice that the soundtrack doesn't contain that many instrument "hits", or notes if you say. The drums and bass are probably short repeated sequences, triggered by start and stop flags. This is me guessing though. And also, when you have the note sequences, it's no biggie to sync the flashes in the sky to one particular instrument hit.
  • by tepples ( 727027 ) <tepples@gmai l . com> on Monday July 20, 2009 @03:25PM (#28760433) Homepage Journal

    All graphics are completely procedural, as in mathematically described. That means you don't get to have an artist sit down and draw them.

    Then give the artist a dataflow diagram, similar to GraphEdit, to build procedures.

    Puts limits on how they can look and demands a fair bit of self similarity.

    Nature is self-similar.

    You use a MASSIVE amount of memory in relation to your file size.

    But it doesn't have to be pushed over the wire or the optical disk, which becomes important as Xbox 360 games begin to run up against the 7 GB/disc limit and PC games begin to run up against monthly download caps [wildblue.com].

    You can't have things like voices and such in the game, takes too much space. Even with extremely efficient compression (which produces audible artifacts) voices will quickly make your game larger.

    I forget: how big was the S.A.M. synthesizer on the old 8-bit home micros?

    All assembly coding. To do this, you are writing everything as efficient as you can. That's wonderful, but hard to maintain. For a large project that is going to need to run on a lot of systems, be patched and so on, you want a higher level language. Doing everything in assembly would be a nightmare to maintain.

    Sure, demos aren't intended to be maintained much past the party, but some of the procedural techniques apply just as well to C or Lisp or ML or whatever if you want to trade off some efficiency to gain maintainability.

    On the contrary, if increasing the on disk size makes it better or more efficient, then you want to do that. Disk space is extremely cheap.

    Specifically, there are places where disk space is still a lot cheaper than bandwidth.

  • by Maxmin ( 921568 ) on Monday July 20, 2009 @03:27PM (#28760445)

    I recant my rant. It really does look possible to do what RGBA did in 4KB. This thread forced me to go learn up ...

    Producing mountain-like terrains with Perlin noise [iquilezles.org].

    More by the same author (Inigo Quilez.) [iquilezles.org]

    Truly awesome and impressive. My eyes are opened, and I'm intrigued enough to try my hand at an implementation.

  • by atraintocry ( 1183485 ) on Monday July 20, 2009 @03:40PM (#28760611)

    You were actually serious about the WMP thing?

    It comes down to a few things:
    - those common device drivers can do a hell of a lot these days
    - that 4k executable expands to over 300 MB in memory when you run it
    - these techniques have been perfected over decades of work
    - mountain landscapes are one of a handful of real-world things that can be realistically generated with small equations
    - these people are exceptionally talented

    You are right to notice the similarity as there is a lot of overlap between music visualization and demoscene work. I would guess that the former arose as a result of work being done in the latter.

    It's 4096 bytes, whatever you want to call that. A typical (self-imposed) demo limitation.

    These things were being made long before there was a Windows or a WMP. And there are always those ones that make you feel like "this shouldn't be possible," but I suppose that's the point.

  • Re:Nitpick (Score:3, Insightful)

    by TCM ( 130219 ) on Monday July 20, 2009 @06:04PM (#28762739)

    Get off my lawn!

    4K = 4KB = 4096 bytes. Always will be.

Work continues in this area. -- DEC's SPR-Answering-Automaton

Working...