Page 1 of 2

Re: ZX Spectrum Game Development Noob Questions

Posted: Tue Jun 11, 2019 10:46 pm
by R-Tape
Ralf wrote: Tue Jun 11, 2019 10: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!

Re: ZX Spectrum Game Development Noob Questions

Posted: Wed Jun 12, 2019 7:02 am
by Mozartkügel
djnzx48 wrote: Tue Jun 11, 2019 9: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 10: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)
https://youtu.be/0LVAp23opAo?t=635

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:
https://www.youtube.com/watch?v=WFj3HKCTaQM

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.

Re: ZX Spectrum Game Development Noob Questions

Posted: Wed Jun 12, 2019 12:08 pm
by Joefish
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.

Re: ZX Spectrum Game Development Noob Questions

Posted: Thu Jun 13, 2019 6:59 am
by djnzx48
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.

Re: ZX Spectrum Game Development Noob Questions

Posted: Thu Jun 13, 2019 7:22 am
by Mozartkügel
[mention]Joefish[/mention] 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.

[mention]djnzx48[/mention] Thanks for linking to that approach too!

Re: ZX Spectrum Game Development Noob Questions

Posted: Thu Jun 13, 2019 3:26 pm
by majikeyric
Hey great choice with lumberjack C64, I'm the coder of the game :D

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

Re: ZX Spectrum Game Development Noob Questions

Posted: Fri Jun 14, 2019 7:46 am
by Mozartkügel
Hi [mention]majikeyric[/mention]! 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"?

Re: ZX Spectrum Game Development Noob Questions

Posted: Fri Jun 14, 2019 8:54 am
by majikeyric
Mozartkügel wrote: Fri Jun 14, 2019 7:46 am Did you leave the Vic-20 version behind completely or in "hibernation"?
Arf, I think it is completely behind now.... :)