A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / Wolf engine with blitter

 

Author Message
xeron
Member
#1 - Posted: 22 May 2007 13:39 - Edited
Reply Quote
Blueberry posted about vertical filling using a XOR operation, which i thought was really cool and so simple I wondered why I never thought of it.

I then wondered if it could be used to render a wolfenstein engine on an unexpanded A500. In my mind it works like this:

1) Take an 8-colour texture, and encode it like this: For each vertical line in the texture, record where to put start/stop pixels for the vertical fill (three tables per column, one for each plane). So, for example, if the left hand pixel column of a 64x64 texture had the top half filled and the bottom half cleared in plane 0, that line would be encoded as "0,32".

2) Do your raycasting so you know your wall heights for every column across the screen, and scale the texture data from the tables above accordingly, and draw the pixels with the CPU.

3) Do a blitter fill across all 3 planes to "fill in" the texture.

Possible speedups:

* For each word sized column, remember the highest and lowest points so you only fill the areas where there is filling to do

* Use triple buffering; one frame is on the screen, the next is being filled by the blitter, and the third is being drawn with the CPU.

* Use a table to scale the data from the texture tables

Comments? Would this be fast or is it a crap idea?
doom
Member
#2 - Posted: 22 May 2007 15:19
Reply Quote
Only one way to find out. :)

Problems with the approach:

1) You need to draw front-to-back with Z-buffering (one depth per pixel column). I think the original Wolfenstein engine does this in a clever way, but I'm not sure how.

2) You need to keep the textures really simple, since it takes up to three reads and writes (byte size) to plot the colour change along every pixel column (on top of table lookups and the rotation/perspective maths).

More ways to speed it up:

A) Interleaved bitplanes.

B) Sacrifice vertical resolution and run in 1x2.

C) Draw only flat surfaces and do the texturing with copperchunky. This may also look funky.

D) Remove all NOP instructions from your innerloops.

Also, you could use vertical filling in combination with horizontal filling to do simple scaling of 2D sprites. Plot one pixel where ever there's a corner along the outline of a shape, then blitterfill horizontally. For colour you'd do it for each bitplane individually.

All in all I think there's too much pixel plotting for it all to work.
xeron
Member
#3 - Posted: 22 May 2007 15:39
Reply Quote
Why would you need Z-buffering for a simple wolf engine?

BTW, i was thinking that running in 2x1 would be a better speedup than running in 1x2, since it reduces the reads/writes for plotting the start/stop pixels.
xeron
Member
#4 - Posted: 22 May 2007 15:53
Reply Quote
Oh yes, and interleaved bitplanes... clever. Do the filling in one pass then.
doom
Member
#5 - Posted: 22 May 2007 19:48
Reply Quote
I don't actually know what you'd normally do for a Wolfenstein engine. :) But yeah, Z-buffering wouldn't make sense now that you mention it. You would have to draw front-to-back though, since you can't draw one pixel column over another. Or would you use some kind of raycasting technique?

1x2 would be easier on the blitter. Cause, clearing 3 bitplanes, then copying 3 bitplanes with two source channels, that's a lot of blitting. But 2x1 is a good idea too. So.. 2x2!
xeron
Member
#6 - Posted: 22 May 2007 21:49
Reply Quote
You don't need Z-Buffer or front to back. You just draw left to right. Wolfenstein engines are generally raycast :-)
winden
Member
#7 - Posted: 23 May 2007 07:39
Reply Quote
vertical fill wolfstein == dungeon effect on second part of roots/sanity (notice the texture is not complex)

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0