Behind the tranq..

The goal this time was to make a fully scripted demo.  Effects are all in subroutines.  
They're called in succession with parameters including duration, texture, rotate/zoom 
speed, and script to use.  "Script" here means a set of DATA lines to restore and read,
containing a sub-duration, overlay (gfx on top of the effects), and sub-effect/filter
values, such as flash, fade, wobble, or glitch.  This allowed for very flexible demo
design for an oldskool platform, although the main thing missing is sync.  I ran out
of time for that. :)  Fortunately the soundtrack is ambient enough where syncing is not
too important.  But the durations could be changed from milliseconds to pattern rows,
or one could just do the math.

The concept..

The first effects were made in July 2011, shortly after @party.  I was actually trying
to make a rotozoomer, and while I pulled it off it was incredibly slow.  The way I did
it though, it was easy to change a few parameters and make a polar-warping effect.  To
help speed it up, I used "interlacing", i.e. filling in even rows on even frames and
odd rows on odd frames.  This added a little motion blur, which helped set the mood.
I then decided the next QuickBasic project would be ambient/noise, and all 2D.  The
early tests were monochrome/grayscale, but I decided to keep the demo that way for the
atmosphere, and besides, shading and crossfading is MUCH easier in grayscale. :)

The effects..

The bulk of the demo was coded in spurts between March and June 2012, as I can't really
spend a whole day coding anymore.  Believe it or not, there are only three core effects
in the demo: rotozoom, tunnel, and Wolf3D (textured wall raycasting).  Each core effect
has two variants, making for six subroutines, and each has their own set of filters/
sub-effects.

- Rotozoom: The first variant is the wrong way to do a zoom/rotator: pre-calc the angle 
and distance from the center for EVERY PIXEL, and save them in arrays.  Add to angle to
rotate, multiply distance to zoom.  Even with only 1/4th the screen calculated (2x2
pixels), the number of array lookups per frame slows this down.  On the bright side,
messing with the angle values allows for various warping effects (around the center),
resembling the tunnel-to-rotozoom effects of the mid-late '90s DOS demos.

The second variant is the proper way to rotozoom: RZ(X, Y) = (Cos Rot * X / Zoom + 
Sin Rot * Y / Zoom, Sin Rot * X / Zoom - Cos Rot * Y / Zoom).. roughly.  This still
allows for stretching horizontally or vertically.

- Tunnel: The first variant is based on my older tunnels, with all the pixels pre-
calced, and just shifting the texture X/Y offsets to move it.  The second variant is an
"oversized" tunnel, the same as the first but scrolling the view of a larger tunnel.
Because the larger array must be string*1's rather than integers, it peeks all over the
place to get pixel values.

- Wolf3D: First off, I must confess that this code is derived from sample code from
Ken Silverman, who made Ken's Laybrinth at a young age, followed by the Build engine
used in Duke Nukem 3D, Shadow Warrior, and others in the mid 90s.  You can find the
original code at http://advsys.net/ken/klab.htm (labdemo2.bas).  I tried making this
all myself, but gave up on the math.  I did make plenty of changes and tweaks, of 
course, so now we have shading, reflection, some floor/ceiling backgrounds, wall
effects, and a "fish-eye lens" view, my favorite tweak.

The first variant uses a floor/ceiling background stored in memory (I added multiple
versions for the final release) and draws 320 vertical wall strips.  This is in fact
the only effect in the demo to use a background buffer (which pretty much all my past
demos used) and have no interlacing.  It allows for horizontal warping, which, combined
with palette effects, makes for one trippy Wolf3D experience.

The second variant uses vertical interlacing, drawing 160 wall strips per frame.  In
theory, this would make it twice as fast, but I can't use a background buffer anymore,
and have to draw the ceiling and floor in vertical strips like Ken's original example.
It's faster when the walls are up close, but the same speed or even slower for far
distances.  I do like the motion blur effect though, and when I tested the fisheye
effect on a reverse (white background) palette, I knew that had to go in the demo.

Now that you've read this far, you get to learn about the hidden part!  I've added
interactive mode for the non-interlaced W3D effect.  Run "tranq -goobers" (Wolf3D fans
will get the reference :) and play with the following keys:
 Up/down: move forward/backward
 Left/right: turn left/right
 PgUp/PgDn: raise/lower view
 Alt-left/right (can't hold down on NumPad): strafe left/right
 F1-F4: change background ceiling/floor
 1: toggle "fish-eye lens" view
 2: toggle plasma wall (turning it off won't revert to the original wall)
 3: toggle rotozoom wall (ditto)
 4: toggle TV-cam wall (ditto)
 5: toggle horizontal wobble
 6: toggle vertical flip (like old TV sets)
 7: toggle brightness flashing (grayscale)
 8: toggle hue flashing
 Esc: leave

Tools used..

QuickBasic Extended 7.1, BWSB (www.phatcode.net/downloads.php?id=170) for music, 
AdvBas for screen buffer, BasWiz for millisecond timer, some XMS lib, and Visual Basic
for DOS (yes, such a thing existed!) for compiling the EXE for 386, which speeds things
up around 5% compared to the QBX 7.1 compiler for 286.

Thanks to Krisjanis Gale (aka Rekall, formerly theHacker/Kosmic) for providing the music
on short notice.  I'd intended to do it myself, but again ran out of time.  It was a bit
tricky converting it from XM to S3M (to GDM), so I hope I didn't muddle it too much.
You can get the original (for now) at http://krisgale.com/noise/rekall_reminder.zip.

What's next?..

I really should just give the QuickBasic thing a rest, but it's one of those hobbies I
can't put down.  With FM music picking up in popularity amongst chiptune makers, I'm 
very tempted to find a working QB player for Adlib/FM music.  If I can, you could expect
an intro for Demosplash or Recursion this fall.  Otherwise, any serious demomaking 
effort will probably be collaborative, toward someone else's more modern platform.  So
I'm available for design, gfx/typography, and who knows, maybe even music again. :)

Happy trails to you,

-Phoenix, June 26th 2012.  xprojected@yahoo.com, www.facebook.com/vossanova