Trying to get speed from the monochrome sprites

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Trying to get speed from the monochrome sprites

Post by stefano »

I tried to use medium sized monochrome sprites in a game.
The performances weren't good, but I could reach a reasonable speed by substituting the putsprite's "spr_and" option with clga().
clga(), aka cleararea(), can be faster but on many target it is provided by a *very slow* generic implementation, the only interesting version seems to be the Spectrum one.
In any case the VDP driven targets will hardly reach a reasonable speed in bitmap mode :(
invaz2.gif
https://github.com/z88dk/z88dk-ext/blob ... invazion.c
You do not have the required permissions to view the files attached to this post.
fraespre
Member
Posts: 56
Joined: Mon Aug 19, 2019 8:08 pm

Re: Trying to get speed from the monochrome sprites

Post by fraespre »

ei Stefano, really nice graphics! Congrats!

I think you could try to use the sp1 sprite engine. That would improve the speed very much.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: Trying to get speed from the monochrome sprites

Post by stefano »

I know, but being one of the authors of the portable graphics engine I wanted to squeeze and test it.
The sprites I'm using are a 24 pixels wide, designed with the sprite editor.
The collision detection is a mixed technique of position checks and multipoint() calls.
It is obviously possible to get something similar with SP1, but porting SP1 to other targets is not the simplest thing ever.
Tuning putsprite() and clga() is not simple, but at least I'd start from something slow but in working order.
invazion-pc6001.png
You do not have the required permissions to view the files attached to this post.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: Trying to get speed from the monochrome sprites

Post by stefano »

The whole development took me very few hours in less than 2 weeks, in small spare time slots.

The pictures from the startap menu are cliparts from NewsMaster, captured with the sprite editor.
The title screen was converted with the wonderful BMP2SCR.

Another interesting source for graphics is the vector conversion from SVG sources. I created a small library here:
https://github.com/z88dk/z88dk-ext/tree/master/graphics

spaceship.gif
A very tiny example on how to use this stuff is in {z88dk}/support/graphics
Again, ideally, this is all portable stuff.
You do not have the required permissions to view the files attached to this post.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: Trying to get speed from the monochrome sprites

Post by Timmy »

I like it! The Spectrum version is really fast!

As for the other platforms... Well, I guess this shows why the Spectrum was a really innovative computer back then. Most computers from that era never really had faster screen updates.

For a machine like the MSX, you'd probably need to use sprites, but the MSX unfortunately can only handle 4 sprites on the same horizontal line. And using SCREEN2 as a bitmap mode won't help you at all, unfortunately (I've implemented a sprite routine before, so I know it doesn't work.)

As for porting SP1 to the VDP related screens, I'd probably say that's not really feasible. (I've tried.) The problem really is that SP1 wants to do so many things, and has very strict memory requirements, that it's easier to write a minimal portable version of VDP routines instead.

I might actually attempt doing something like that for the MSX to see how feasible it is to write a good and simple VDP related library, hopefully I'll have more time sometime this year. (I should be doing something for Spectrum 40 first, but I probably don't have time for that either.)

PS. I also wrote a fast XOR based sprite routine for Future Looter, that has less flicker but without using a 6k background buffer. Instead it uses a 1K buffer for attributes and collision detection and a buffer for scanline start locations. Perhaps I should extract it from the game one day. It does use preshifted sprites though, so it still has a big memory requirement.
Timmy
Well known member
Posts: 392
Joined: Sat Mar 10, 2012 4:18 pm

Re: Trying to get speed from the monochrome sprites

Post by Timmy »

As for the svg part, here are just some related svg/z88dk threads over on WoS:

https://worldofspectrum.org/forums/disc ... amusements
https://worldofspectrum.org/forums/disc ... l-graphics

Also, thanks for explaining how you generated the .h files, I already suspected it was in {z88dk}/support/graphics.

In one of those links it seems that the Mojons also made a svg related library. I might look at that later.
Post Reply