### Author Topic: Short Intro Challenge - Sphere mapping with plasma background  (Read 5102 times)

0 Members and 1 Guest are viewing this topic.

#### Optimus

• Posts: 2452
• Karma: 128
##### Short Intro Challenge - Sphere mapping with plasma background
« on: June 12, 2006 »
I guess I managed to obfuscate a lot of code. And with only the effect I was in 12 lines iirc. I had no inspiration for additional effects. At first I decided to call for music playing so that I intentionally reach 20 lines. But still I managed to obfuscrate the music init code too. So even if I am only at 14 lines I decided to stop here with this. Sorry, I never have motivation to fill those lines or those bytes left in size coding compos

It shows that much more can be done in 20 lines. And I was even too lazy to improve!

Code: [Select]
#include "tinyptc.bi"
#include "fmod.bi"
if ptc_open( "20 lines Optytro 3", 320, 240) then dim shared buffer(320*240) as integer
do
l! = timer * 64.0
for y%=-120 to 119
for x%=-160 to 159
k! =  sqr((10240 + sin(l!/32.0)*6144)- x%*x% - y%*y%)/256.0
if k!>0.1 then buffer((y%+120) * 320 + x% + 160) = (((((x%/k! + l!*8) AND (y%/k! + l!*8)) AND 255)) SHL 16) OR ((sqr(x%*x%+y%*y%)) AND 255) else buffer((y%+120) * 320 + x% + 160) = ((sin((sin(x%/45) * 41263 + sin((y% + l!*2)/45) * 65446 + sin((x% + sin((y% + l!*1)/64) * 256)/67) * 36676 + sin((x% + y% + y%)/127) * 7896)/4096) * 127 + 128) SHL 16) OR (((x%+160) SHR 1) SHL 8) OR (y% + 120)
next x%
next y%
ptc_update@buffer(0)
loop until inkey\$<>""

Goodnight..

p.s. Music by the hardliner btw.
p.p.s. I could obfuscrate more but it started being too slow. E.g. I made a test where I removed X, Y loops, inserted a For i=0 to 320*240-1 loop, and in all the big line with maths, I changed X with ((i mod 320) - 160) and Y with ((i \ 320) - 120). Crazy!!! But I decided to not put this here because it made the code even more slow and I already had more than enough lines anyways..
p.p.p.s. External files are allowed eh? Like fmod.dll and a music. Or not? I've seen somewhere that they are allowed..
p.p.p.p.s. And it still impresses me that by using FPU in such a crazy way with so many calcs per pixel (at least for small resolutions) can still have an ok speed. Not the way I knew to optimize things in quickbasic
« Last Edit: June 12, 2006 by Optimus »
Challenge Trophies Won:

#### Tetra

• Posts: 2532
• Karma: 83
• Pirate Monkey!
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #1 on: June 12, 2006 »
Really like this one! The math behind that sphere completely mystifies me

Nice going with two great effects in one

Challenge Trophies Won:

#### Shockwave

• good/evil
• Founder Member
• Posts: 17378
• Karma: 497
• evil/good
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #2 on: June 12, 2006 »
In 20 lines that would be slick, 14 lines for this is extraordinary  My favourite so far, speed is ok too
Shockwave ^ Codigos
Challenge Trophies Won:

#### Rbz

• Founder Member
• Posts: 2721
• Karma: 485
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #3 on: June 13, 2006 »
Wow, that's really cool
Challenge Trophies Won:

#### relsoft

• Posts: 3303
• Karma: 47
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #4 on: June 13, 2006 »
Been away for 2 days and you guys make some amazing stuff. Great jobs and proggies guys!!!!
Challenge Trophies Won:

#### Optimus

• Posts: 2452
• Karma: 128
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #5 on: June 13, 2006 »
Thanks, thanks! Now I am thinking about my second entry. Something diferrent this time..
Challenge Trophies Won:

#### Clyde

• A Little Fuzzy Wuzzy
• Posts: 7271
• Karma: 71
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #6 on: June 16, 2006 »
That is purely awesome, nice one Optimus.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

#### cirux

• Atari ST
• Posts: 129
• Karma: 4
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #7 on: June 19, 2006 »
Wow, thats amazing to have both effects in such few lines

#### Phoenix

• C= 64
• Posts: 99
• Karma: 4
##### Re: Short Intro Challenge - Sphere mapping with plasma background
« Reply #8 on: June 21, 2006 »
That's awesome for 14 lines!