Author Topic: SHort intro challenge Textured Lava blob  (Read 8452 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17422
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
This is definately my last attempt at this.
Hope you like it. By the way, it can be further condensed but I left it as it is because I like the effect and didn't want to ruin it by purely optimising for size as the effect fits easily in 20 lines anyway :)

Code: [Select]
#DEFINE PTC_WIN
 #Include Once "tinyptc.bi"
 If( ptc_open( "TEXTURED BLOB LAVA LAMP BY SHOCKWAVE ^ DBF 18 LINES.", 640, 480 ) = 1 ) Then dim shared buffer(640*480) as integer, buffer2(640*480) as integer, colours (320) as integer, strt as double,intr as double,buffer3(640*480) as integer, fact as double
 for a=-300 to 640*480
    if a<0 then colours(a+300)=rgb( 0,0,(a+300) *.35  ) else if a>=0 then buffer2(a) = rgb(0,0,((int(a/640)) xor (int(a mod 640))))
    if a>=0 then buffer3(a) = rgb(0,((int(a/640)) xor (int(a mod 640))),0) next
 do     
    for y=0 to 479
        leng=250+(199*cos((y-timer*214)/63))*sin((y+(timer * 263))/(150+150*sin(timer*.00002)))
        intr = (640/leng)
        strt = 0
        fact=0.001
        if intr <=0 then intr=1
        for x=0 to 640
            if x>=320- (leng/2) and x<= 320 + (leng/2) then buffer((y*640)+x) = ((buffer2((y*640)+int(strt)))*fact) else buffer((y*640)+x)=buffer3((y*640)+x)+colours( y shr 1 )
            if x>=320- (leng/2) and x<= 320 + (leng/2) then strt=strt+intr
            if x>=320- (leng/2) and x<= 320 + (leng/2) then if x<320 then fact=fact+.002 else if x>320 then fact=fact-.002 end if next next
 ptc_update@buffer(0)  loop until inkey$<>""
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17422
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: SHort intro challenge Textured Lava blob
« Reply #1 on: June 16, 2006 »
Same code, different background..
Code: [Select]
#Include Once "tinyptc.bi"
 If( ptc_open( "TEXTURED BLOB LAVA LAMP BY SHOCKWAVE ^ DBF 18 LINES.", 640, 480 ) = 1 ) Then dim shared buffer(640*480) as integer, buffer2(640*480) as integer, colours (320) as integer, strt as double,intr as double,buffer3(640*480) as integer, fact as double
 for a=-300 to 640*480
    if a<0 then colours(a+300)=rgb( (a+300) *.15 ,(a+300) *.25 ,(a+300) *.35  ) else if a>=0 then buffer2(a) = rgb(0,0,((int(a/640)) xor (int(a mod 640))))
    if a>=0 then buffer3(a) = rgb(0,((int(a/640)) xor (int(a mod 640))),0) next
 do     
    for y=0 to 479
        leng=300+(199*cos((y-timer*214)/63))*sin((y+(timer * 263))/(150+150*sin(timer*.00002)))
        intr = (640/leng)
        strt = 0
        fact=0.001
        if intr <=0 then intr=1
        for x=0 to 640
            if x>=320- (leng/2) and x<= 320 + (leng/2) then buffer((y*640)+x) = ((buffer2((y*640)+int(strt)))*fact) else buffer((y*640)+x)=colours(y shr 2)
            if x>=320- (leng/2) and x<= 320 + (leng/2) then strt=strt+intr
            if x>=320- (leng/2) and x<= 320 + (leng/2) then if x<320 then fact=fact+.002 else if x>320 then fact=fact-.002 end if next next
 ptc_update@buffer(0)  loop until inkey$<>""
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: SHort intro challenge Textured Lava blob
« Reply #2 on: June 17, 2006 »
Well smart, nice one dude.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Rattrapmax6

  • Atari ST
  • ***
  • Posts: 131
  • Karma: 5
  • World Wild Web Stallion
    • View Profile
Re: SHort intro challenge Textured Lava blob
« Reply #3 on: June 17, 2006 »
Pretty cool..  ;)
-Rattra (x.t.r.GRAPHICS)

Offline Tetra

  • DBF Aficionado
  • ******
  • Posts: 2532
  • Karma: 83
  • Pirate Monkey!
    • View Profile
Re: SHort intro challenge Textured Lava blob
« Reply #4 on: June 17, 2006 »
quite nice, looks like sound waves ;D
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: SHort intro challenge Textured Lava blob
« Reply #5 on: June 17, 2006 »
Indeed, looks pretty cool !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17422
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: SHort intro challenge Textured Lava blob
« Reply #6 on: June 17, 2006 »
I think that the second version of this technique was my favourite one to program out of all that I made. I'd always wanted to code the effect but never had a reason to do it :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: SHort intro challenge Textured Lava blob
« Reply #7 on: June 17, 2006 »
Nifty Shockie, welldone/
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2456
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
Re: SHort intro challenge Textured Lava blob
« Reply #8 on: June 18, 2006 »
Heh, I really like this one!
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17422
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: SHort intro challenge Textured Lava blob
« Reply #9 on: June 18, 2006 »
It's similar to yours Optimus, sorry for borrowing the texture generation idea but that xor texture is handy as it takes only a few instructions to make it. I've never used it in a prod of any kind before , normally I just use it for testing texture mapping routines when I can't be bothered to load a texture.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2456
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
Re: SHort intro challenge Textured Lava blob
« Reply #10 on: June 18, 2006 »
Yep, XOR texture is what you do (why do I call it a XOR texture when I usually use AND for it? ;)) when you want something fast with few instruction or simply don't have inspiration for an alternative texture generation algorithm. I have overused it in all my tiny intro codes ;P
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Re: SHort intro challenge Textured Lava blob
« Reply #11 on: June 19, 2006 »
Cool!!!! Looks like an intestine!
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17422
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: SHort intro challenge Textured Lava blob
« Reply #12 on: June 19, 2006 »
Ewww! I hope my intestines look different :)
Shockwave ^ Codigos
Challenge Trophies Won: