From: mcuddy@fensende.Rational.COM (Mike Cuddy)
Subject: Re: Wolf3D -- programming aspects
Organization: Rational
Date: Wed, 7 Oct 1992 21:13:10 GMT

chrisg@cbmvax.commodore.com (Chris Green) writes:

>In article <leifv.36.718453033@dhhalden.no> leifv@dhhalden.no (LEIF HUGO VARUM) writes:
>>>> 	I realize that since we don't have byte-addressed graphics like the IBM,
>>>> I'll have to do it plane by plane and it'll take a while.  But I'm aiming
>> ....
>>BTW one of the Amiga programmers was Paul Woakes (Mercenary, Damocles).

>	For "real" texture mapping (like in Ultima-UnderWorld), I'd recommend
>generating your texture mapped polygons into a fake frame buffer, stored
>in fast ram at one byte per pixel. After the whole frame has been rendered
>into this fake buffer, transfer it to chip ram, converting it from chunky
>to planar. This has a lot of advantages over writing your texture map
>routines to work in planar modes:

I've got routines to do this, but the point that I'm hanging up on is the copy
from the chunky pixel array to planar display memory.  I'm running on a 
2000+RCS/040 so FAST ram access is very fast, but CHIP ram access is pokey!

My texture map (actualy, perspective map... faster, and cheaper) routines
run at a blazing speed if I don't have to copy out to chip ram... :-(.

anyone have any ideas for making a fast copy-out loop? (The approach that I
was using was load-up 32 bits into a register and write them out into CHIP
ram at one shot ... at the time it seemed like a good idea, but I'm not so sure
now...)

>o	Easy coding.

Yep.

>o	The fake frame buffer will be in fast ram, and will be cached
>	on the processors with data caches.

Major speed improvement.

>o	To change the depth of your screen, say from 16 color to 32 color,
>	you only have to have a different transfer routine.

The crux of the problem ... I request again, anyone got a transfer routine?

>o	You can easily do a table lookup while transferring the pixels to
>	chip ram. For instance, you could write your game to do 256 colors
>	on AGA, and simply remap the pixels through a lookup table to
>	whatever normal amiga mode you use on non-AGA machines. In fact,
>	by using two lookup tables (one for even pixels, one for odd),
>	you can get a "free" 2x2 dither. This provides a simple way to let
>	the user pick between 16, 32, EHB, or 256 colors.

good idea... Time to get my artist friend to re-draw all of our bitmaps in
256 color... ;-)

>o	If you beam-synchornize your fake-frame-buffer to chip-ram copy routine,
>	you can get away without double-buffering, thus saving chip ram.

okay, I'll byte ... got a routine that's fast enough to beam-sync?

>o	If you used (perhaps conditionally) WritePixelArray8 to do the planar
>	conversion, then your game would work on any graphics device that
>	supports graphics.library.

Is WritePixelArray8 fast enough?

>	For "fake" texture mapping (like in Wolf3d), you the planar nature
>of the amiga will not effect you in the slightest:

actually, it does.... 

>	Store each column of the texture map at "n" different vertical
>magnifications. 
>	Step horizontally across the polygon, determining at each
>position which vertical scale factor is correct. 
>	Use the blitter to copy the appropriate vertical column to the screen.

... did this ... eats up too much memory ... the way I was doing it, about 90KB
a 'block' (64x64x5 blocks, scaled from 10 to 320 pixels).  I want graphic
variety... not 5 or six different walls/objects... without requiring 10mb of 
memory to run ;-).  (The texture map routines I have right now handle loading
of IFF animbrushes for animated doors, monsters, fireplaces, fountains, 
whatever.)

>	Note that for texture mapping games of this nature, there is no reason
>that they cannot be completely multi-tasking. In fact, they can run happily
>in draggable intution screens.

I'm using the LoadView() type of multi-taksing with my game's task bumped 
a few priority points and I eat the input stream ahead of the commodities
(however, I give it all back when 'paused').

--Mike Cuddy (mcuddy@rational.com, fensende!mcuddy@apple.com)
To Anachreon in Heav'n/Where he sat in full glee/A few sons of harmony sent a 
petition/That he thier inspierer and patron would be/When this answer arrived/
from the jolly old Grecian/"Voice, fiddle and flute,/no longer be mute,/
I'll lend ye my name/And inspire ye ta' boot/And besides I'll instruct ye/
like me, to entwine/the Myrtle of Venus with Bacchus' vine!
-- sing to the tune of the star spangled banner... (these are the orig words,
yes folks, our national anthem is a ``let's get drunk and F*** song'').