Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A texture-mapped raycaster in 128 bytes (pouet.net)
82 points by RodgerTheGreat on June 24, 2014 | hide | past | favorite | 36 comments


    ; 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


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!


If memory serves me right, fs=gs=0 in DOS mode, and 46C is a tick counter of some sort.

And on a C64, addresses 53280 and 53281 change text background and border. Don't know why I remember these things.


fs (and gs) is/are initially set to 0 when a com file gets executed.


Something terrible and greatly upsetting seems to have happened in the comments, but I can't for the life of me understand what.


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.


It all got silly back in the day.

I was a member of various demo groups/cracking groups and I experienced all sorts of oddness. People wanting arranged fights because they thought their code was better !?

Beyond me.


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


For some reason the link to all the scene lingo is down now. Is there a backup? Did it move? Do I need to be "in" something?


Very worthwhile anecdote starts at 48:20ish


Ah the Demoscene... This is the kind of stuff that got me interested in programming in the first place. :)


The 1st place entry is apparently very similar, but trades interactivity for sound and rather more psychedelic colours:

http://www.pouet.net/prod.php?which=63517


Same author.


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.


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


> 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.


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.


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.


bemmu

Hopefully you see this, unfortunately your comment is dead.

Because I think your comment has value I will quote it here, please let me know if you'd like it removed.

"You can also have procedural music.

Viznut (a legendary Finnish democoder) did some experiments to see how short you could code something that still sounds at least interesting:

https://www.youtube.com/watch?v=GtQdIYUtAHg

I also wrote piece of JavaScript that can play these programs in case you want to try create your own: http://www.bemmu.com/music/index.html "


Thank you all, malnourish, bemmu and viznut -- now I understand how the 8bit synth works in Caustic on my Android tablet. Furthermore, I want to make my own music software on my Raspberry Pi and Adapteva Parallellas and this is the first real step on the path to that.


Make sure to watch some of the later videos too as viznut added some visualizations as well: https://www.youtube.com/watch?v=tCRPUv8V22o


Thanks for the link, very cool.


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.


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. :)


... 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 :)


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.


I think that is the best argument you could make!


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


For comparison, here's a 256 byte raycaster targeting the commodore 64. The included assembly source is considerably more readable and enlightening, but it also doesn't feature texture mapping like this one:

http://www.pouet.net/prod.php?which=61298


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".


What a typical HN response. Do everything in JavaScript.


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.


A harsh response, yes. But frankly, what you said was harsh. An interactive raycaster in an executable an order of magnitude smaller than most networks' minimum transmission unit is an incredible accomplishment, and your response is to essentially drop trou and take a dump on it because teh w3b 4evaz.


What I said wasn't harsh, it just wasn't apparently enough genuflection and awe to appease the people that happened to be interested enough to check the comments on this link. I care about as much as I did yesterday, which is not nothing. You and everyone else who demands more will just have to deal with it.


No; if you don't appreciate something because you suspect you don't understand or lack context (as you expressed), you should just keep your mouth shut lest you sound like an idiot.


To be perfectly honest, you should be sorry.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: