Dark Bit Factory & Gravity

GENERAL => Challenges & Competitions => Topic started by: relsoft on July 09, 2006

Title: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: relsoft on July 09, 2006
Press ALT+Enter when theprog runs ;*)

Code: [Select]
'I am crazy!!!
'Plasma and Floormapper in TextMode!!!
'Relsoft 2003
DECLARE SUB BlobsTxt (Intensity%)
DECLARE SUB DrawBlob (bx%, by%)
DECLARE SUB Mode7Text (sx%, sy%, sz%, horz%)
DEFINT A-Z

RANDOMIZE TIMER

CLS
SCREEN 0
WIDTH 80, 50
CONST PI = 3.14151693#
CONST FALSE = 0, TRUE = NOT FALSE

DIM SHARED Lsin1%(-1024 TO 1024)
DIM SHARED Lsin2%(-1024 TO 1024)
DIM SHARED Lsin3%(-1024 TO 1024)
DIM SHARED Lsin!(-10 TO 370)
DIM SHARED Lcos!(-10 TO 370)

  Â  
  Â  FOR i% = -1024 TO 1024
  Â  Â  Â  Lsin1%(i%) = SIN(i% / (16)) * 16
  Â  Â  Â  Lsin2%(i%) = SIN(i% / (32)) * 64
  Â  Â  Â  Lsin3%(i%) = SIN(i% / (32)) * 8
  Â  NEXT i%

  Â  j! = 255 / 360 * 2
  Â  k! = 255 / 360 * 8
  Â  l! = 255 / 360 * 4
  Â  FOR i% = 0 TO 255
  Â  Â  Â  m% = INT(a!)
  Â  Â  Â  n% = INT(b!)
  Â  Â  Â  o% = INT(c!)
  Â  Â  Â  r% = 63 * ABS(SIN(m% * PI / 180))
  Â  Â  Â  g% = 63 * ABS(SIN(n% * PI / 180))
  Â  Â  Â  b% = 63 * ABS(SIN(o% * PI / 180))
  Â  Â  Â  a! = a! + j!
  Â  Â  Â  b! = b! + k!
  Â  Â  Â  c! = c! + l!
  Â  Â  Â  OUT &H3C8, i%
  Â  Â  Â  OUT &H3C9, r%
  Â  Â  Â  OUT &H3C9, g%
  Â  Â  Â  OUT &H3C9, b%
  Â  NEXT



Dir% = 1
DEF SEG = &HB800
DO
  Â  counter& = (counter& + Dir%)
  Â  IF counter& > 600 THEN Dir% = -Dir%
  Â  IF counter& < -600 THEN Dir% = -Dir%
  Â  offset% = 0
  Â  FOR y% = 1 TO 50
  Â  Â  Â  FOR x% = 1 TO 80
  Â  Â  Â  Â  Â  c% = Lsin3%(x%) + Lsin1%(x% + counter&) + Lsin2%(y% + counter&)
  Â  Â  Â  Â  Â  c% = c% + Lsin3%(c%) + Lsin1%(c% + counter&) + Lsin2%(counter& - y% + x%)
  Â  Â  Â  Â  Â  POKE offset%, 177 + (c% AND 1)
  Â  Â  Â  Â  Â  POKE offset% + 1, c% AND 15
  Â  Â  Â  Â  Â  offset% = offset% + 2
  Â  Â  Â  NEXT x%
  Â  NEXT y%
  Â  WAIT &H3DA, 8
LOOP UNTIL INKEY$ <> ""


CLS

horz% = 10
sx% = 30
sy% = 30
sz% = 40
Mode7Text sx%, sy%, sz%, horz%


END

SUB Mode7Text (sx%, sy%, sz%, horz%)

'256*126 = 32256
'((256*126)+4)\2 =16130
'256*8 =2048
'32256\2=16128

FOR i% = 0 TO 359
  Â  RA! = i% * (3.141593 / 180)
  Â  Lcos!(i%) = COS(RA!)
  Â  Lsin!(i%) = SIN(RA!)
