Posted By
indi on 2006-02-03 05:21:58
| Re: Xeo3 - Background tiles..... Blog 29/01/2006. (impasse!)
No, I have an "automask". What this does it to use the pixel data to automatically build a mask for the sprite, This adds 2 instructions to the sprite system but is actually quicker than using a mask that I then have to rotate. But what this means is that because I dont store a mask, you can't then use black as a colour. In effect, you end up with the same effect as the C64's hardware sprites. Helow is the core of the sprite system..
lda (Temp+18),y ; 5 tax ; 2 lda (Temp+2),y ; 5 and MCMAutoMask,x ; 4 ora (Temp+18),y ; 5 sta (Addr),y ; 6 iny ; 2 = 29 (with 7 sprites=14,616 cycles)
So for each byte of the sprite, I lose 6 cycles. This turns out to be a lot less then the combined effect of rotating and storing the actual mask (which I've also tried). Every now and then I look back of the sprite system to see if I can speed it up... no joy yet
Memory: I already do this because the sprites have to be double buffered. The main memory block is a rotation cache for the sprites. Normally in games that draw software sprites, they get stored rotated for speed. However, this drops the number of variations of sprites down a lot. So what I do is to have a rotation cache, and rotate the sprites on demand using a barrel shifter. This does take a hit each time a sprite comes on, but I get a lot more shapes for my memory. a LOT more. So rather than say 40-50 baddie graphics if Im lucky, I get 167 (currently).
Heres the current memory map - although it does change now and then.... sometimes a lot as data is shifted around.
$0800-$17ff 2 Screens $1800-$27ff Music (4K) $2800-$5000 Game Code and DATA $5000-$5fff Game charactermap (double buffered) (4K) $6000-$7fff Sprite graphics (167 16x16's) (8K) $8000-$8800 spare....(2K) $9000-$97ff Game Data (4K) $9800-$9fff Barrel shifter for sprite caching system (MCM version) $a000-$a3ff Panel Character Set (95 chars + space) $a300-$afa7 Level Data-13 screens (7*13 - 3x3=91*13=$49F, 200 3x3 blocks=$708) ($ba7) $b100-$bfff PATH data... (4k-256 bytes) $c000-$efeb 141 pre-rotations... ($2feb - 141*87) $f000-$f578 ScrollBuffer $f578-$fd00 Spare.... (1.5k)
I have been thinking of using TED sound to allow sound effects as well as SID sound, which would also be a first for a game.... that would be neat. But I'll have to get into that later. Yes, the sound does hurt though, quite a lot. But a game simply isn't finished without it. I would probably be able to get another software sprite on if I didn't have complex sound - but 1 sprite, or great sound.... I prefer the sound.
Theres also very little "non-empty" sections, and the "check" would be way more expensive that just drawing the lot. I also dont want a smaller area... that affects the look, and currently it looks better than any other Plus/4 Shoot-em-up because we're oushing the limits.
Yeah, I put a lot in ZeroPage, But Im going to have to store all of that so I can use the ROM to load levels...which is a kicker..
|