pouët.net

Go to bottom

128b Plasma contest

category: general [glöplog]
OK, here's a static plasma effect which I programmed 12 years ago. I'm curious if you'll be able to size-optimize it to 128 bytes or less.

Code:// Plasma coded 1996 by The Real Adok #include <stdlib.h> char point13h(int x,int y) { asm { mov dx,word ptr y mov ax,320 mul dx mov bx,word ptr x add bx,ax mov al,byte ptr es:[bx] } } void pset13h(int x,int y,int col) { asm { mov ax,320 mov dx,word ptr y mul dx mov bx,word ptr x add bx,ax mov ax,word ptr col mov es:[bx],al } } void setpal(char col,char r,char g,char b) { asm { mov al,byte ptr col mov dx,3c8h out dx,al mov al,byte ptr r inc dx out dx,al mov al,byte ptr g out dx,al mov al,byte ptr b out dx,al } } void plasmacol(int xl,int yo,int x,int y,int xr,int yu) { int col; if(point13h(x,y)==0) { col=xr-xl+yu-yo; col=random(col*3)-col; col=col+point13h(xl,yo)+point13h(xr,yu)>>1; if(col<1) col=1; if(col>189) col=189; pset13h(x,y,col); } } void makeplasma(unsigned int x1,unsigned int y1, unsigned int x2,unsigned int y2) { int col; unsigned int x,y; if((x2-x1)>1) { x=(x1+x2)>>1; y=(y1+y2)>>1; plasmacol(x1,y1,x,y1,x2,y1); plasmacol(x2,y1,x2,y,x2,y2); plasmacol(x1,y2,x,y2,x2,y2); plasmacol(x1,y1,x1,y,x1,y2); col=(point13h(x,y1)+point13h(x2,y)+point13h(x,y2)+point13h(x1,y))>>2; pset13h(x,y,col); makeplasma(x1,y1,x,y); makeplasma(x,y,x2,y2); makeplasma(x1,y,x,y2); makeplasma(x,y1,x2,y); } } void plasmapal(char j) { char i; for(i=63;i;i--) { setpal(i+j,0,i,i); setpal(i+63+j,i,0,53-i); setpal(i+126+j,43-i,i,i<<1); } } void main(void) { unsigned int i; unsigned char j=0; char direction=1; asm { mov ax,13h int 10h mov ax,0a000h mov es,ax } plasmapal(j++); makeplasma(0,0,319,199); for(i=0;i<=1000;i++) { if(j!=0) plasmapal(j); j+=direction; if(j==0) direction*=-1; asm { mov ah,86h xor cx,cx mov dx,ax shl dx,1 int 15h } } asm { mov ax,3 int 10h } }
added on the 2008-05-13 16:26:19 by Adok Adok
Quote:
// Plasma coded 1996 by The Real Adok


Ahhh... I see.. THE REAL ADOK...
added on the 2008-05-13 16:28:37 by Puryx Puryx
Supplying that code is pretty pointless.
added on the 2008-05-13 16:30:01 by superplek superplek
use crinkler lol :D
added on the 2008-05-13 16:41:02 by wie8 wie8
See If You Can Beat The Real Adok Contest '08
please stand up.
added on the 2008-05-13 16:44:52 by Gargaj Gargaj
adok: Where do you get the idea that a 128 byte plasma effect is so impossible? Do you just start a new thread every time you see a comment on a random prod?
added on the 2008-05-13 16:51:43 by gloom gloom
bash the adok with salt-less arguments round 57!
how about showing 128b plasmas or drink cup of stfu?
and yes, ofcourse it's possible and been done already, im quite sure pure asm versions with their source available are around in the database even. pirx will paste the urls soon.
added on the 2008-05-13 16:59:43 by psenough psenough
Pirx will also prove that 64kbytes for debris is a bit too much.
added on the 2008-05-13 17:11:42 by wrthlss wrthlss
Advanced 128b plasma tutorial in the next Hugi \o/
added on the 2008-05-13 17:11:46 by keops keops
doesn't compile
That code is horrible.
added on the 2008-05-13 17:20:29 by Preacher Preacher
Code: MODEL TINY CODESEG .386 IDEAL ORG 100h XSize = 25 YSize = 25 Start: mov al,13h int 10h push 0a000h pop ds Main: in al,40h sbb di,ax mov cl,YSize Vert: push cx mov cl,XSize Horiz: inc byte ptr ds:[di] inc di loop Horiz add di,320-XSize pop cx loop Vert in al,60h cmp al,3 ; \o/ jne Main int 10h ret END Start
Quote:
The Real Adok


Quote:
The Real Adok


Quote:
The Real Adok


Quote:
The Real Adok


and for emphasis:

Quote:
The Real Adok


That boy is ooooon~~~~~~~ holler!
added on the 2008-05-13 17:27:02 by okkie okkie
Doesn't look too nice when ported to processing. Is it supposed to have this kind of palette?
BB Image
added on the 2008-05-13 17:29:09 by linde linde
Ah I think I know what I did wrong now... You are writing colors outside the palette memory, and I simply %=256'd those outside values!
added on the 2008-05-13 17:32:03 by linde linde
Looks a bit better now.

Most 128b's have really crappy palettes, but their motion and patterns are IMO often better than this.
added on the 2008-05-13 17:43:30 by linde linde
Yes, I've even seen a "plasma" effect sized 64b, but can you make this plasma in 128b or less?
added on the 2008-05-13 18:07:06 by Adok Adok
BTW: The above code compiles with Borland C++ 3.1. The resulting executable worked on my PC using the DOSBox emulator.
added on the 2008-05-13 18:11:17 by Adok Adok
Oh and.. http://www.pouet.net/prod.php?which=11680 (not exactly a good plasma :P)
added on the 2008-05-13 18:19:05 by Optimus Optimus
Mmm,. I've just seen that the plasma wave is too ..wavy. Not my good plazma.
added on the 2008-05-13 18:20:14 by Optimus Optimus
http://www.pouet.net/prod.php?which=50542

I just figured out that it could be quite easy to take my old code from siback, remove the blobs, remove several random stuff from the plasma calcs (but as much as it needed to still have nice plasma moves/shapes), maybe changed a bit the colors and voila. With vsync, escape button and proper exit to 03h. And even a non standard generated pallete.

I also remember that I once had a dream to make a 128b intro because I already did 32b, 64b and 256b and that was the only number remaining. But that was not what I had in mind :P

I believe it can be sort of done in 64b too but I a suck at size optimizing compared to some other people.
added on the 2008-05-13 19:06:01 by Optimus Optimus
adok, this is not a plasma but a subdivision-cloud with color-cycling.
go learn your roots.
added on the 2008-05-13 19:38:38 by hfr hfr
OK, nevertheless it's beautiful :)
added on the 2008-05-13 19:53:40 by Adok Adok

login

Go to top