NEXT i%

  Â  FOR i% = -1024 TO 1024
  Â  Â  Â  Lsin1%(i%) = SIN(i% / (16)) * 32
  Â  Â  Â  Lsin2%(i%) = SIN(i% / (32)) * 16
  Â  Â  Â  Lsin3%(i%) = SIN(i% / (32)) * 32
  Â  NEXT i%

  Â  j! = 255 / 360 * 8
  Â  k! = 255 / 360 * 8
  Â  l! = 255 / 360 * 16
  Â  FOR i% = 0 TO 255
  Â  Â  Â  m% = INT(a!)
  Â  Â  Â  n% = INT(b!)
  Â  Â  Â  o% = INT(c!)
  Â  Â  Â  r% = 63 * ABS(SIN(m% * PI / 180))
  Â  Â  Â  g% = 63 * ABS(SIN(n% * PI / 180))
  Â  Â  Â  b% = 63 * ABS(SIN(o% * PI / 180))
  Â  Â  Â  a! = a! + j!
  Â  Â  Â  b! = b! + k!
  Â  Â  Â  c! = c! + l!
  Â  Â  Â  OUT &H3C8, i%
  Â  Â  Â  OUT &H3C9, r%
  Â  Â  Â  OUT &H3C9, g%
  Â  Â  Â  OUT &H3C9, b%
  Â  NEXT

SpaceZ! = sz%
ScaleY! = sy%
ScaleX! = sx%
Horizon% = horz%

countdir% = 1
counter% = 50
t# = TIMER
DO
  Â  F& = (F& + 1) AND &H7FFFFFFF
  Â  counter% = (counter% + countdir%)
  Â  IF counter% < 2 THEN
  Â  Â  Â  countdir% = -countdir%
  Â  ELSEIF counter% > 700 THEN
  Â  Â  Â  countdir% = -countdir%
  Â  END IF
  Â  pd% = (pd% + 1) AND 1023
  Â  ci% = (ci% + 1) AND (3)
  Â  px% = SIN(ci% / counter%) * 4
  Â  py% = COS(ci% / counter%) * 8

  Â  Angle = (Angle + 1) MOD 359

  Â  xv! = Lcos!(Angle)
  Â  yv! = Lsin!(Angle)
  Â  offset% = (80 * 4)
  Â  FOR ya% = 4 TO 50
  Â  Â  Â  Â  Â  Distance! = (SpaceZ! * ScaleY!) / (ya% + Horizon%)
  Â  Â  Â  Â  Â  HorizScale! = (Distance! / ScaleX!)
  Â  Â  Â  Â  Â  LineDX! = (-yv! * HorizScale!)
  Â  Â  Â  Â  Â  LineDy! = (xv! * HorizScale!)
  Â  Â  Â  Â  Â  SpaceX! = ((Distance! * xv!)) - (40 * LineDX!)
  Â  Â  Â  Â  Â  SpaceY! = ((Distance! * yv!)) - (25 * LineDy!)
  Â  Â  Â  Â  Â  ldx& = LineDX! * 1024
  Â  Â  Â  Â  Â  ldy& = LineDy! * 1024
  Â  Â  Â  Â  Â  sx& = SpaceX! * 1024
  Â  Â  Â  Â  Â  sy& = SpaceY! * 1024
  Â  Â  Â  Â  Â  pxysin% = Lsin3%(px% + py%)
  Â  FOR xa% = 1 TO 80
  Â  Â  Â  Â  Â  xx% = sx& \ 1024' + (pd%)
  Â  Â  Â  Â  Â  yy% = sy& \ 1024' + (pd%)
  Â  Â  Â  Â  Â  c% = Lsin1%(xx% + px%) + Lsin2%(yy% + py%) + pxysin%
  Â  Â  Â  Â  Â  c% = Lsin2%(xx% - counter%) + Lsin3%(Lsin1%(yy% - counter%) - Lsin3%(xx% - counter% - c%))
  Â  Â  Â  Â  Â  POKE offset%, 177 + (c% AND 1)
  Â  Â  Â  Â  Â  POKE offset% + 1, c% AND 15
  Â  Â  Â  Â  Â  offset% = offset% + 2
  Â  Â  Â  Â  Â  sx& = sx& + ldx&
  Â  Â  Â  Â  Â  sy& = sy& + ldy&
  Â  NEXT xa%
  Â  NEXT ya%

  Â  WAIT &H3DA, 8
LOOP UNTIL INKEY$ <> ""

