Page 1 of 1

PRISM: A library to simulate the ZX Spectrum display in LÖVE

Posted: Mon May 22, 2017 12:49 pm
by AukonDK
I'm working on my first big project using LÖVE, a Manic Miner/Jet Set Willy style game. I wanted it to look authentic down to the colours and graphical glitches of the ZX Spectrum. I developed this library so all the display stuff could be reused for other projects.

Blog post here.

Basically you pass a 2d array of bits that describe a sprite to a function that draws it on 3 canvases. 2 canvases store the colour attributes while the 3rd has the sprite itself and a shader combines the three to recreate the Attribute Clash effect. The border also has a few modes to simulate the feedback of loading from tape.

I'm really paranoid about how rubbish my code is so I'm open to any pointers.

Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE

Posted: Thu Jun 08, 2017 1:28 pm
by AukonDK
I ported a simple asteroids game to use my library. Shows off the on-the-fly sprite rotation.


Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE

Posted: Tue Jul 18, 2017 7:34 pm
by DmL
I love this! Wish I could use it in my own game (maybe I can find an excuse...) in the meantime, may I suggest:

Practical Rendering In Spectrum Mode

: D Cheers!

Edit:
Also, you could probably do this without shader code.

3 canvases: background, sprite pixels, sprite color

1. Draw the background color (could do per line or 8x8 block or whatever the actual speccy could do)
2. Draw sprites on cleared canvas
3. Draw sprite color onto third canvas
4. Multiply sprite color canvas onto the sprite pixel canvas
5. Draw combined sprite/color canvas

No idea if this would be faster, but I'd love to try/see it tried!

Re: PRISM: A library to simulate the ZX Spectrum display in LÖVE

Posted: Fri Jul 21, 2017 2:30 am
by OmegaMax
Very cool