I just wanted to let you know that I'm tinkering away at my background code and tools for a new game project and the first stage is almost done -- a 'software sprite' system.
(Sorry I couldn't figure out how to embed the gif...)
https://drive.google.com/file/d/17HEjsb ... sp=sharing
Believe it or not, there's a lot going on in that little gif;
- Character based sprites
- Double buffered display
- Page flipping and screen clearing during the VBI (edit - I forgot to mention what a challenge this was..) The display is currently 40 columns x 20 rows and there isn't time in the vertical blank period to simply set 800 bytes to zero. So for every line I keep a 'screen clear byte' which tells me which column of 8 characters in that line needs zeroing. When plotting a character it's trivial to divide its X position by 8 and EOR the result into the screen clear byte.
- Sprite data can be pre-shifted right to allow per-pixel screen position (rather than moving a whole character at a time)
Of the 8 static sprites in the gif the bottom row shows pixel offset versions (2 pixels shifted each time in monochrome Gr. 0, which equals 1 pixel in 4 colour mode)
- When drawing a sprite the system looks to see if there's already a character on screen at position (x,y) and if there is, it EOR's the new sprite data into it, otherwise it places the next free char on screen and copies the sprite data into that. Repeat for all characters of all sprites.
- Sprites can be any number of characters in width and height (within reason) and there's a pre-calculated look up table for empty characters that the sprite drawing routine can simply ignore.
- I've not implemented masking because it's going to be too much of burden on the system but I could implement it just for special cases (like the player sprite) should the colour mangling turn out to be particularly distracting. I can't yet decide if a per-pixel version of the ZX Spectrum's colour clash will be endearing or just plain shite
- Right now it's managing to draw a decent number of sprites in real time but I think I'll need to find some performance tweaks and/or limit the number of objects on screen once the actual game gets under development
- So far, only running in Altirra, configured as a stock, PAL, 64k, 800XL but I look forward to testing on real hardware when there's something more worthy to test
- Test sprites in the gif are nothing to do with the game I have in mind
- I have a tool in the works for converting bitmap data into sprite code and because I want scaled versions for each sprite it'll handle that too (eventually!) https://drive.google.com/file/d/171S0hx ... sp=sharing
I just wanted to thank you Keith for the inspiration. Please keep up the great work!