END SUB

Exe in attachment.....
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Ghost^BHT on July 09, 2006
Man, the colors sux but the code is cool :)  :cheers:
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 09, 2006
The colours are probably like that because of the screen mode.
Nice one Rel :)
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Optimus on July 09, 2006
The floor mapper looks really cool! The plasma goes a bit too fast for the char resolution. Nice colors!

So,. is ANSI also accepted on the competition? Normally, ASCII means monochrome characters and ANSI is the VGA chars with colors. At the beginning by reading that the compo is ASCII I thought I should be restricted to the ASCII mode, but if I can also do something in ANSI then cool! There is a diferrence between ASCII and ANSI. Maybe you can refer that ANSI is also allowed to the compo thread so that we know?
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 09, 2006
Yes, by all means use ansi.
The theme of the comp is to create effects from characters, whether they are monochrome or if they use any screen palette, whether they just use the standard ascii set or any extended characters is cool, just have at it and see what you can do!
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Optimus on July 09, 2006
Ok, cool! That's fine for me..

Actually, I know some people from Pouet who would start bitching like hell about the diferrence of ASCII and ANSI ;)
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 09, 2006
So do I :)
Gladly we don't have too much bitching here, just lots of happy coding!
I've seen previews of the winners banners that Wham is drawing for this comp and they look great btw!
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Clyde on July 09, 2006
It's pretty quick is that. Is the Plasma the texture used on the floormapper, as it was so fast I may of missed the 2 if they were seperate.

Welldone dude,
Clyde.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: relsoft on July 10, 2006
It's pretty quick is that. Is the Plasma the texture used on the floormapper, as it was so fast I may of missed the 2 if they were seperate.

Welldone dude,
Clyde.
Nope, the floormapper gets textured "real-time".  Calculate the pixel then the texel and plot. :*)
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Tetra on July 10, 2006
Nice one Relsoft :)

Running the exe on my computer was a bit jumpy :(  :whack: my crappy computer
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: TinDragon on July 10, 2006
I am afriad I dont really see a plasma or a floormapper, it just looks like random colored squares with a very rare at times look as if there trying to make a pattern like a plasma, guess it could be running to fast on my setup ???
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: relsoft on July 10, 2006
I am afriad I dont really see a plasma or a floormapper, it just looks like random colored squares with a very rare at times look as if there trying to make a pattern like a plasma, guess it could be running to fast on my setup ???

Download the latest attachment in the first post and see if it is still fast. :*)
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: TinDragon on July 10, 2006
I can see a bit more that it is like a plasma shape at times but it's still seems way to fast, think the color restriction is a bit of a problem making it seem worse than it probably is.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 10, 2006
Do you know what is really cool about this? It's that it's in proper text mode and the effect still runs while you are moving the window. Sure it runs really fast here too but I can still see what it is, perhaps it may run better on other systems with a smaller sine addition?

A question Rel, is there any way of compiling a fb program so that there is no dos window? :)
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Clyde on July 10, 2006
Yeah use in the compiler options in FB or after your programs name if your using the command prompt. -s gui ( switch graphic user interface )
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 10, 2006
Cool, got it to work from the command line, thanks Clyde sorry to topic hijack Rel.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Optimus on July 10, 2006
Oh, and don't forget to press space or anything. Yes there are two parts and I would press escape in the plasma part if I hadn't read here there is a floor part too.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: relsoft on July 11, 2006
You guys are  running this in a window?

Press ALT+Enter when theprog runs ;*)
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 11, 2006
It makes all the difference. I must admit that I was running this in windowed mode.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: relsoft on July 11, 2006
Bump

Press ALT+ENTER to see it in full screen.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Shockwave on July 11, 2006
Too subtle  ;)

PRESS ALT+ENTER TO SEE IT IN FULL SCREEN!
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: relsoft on July 11, 2006
LOL!
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Clyde on July 11, 2006
I didnt realize about pressing space either to see two different effects ( maybe in the future, add a readme or put a few details on any keys )

I quite like your Voxel Plasma thang Relsoft Dude.

Nice,
Clyde.
Title: Re: ASCII Plasma + floormapper (QB45 code but runs on XP)
Post by: Rbz on July 12, 2006
Nice one Rel   :cheers: