Author Topic: ASCII Plasma + floormapper (QB45 code but runs on XP)  (Read 10026 times)

0 Members and 1 Guest are viewing this topic.

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
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.....
« Last Edit: July 11, 2006 by relsoft »
Challenge Trophies Won:

Offline Ghost^BHT

  • Clueless and Happy
  • ^GVY
  • Pentium
  • ******
  • Posts: 931
  • Karma: 49
  • BYTE ME!
    • View Profile
Man, the colors sux but the code is cool :)  :cheers:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17378
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
The colours are probably like that because of the screen mode.
Nice one Rel :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2452
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
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?
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17378
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
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!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2452
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
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 ;)
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17378
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
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!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
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.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
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. :*)
Challenge Trophies Won:

Offline Tetra

  • DBF Aficionado
  • ******
  • Posts: 2532
  • Karma: 83
  • Pirate Monkey!
    • View Profile
Nice one Relsoft :)

Running the exe on my computer was a bit jumpy :(  :whack: my crappy computer
Challenge Trophies Won:

Offline TinDragon

  • Pentium
  • *****
  • Posts: 644
  • Karma: 24
    • View Profile
    • J2K's blog
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 ???

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
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. :*)
Challenge Trophies Won:

Offline TinDragon

  • Pentium
  • *****
  • Posts: 644
  • Karma: 24
    • View Profile
    • J2K's blog
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.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17378
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
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? :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
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 )
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17378
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
Cool, got it to work from the command line, thanks Clyde sorry to topic hijack Rel.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2452
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
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.
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
You guys are  running this in a window?

Press ALT+Enter when theprog runs ;*)
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17378
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
It makes all the difference. I must admit that I was running this in windowed mode.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline relsoft

  • DBF Aficionado
  • ******
  • Posts: 3303
  • Karma: 47
    • View Profile
Bump

Press ALT+ENTER to see it in full screen.
Challenge Trophies Won: