ZX Spectrum Game Development Noob Questions

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
R-Tape
Site Admin
Posts: 2157
Joined: Thu Nov 09, 2017 11:46 am

Re: ZX Spectrum Game Development Noob Questions

Post by R-Tape » Tue Jun 11, 2019 9:46 pm

Ralf wrote:
Tue Jun 11, 2019 9:22 am
You could really try to do a Spectrum clone of Lumberjack game. If would be easy enough and if I recall correctly you said you have some artistic skills so nice graphics would help a lot.
I think you should have a bash at this too Ralf. Considering the amazing job you did on Flappy Bird ZX, this has your name all over it!
0 x

User avatar
Mozartkügel
Berk
Posts: 18
Joined: Fri Jun 07, 2019 7:19 am
Location: Finland

Re: ZX Spectrum Game Development Noob Questions

Post by Mozartkügel » Wed Jun 12, 2019 6:02 am

djnzx48 wrote:
Tue Jun 11, 2019 8:51 am

I don't think games using 8-pixel character movement are naturally 'worse'. It can be a great way to have colourful sprites and backgrounds without causing any clash, and makes it easier to do fullscreen scrolling. For some examples you can see: Sgt. Helmet Zero, Sword of Ianna, The Amazing Rocketeer, Metal Man Reloaded.
I agree that it's not worse by default. Ah, I love all those nifty ways people work with the limitations of the Speccy and create beautiful graphics!

Thanks for the info on software sprites, this helps a lot understanding them better!
Ralf wrote:
Tue Jun 11, 2019 9:22 am
Sylvester the Lumberjack (Atari Lynx)
You could really try to do a Spectrum clone of Lumberjack game. If would be easy enough and if I recall correctly you said you have some artistic skills so nice graphics would help a lot.

Let me explain more about this Lumberjack thing if someone missed it. It all began a few years ago with indie game for modern computers coming form Poland, my home country (that's why I rememeber about it ;) )

So there is an extremely simple game about Lumberjack chopping a tree. But some people say it's very playable, at least for a short time ;)
It got quite a lot of clones on retro systems.

It would be nice to have it on Spectrum as well.
I really loved the idea of that game, that's why I wanted to borrow the idea and make a version of my own for the Lynx. Nintendo's Game & Watch games were the first video games I ever played as a kid (a few friends had them), and I loved them immediately :D Simple and frantic games like that can be very fun. I think many people our age go full circle with games and start enjoying more simple games again on "retro" machines. Vectrex Roli puts it in a very funny way here in this video (about 10:35 - 12:00)


Btw. Amiga version obviously gets bonus points for having Monty Python's lumberjack song as background music. :mrgreen:

This Timberman Game & Watch video made me giggle as well:


I've considered porting the Lumberjack game to other systems, but I think I want to do something new, because at first I did a prototype of it on Pico-8, then I took it pretty far on the Gamebuino Meta until I realized (once again) that I can't get proper enjoyment unless I create games for REAL old school systems, so then I started it a third time for the Lynx and finished it. So I've almost done it three times already :D I suppose quite a lot of the C code would be re-usable on the Speccy with Z88DK. I need to think about it some more, because starting out really small would indeed probably be a good idea.
0 x

Joefish
Manic Miner
Posts: 465
Joined: Tue Nov 14, 2017 10:26 am

Re: ZX Spectrum Game Development Noob Questions

Post by Joefish » Wed Jun 12, 2019 11:08 am

One option you can take with character movement and machine code is to define yourself up to 256 UDGs, each with its own colour attribute. Make sure you can draw all your levels and all your sprites from these 256.

Then, your back-buffer for preparing a screen is a 'map' that only needs one byte per character space, to store the UDG that goes there. This lets you redraw a changing or scrolling background into the buffer very fast. The buffer can also be bigger than the screen you want to show, so things like 3x3 or 4x4 tiles can be drawn 'over-the-edge' of the screen display. Then you add your sprites as more UDGs (again, just one byte per character space). Then what you need is a fast renderer that can re-draw the real screen quickly from this UDG 'map'.

There are several optimisations you can make to speed things up:
(1) Store the UDGs starting at a memory address divisible by 256. And store the first byte of all 256 UDGs first, then the second, then the third...etc. to the eighth byte, then 256 attribute bytes. To access a UDG, set the high byte of a memory address to where they start, then put the UDG number in the low byte. That tells you where the UDG starts. To get the next byte of the UDG, in machine code, you can INC the high-byte of the memory address (instead of the low byte) to skip forward 256 bytes.
(2) Have UDG #0 as your empty background, and set its INK and PAPER the same. Then your renderer knows for character 0 it only has to copy the attribute to the screen, not any pixel data. You could have, for example, the first 8 UDGs simply have the same colour INK as they do PAPER, and program the renderer to only copy their attributes, not pixels - for a range of colours.

For semi-transparent sprites (i.e. they let the PAPER colour of the background through in places) your map needs to store 2 bytes per character cell; one for the UDG and one for the attribute. You might want to store 10 bytes of data to define each UDG - 8 bytes for pixel data, one byte for an 'AND-mask' of which background attribute bits to let through and a second 'OR-byte' (or 'XOR' byte) of which attribute bits to forcibly set in the combined attribute of sprite and background. Then when you draw a sprite, whichever background colour is already set for that character cell, your sprite UDG replaces it for pixel data, but combines the previous PAPER colour with its own INK.
1 x

User avatar
djnzx48
Manic Miner
Posts: 433
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: ZX Spectrum Game Development Noob Questions

Post by djnzx48 » Thu Jun 13, 2019 5:59 am

There's an interesting approach described here, using compiled 8x8 tile routines to quickly scroll the screen. I made a small demo based on that concept and it works quite nicely, but I only managed as far as a static screen display.
0 x

User avatar
Mozartkügel
Berk
Posts: 18
Joined: Fri Jun 07, 2019 7:19 am
Location: Finland

Re: ZX Spectrum Game Development Noob Questions

Post by Mozartkügel » Thu Jun 13, 2019 6:22 am

@Joefish This is beyond my programming capabilities (at least yet ;) ) but very informative and interesting stuff nevertheless! I can understand it theoretically, but I wouldn't be able to translate it into code. I'll need to start out simpler. Anyway, I'm sure there's others who will benefit from this knowledge you shared too.

@djnzx48 Thanks for linking to that approach too!
0 x

majikeyric
Berk
Posts: 5
Joined: Fri Mar 02, 2018 7:28 pm

Re: ZX Spectrum Game Development Noob Questions

Post by majikeyric » Thu Jun 13, 2019 2:26 pm

Hey great choice with lumberjack C64, I'm the coder of the game :D

Mozartkügel : I had started a VIC20 version aswell ;)
1 x

User avatar
Mozartkügel
Berk
Posts: 18
Joined: Fri Jun 07, 2019 7:19 am
Location: Finland

Re: ZX Spectrum Game Development Noob Questions

Post by Mozartkügel » Fri Jun 14, 2019 6:46 am

Hi @majikeyric! I didn't know that, nice! :D (Obviously I remember you from the different Commodore forums). Did you leave the Vic-20 version behind completely or in "hibernation"?
0 x

majikeyric
Berk
Posts: 5
Joined: Fri Mar 02, 2018 7:28 pm

Re: ZX Spectrum Game Development Noob Questions

Post by majikeyric » Fri Jun 14, 2019 7:54 am

Mozartkügel wrote:
Fri Jun 14, 2019 6:46 am
Did you leave the Vic-20 version behind completely or in "hibernation"?
Arf, I think it is completely behind now.... :)
1 x

Post Reply