top | item 7940212

A texture-mapped raycaster in 128 bytes

82 points| RodgerTheGreat | 11 years ago |pouet.net

36 comments

order
[+] 3rd3|11 years ago|reply

    ; Wolf128 by Baudsurfer/rsi 2014 aka olivier.poudade.free.fr
    ; A 128 bytes interactive intro tested on XPSP3 and DOSBox
    ; Presented at Outline demoparty in Eersel/The Netherlands
    ; 256 bytes versions : 
    ; http://www.pouet.net/prod.php?which=24755
    ; http://www.pouet.net/prod.php?which=3396
    ; P.S : click left mouse button to start moving in maze
    ; Greets to UkkO Ggn Fra Den and assembly language lovers 
      org 100h
      mov al,13h
      int 10h
      les dx,[bx]
    A:mov cl,0ffh
    B:mov bl,cl
      not bl
      lea ax,[di-10h]
      mov bp,140h
      cdq
      div bp
      call G
      call G
      test byte [1dh],7
      jz C
      add dh,[1fh]
      sub bl,[1eh]
      jmp short E
    C:mov dl,[fs:46ch]
      sub bl,[si]
      test dl,40h
      jnz D
      add dh,dl
    D:add bl,dl
    E:shld bp,bx,10
      sub dh,[bp]
      mov al,dh
      and dh,bl
      or dh,ah
      and dh,20h
      loopz B
      xor al,bl
      xor al,ah
      db 0d4h,10h
      add al,10h
      stosb
      or di,di
      jnz A
      mov ax,3
      int 33h
      test bl,al
      mov [1dh],bl
      jz F
      mov [1eh],dl
      mov [1fh],cl
    F:in ax,60h
      dec ax
      jnz B
    G:xchg ax,dx
      sub ax,64h
      imul ax,bx
      add ax,[si]
      ret
[+] atesti|11 years ago|reply
Does someone know what "mov dl,[fs:46ch]" does? In win32, fs and gs point to some process or thread info blocks, but in DOS? I was never aware of anything regarding the fs register and DOS unless a dos extender was run or pmode was entered!
[+] bshimmin|11 years ago|reply
Something terrible and greatly upsetting seems to have happened in the comments, but I can't for the life of me understand what.
[+] CountHackulus|11 years ago|reply
Guy is claiming to be a memeber of a legendary group, people are arguing for and against this. I personally couldn't tell you which side is right.
[+] patrickyeon|11 years ago|reply
As CountHackulus says, basically "drama". If it amuses you for some reason, you might want to check out "Jason Scott - You're Stealing It Wrong! 30 Years of Inter-Pirate Battles" from Defcon 18. http://youtu.be/QCAL_YgYiP0 The meat of the talk starts around 24min.

edit: while re-watching, I should warn you lots of foul language and some NSFW imagery

[+] hexagonsun|11 years ago|reply
Ah the Demoscene... This is the kind of stuff that got me interested in programming in the first place. :)
[+] jakejake|11 years ago|reply
These demos always amaze me. Can somebody enlighten me as far as the way the size is measured - does it typically include all of the assets such as music and textures? I was watching a few of the demos and it blows my mind that the audio would even fit in that amount of space, let alone the visuals.
[+] sergejsb|11 years ago|reply
To my understanding - yes, all "assets" are typically included. In most of the cases though, all assets (textures, geometry, sounds, camera paths) are generated during runtime. More information can be found, for example here: http://iquilezles.org/www/index.htm
[+] exDM69|11 years ago|reply
> Can somebody enlighten me as far as the way the size is measured - does it typically include all of the assets such as music and textures?

In size limited categories like 4k and 64k intros as well as "challenges" like this, the size is the final size of the executable. The productions are typically delivered as a single executable with no other files, so everything is bundled into the executable. In 4k and 64k there is usually some kind of compression algorithm used to compress everything that's possible, including the actual executable code.

The "assets" are procedurally generated as much as possible. A hand-written software synthesizer and the control data ("sheet music") can fit in to less than one kilobyte, which is a lot less than producing a few minutes worth of music otherwise. Same goes for the textures, 3d models, etc.

[+] jdboyd|11 years ago|reply
All assets are bundled into the executable and the measured size is the size of that executable.

If you download the 14k .zip file available on that web page, inside you will find a 128 byte .com file. In this case, there is no sound and the textures are generated procedurally.

[+] joshvm|11 years ago|reply
Size includes everything. Usually the textures are procedural, but can be seeded so they're the same every time. Music is usually pretty easy to encode if it's a chiptune, loads of redundant data.
[+] PhasmaFelis|11 years ago|reply
Man, wouldn't it be awesome if we'd had the public internet instead of just BBSes back when stuff like this was cutting-edge tech, instead of just a clever hack? Imagine if, say, C64 devs and hackers could do this kind of sharing instead of being limited to word-of-mouth.
[+] leorocky|11 years ago|reply
These kinds of ray casters are really cool, but at this point in time I don't care about how small the code base is, just make a really cool ray caster in JavaScript and don't worry about how big the code is (within reasonable limits)! I just want an awesome JavaScript ray caster library to be honest. :)
[+] dguaraglia|11 years ago|reply
... and that's exactly why you don't get why this guys are trying to achieve. This guys are counter-culture. They are trying to write the smallest functional ray caster/sound engine, you name it. They target maximum functionality with minimal bloat. Coming to a post like this to say you want a ray caster in JS 'no matter how big it is' is very misguided; the equivalent of going to a Tesla dealership (assuming such a thing existed) and telling the dealer 'well, this is all amazing technology and stuff, but what I really want is a Humvee with two cupholders on each seat, 5 TVs and a driver, I don't care if I need an atomic power plant to keep it running'.

It's all fine and dandy here, HN is an open group after all. But don't go with that kind of comment to a 'scene' forum or they'll chew your head off :)

[+] jameshart|11 years ago|reply
I'm not sure you appreciate quite how small 128 bytes is; for comparison, your entire comment is 305 bytes. This one's just 128.
[+] RBerenguel|11 years ago|reply
There was one posted a few weeks ago. 128 bytes is incredibly impressive. You may not care, the world may not care, but reducing code so much is a work of art
[+] jzzskijj|11 years ago|reply
A interactive raycaster in 128 bytes and you "don't care". No matter what year it is, it is a feat that really says "BEAT DIS".
[+] na85|11 years ago|reply
What a typical HN response. Do everything in JavaScript.
[+] leorocky|11 years ago|reply
Looks like this comment of mine was irrevocably wrong and completely irredeemable. No apology is possible and I'm sorry for my very existence. Go social voting sites! Go internet culture! Yay.