ZX Spectrum Game Development Noob Questions

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Mozartkügel
Berk
Posts: 25
Joined: Fri Jun 07, 2019 7:19 am
Location: Finland

Re: ZX Spectrum Game Development Noob Questions

Post by Mozartkügel » Sat Jun 08, 2019 11:33 pm

Once more, many, many thanks to everyone for all the tips and info! What an uplifting welcome to the Speccy scene! :D I've been checking out a lot of ZX Spectrum homebrew game-videos the last couple of days, and I must say what fantastic, fun & beautiful games there seem to be popping up for it!

Wow, thanks for the extensive info about the different AGD versions Alessandro! I was thinking about using C first, but AGD really gets me excited. I'd need to play around with it some and see how it feels. I'm thinking about MPAGD because of the convenience being able to use a mouse / gui, but there's certainly a charm running AGDx natively (even on an emulator). I think I'll start with doing some pixel art while letting all the thoughts and info settle in.
Alessandro wrote:
Fri Jun 07, 2019 8:34 am
My games, for instance, usually have beeper sound effects and AY background music.
That sounds like a great idea! Do the newer speccys still have the beeper although they have the AY?
Ralf wrote:
Fri Jun 07, 2019 11:31 am
Also people using tools for game making sometimes make their games very similar to other existing ones. I guess it's the problem of starting from the same tutorial example ;)
I'm trying to think of how to not make myself guilty of this. As an artsy-fartsy type I many times appreciate the graphics/pixel art and the music the most In games. I do love some C programming too although I'm not that great at it, however I have to force myself to try and be interested in game design and level design :D I kinda like "generic platformers", haha.
Alessandro wrote:
Fri Jun 07, 2019 2:12 pm

Data compression will be extremely useful if you plan to take advantage of the 128K and later models' extra RAM. Keep in mind that AGD and its derivates are meant to create stand-alone titles that can run on a 48K, but you can author a multi-level game by creating each level as a single distinct game. Most of the times I employed ZX7, a very good and versatile tool made by Einar Saukas. Sometimes I also used Exomizer, which yields slightly higher compression ratios but it's not as fast or flexible as ZX7.

As for tape management, you can, at least for the beginning, stay with the Spectrum ROM loading routines. Custom loaders add extra flair and are useful for people who like to load their games on physical hardware, even from their PCs, but they are not necessary nowadays. That said, I went as far as creating a turbo custom loader myself.
Thanks for all the tips! Data compression is still a very "advanced topic" for me. I have to take things one step at a time I think. I've done some small games and C programming for 8-bit systems over the years, and even more than before lately, but I've avoided compression so far :D A loader with a loading screen would definitaly be on the list for my game, but let's see how far in the future that still is with too many 'retrodev' projects started from before, a day job, small kids etc.

I don't know yet how many "user defined characters" / "blocks" and sprites you can have in AGD or on a spectrum (yet), but when I look at your games there seems to be a lot of graphics already in the intro picture, intro menu and then the game itself. Are all those parts "separate games" and new graphics are loaded into ram inbetween? Or perhaps the intro screen and the intro menu is one "game", and then as you said, subsequent levels are also loaded as separate games?

Btw. I thought I saw someone write somewhere that there would be some AY music collection that you can use for your games? Has someone heard of something like that?
0 x

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

Re: ZX Spectrum Game Development Noob Questions

Post by djnzx48 » Sun Jun 09, 2019 4:59 am

The 128K models technically don't have a physical beeper, as the design was modified to output sound through the TV speaker. But the beeper is still available on the standard port along with the new AY chip.

You can check out https://zxart.ee/eng/music/ for a large music collection. Or you could find someone willing to write something for you - if you wanted music for a game I could try making a track or two.
1 x

User avatar
Alessandro
Manic Miner
Posts: 387
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: ZX Spectrum Game Development Noob Questions

Post by Alessandro » Sun Jun 09, 2019 8:38 am

Mozartkügel wrote:
Sat Jun 08, 2019 11:33 pm
I don't know yet how many "user defined characters" / "blocks" and sprites you can have in AGD or on a spectrum (yet), but when I look at your games there seems to be a lot of graphics already in the intro picture, intro menu and then the game itself. Are all those parts "separate games" and new graphics are loaded into ram inbetween? Or perhaps the intro screen and the intro menu is one "game", and then as you said, subsequent levels are also loaded as separate games?
Hi, it's pretty much the second thing you wrote. More precisely:
  • the loading screen is loaded separately from tape;
  • the intro screen, key redefinition routine, level management, high score table etc. are all parts of a program specifically written from scratch in Z80 Assembly. In my first attempts I coded the "housekeeping" program in compiled BASIC but then I developed a sort of template in Assembly, much more efficient in terms of speed and RAM usage;
  • levels are stored in the Spectrum (128K and later) RAM banks as "games" authored with AGD and compressed with ZX7 in order to fit into each RAM bank, which can hold up to 16 Kb of data.
However, these are advanced techniques; to this day, as far as I know the only ones who employed AGD to make multi-level games are me and Alexei Kashkarov (kas29). I'd suggest you for the time being to create a simple game that can run on a 48K model just to "learn the ropes". We do it to amuse ourselves and other folks who share our pleasure in retrogaming, so there is no hurry to do everything at once. Heck, the very first game I created was a Manic Miner clone - hardly something that had not been done before :mrgreen:

Finally, AGD allows you to place a maximum of 12 sprites per screen at once. You can define a maximum of 254 low resolution blocks, which can hold different properties - solid blocks, platform blocks, empty (i.e. background) blocks etc. There is no limit at the quantity of different blocks that you can place on each screen instead.

One more suggestion: music can be composed with the beeper as well, but due to the limitations of the Spectrum architecture, it cannot be played while playing but only in menus/intros/outros etc. That is, unless you wish your in-game music to sound like it was played on a muted xylophone :lol: like in Manic Miner, Jet Set Willy or Brian Bloodaxe. For the first purpose, there is a great tracker-like utility called Beepola which re-creates various beeper music engines (here you can find a patched version which corrects a bug in the original). Whether you like them or not is a matter of taste ;) I employed it to compose the intro/outro and menu tunes for my game Cousin Horace - which being designed for the 48K loads in separate parts.
0 x

Ralf
Dynamite Dan
Posts: 1161
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: ZX Spectrum Game Development Noob Questions

Post by Ralf » Sun Jun 09, 2019 10:14 am

Btw. I thought I saw someone write somewhere that there would be some AY music collection that you can use for your games? Has someone heard of something like that?
As people said there is https://zxart.ee/eng/music/
Or you can also check https://bulba.untergrund.net/music_e.htm

The good tool for working with them is Vortex Tracker. These songs are stored in files like .ay or .pt3 and you need to convert them
to binary or Spectrum tape image so they can be used in a Spectrum program

You'll soon discover that most of these tunes come from Russia and neighbour countries. It's actually not a surprise,
they had and still have a very active demoscene where a lot of music was made just for fun or to be played at the demoparty.

Personally I used some of them in my own games. I'd have an advice - don't expect that you check out 3 tunes and find a proper one
for your game. You'll probably need to search through over 100 of them as most of them are decent but nothing special and very generic.
So finding something standing out of the crowd requires some effort.

You probably should also consider copyright issues. Personally I didn't try to contact the authors (it could be hard in many cases) but always
included the info about them in the final game. I believe it's an honest approach and it worked for me but I'm generally easygoing
about copyrights as I said in many another threads ;)
0 x

User avatar
Alessandro
Manic Miner
Posts: 387
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: ZX Spectrum Game Development Noob Questions

Post by Alessandro » Sun Jun 09, 2019 11:45 am

I would only add to what Ralf wrote above that the best solution is always to compose your own tunes for the game. Even if your knowledge of music is rudimentary - as it is my case by the way - it is much more satisfying, suits your needs according to the atmosphere you want to give to your game, and you do not have to ask permissions to anyone.

I'd also like to add that about 3 out of 4 AY tracks you are likely to find in repositories are pseudo-techno stuff which makes my ears bleed after a few minutes. Of course, your mileage may vary :lol:
0 x

User avatar
R-Tape
Site Admin
Posts: 2229
Joined: Thu Nov 09, 2017 11:46 am

Re: ZX Spectrum Game Development Noob Questions

Post by R-Tape » Sun Jun 09, 2019 9:10 pm

djnzx48 wrote:
Sun Jun 09, 2019 4:59 am
Or you could find someone willing to write something for you - if you wanted music for a game I could try making a track or two.
@Mozartkügel: BITE. HIS. HAND. OFF. :mrgreen:
1 x

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

Re: ZX Spectrum Game Development Noob Questions

Post by djnzx48 » Mon Jun 10, 2019 4:19 am

Ouch, that hurt!!
0 x

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

Re: ZX Spectrum Game Development Noob Questions

Post by Mozartkügel » Tue Jun 11, 2019 7:06 am

djnzx48 wrote:
Sun Jun 09, 2019 4:59 am
The 128K models technically don't have a physical beeper, as the design was modified to output sound through the TV speaker. But the beeper is still available on the standard port along with the new AY chip.
Ahaa, thanks!
djnzx48 wrote:
Sun Jun 09, 2019 4:59 am
You can check out https://zxart.ee/eng/music/ for a large music collection. Or you could find someone willing to write something for you - if you wanted music for a game I could try making a track or two.
Thanks for the link! How kind of you to offer help! Usually I like to do all parts for my games myself, but it's nice to know there's help if I end up in "development hell". :)
Alessandro wrote:
Sun Jun 09, 2019 8:38 am
Hi, it's pretty much the second thing you wrote. More precisely:
  • the loading screen is loaded separately from tape;
  • the intro screen, key redefinition routine, level management, high score table etc. are all parts of a program specifically written from scratch in Z80 Assembly. In my first attempts I coded the "housekeeping" program in compiled BASIC but then I developed a sort of template in Assembly, much more efficient in terms of speed and RAM usage;
  • levels are stored in the Spectrum (128K and later) RAM banks as "games" authored with AGD and compressed with ZX7 in order to fit into each RAM bank, which can hold up to 16 Kb of data.
However, these are advanced techniques; to this day, as far as I know the only ones who employed AGD to make multi-level games are me and Alexei Kashkarov (kas29). I'd suggest you for the time being to create a simple game that can run on a 48K model just to "learn the ropes". We do it to amuse ourselves and other folks who share our pleasure in retrogaming, so there is no hurry to do everything at once. Heck, the very first game I created was a Manic Miner clone - hardly something that had not been done before :mrgreen:
Thanks for the technical info! "Lost in my Spectrum" looks great in my opinion! What else could you ask from a game! (I'm serious haha). Yeah I guess I should start really small, but the housekeeping part and/or compression is still the goal later. I've done a few small games and tests for other machines before so I'm hungry to expand from mini games to "medium-small games" :D the game I'm working on at the moment "Baron Lovejoy Travels in Time" for the C64/Vic-20/Plus4/Lynx is slowly getting to the point of "learn compression and housekeeping or fail" :mrgreen: (On the Lynx I fortunately know how to load in new parts from cartridge).

Here's a two of my latest Lynx minigames if you/someone wants to check them out:

Reiko's Robot Run (Atari Lynx)


Sylvester the Lumberjack (Atari Lynx)


And here's my current work in progress game "Baron Lovejoy Travels in Time" for multiple old systems:

BLJ VIC-20


BLJ C64 2.1


I got this megalomanic idea when I saw a developer called "Misfit" from Finland releasing his game "Rodmän" for several old home computers. Since then I've seen a few similar multi platform projects on the web. It's too much fun getting to understand better how some of the classic systems work and how to create games for them.

I forgot to mention that I looove tape loaders / games on cassette, so preferably a "one load"-game would be the ultimate goal, but I might have to set up things in an easier way to start with. Also I'm hoping to add the ZX Spectrum to the list of "ports" of my game (If I don't start a completely new/separate one for the Speccy). I'm so excited about the Speccy, it's unique graphics, its fantastic homebrew scene and wonderful community. But yeah, I should probably start really small anyway at first with a new system.

Actually I noticed yesterday that Manic Pietro is open source and written in C, so that had me starting to reconsider doing my first Spectrum game in C after all, hmm...

Yeah I agree that there can't be a hurry. After a long day after putting the kids to sleep I have to borrow time from sleep to work on my "retro projects of passion" for a little while, so I've put up a five to ten years time budget for "Baron Lovejoy". :mrgreen:
Alessandro wrote:
Sun Jun 09, 2019 8:38 am
Finally, AGD allows you to place a maximum of 12 sprites per screen at once. You can define a maximum of 254 low resolution blocks, which can hold different properties - solid blocks, platform blocks, empty (i.e. background) blocks etc. There is no limit at the quantity of different blocks that you can place on each screen instead.
Thanks! I wonder what the sprite size is in AGD? The sprites in your games looked big and nice!

I started wondering about software sprites too. In AGD that seems to be taken care of for you, but if I'd code in C that would be another story. I wouldn't mind having the sprites moving one "cell" / 8 pixels at a time and not being transparent in my first game. Then I could be moving on to more advanced software sprites in a later game. However I haven't yet seen any new homebrew game that doesn't do pixel movement and "transparency", so the standards are already set high on the speccy scene! :D

Does software sprites work about like this simplified: you check where your sprite is -> then copy the data of the background "cells" of that position -> then paste the sprite data (and color data) on top of the bakground data and draw the combined stuff to screen?
Ralf wrote:
Sun Jun 09, 2019 10:14 am
Btw. I thought I saw someone write somewhere that there would be some AY music collection that you can use for your games? Has someone heard of something like that?
As people said there is https://zxart.ee/eng/music/
Or you can also check https://bulba.untergrund.net/music_e.htm

Personally I used some of them in my own games. I'd have an advice - don't expect that you check out 3 tunes and find a proper one
for your game. You'll probably need to search through over 100 of them as most of them are decent but nothing special and very generic.
So finding something standing out of the crowd requires some effort.

You probably should also consider copyright issues. Personally I didn't try to contact the authors (it could be hard in many cases) but always
included the info about them in the final game. I believe it's an honest approach and it worked for me but I'm generally easygoing
about copyrights as I said in many another threads ;)
Thanks for all the info Ralf! Yes, the copyright was actually what I was thinking of. I was wondering if it was some sort of database where copmposers knowingly would have put their stuff for use. I guess giving credit and/or trying to contact would be OK in most cases since the database is massive.
Alessandro wrote:
Sun Jun 09, 2019 11:45 am
I would only add to what Ralf wrote above that the best solution is always to compose your own tunes for the game. Even if your knowledge of music is rudimentary - as it is my case by the way - it is much more satisfying, suits your needs according to the atmosphere you want to give to your game, and you do not have to ask permissions to anyone.

I'd also like to add that about 3 out of 4 AY tracks you are likely to find in repositories are pseudo-techno stuff which makes my ears bleed after a few minutes. Of course, your mileage may vary :lol:
Yeah, usually I like to do all parts for my games myself, but it's nice to know there's a backup plan if needed. Haha, I grew up on mostly european games in the 80s, so I expect all games to have 80s / early 90s "electronic pop music" no matter what the game is about or what would really be fitting ;D
1 x

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

Re: ZX Spectrum Game Development Noob Questions

Post by djnzx48 » Tue Jun 11, 2019 8:51 am

Mozartkügel wrote:
Tue Jun 11, 2019 7:06 am
I started wondering about software sprites too. In AGD that seems to be taken care of for you, but if I'd code in C that would be another story. I wouldn't mind having the sprites moving one "cell" / 8 pixels at a time and not being transparent in my first game. Then I could be moving on to more advanced software sprites in a later game. However I haven't yet seen any new homebrew game that doesn't do pixel movement and "transparency", so the standards are already set high on the speccy scene! :D
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.
Mozartkügel wrote:
Tue Jun 11, 2019 7:06 am
Does software sprites work about like this simplified: you check where your sprite is -> then copy the data of the background "cells" of that position -> then paste the sprite data (and color data) on top of the bakground data and draw the combined stuff to screen?
The main decision to make with sprites is whether you'll draw them directly to the screen, or first draw them to a buffer (to avoid flicker) and then copy that to the screen. If you use a buffer, you don't have to copy the whole thing to the screen every frame, but only the parts that change. With the 128K machines you also have support for native hardware double buffering, so you can sync your graphics to the 50Hz display without the need for expensive copying.

For masked sprites, a common technique is to save the background area where the sprite needs to go into a buffer, and then draw the sprite onto the screen. (These operations could be combined into one step.) Then to erase the sprite, you copy the background back.

Many games also use XORed sprites, which are a lot simpler. After using XOR to draw a sprite, XORing it back in the exact same place will erase it, eliminating the need for separate buffers. The downside is that simple backgrounds are required, and they don't look so good when one sprite overlaps another.

When using coloured sprites, you also need to decide how the sprite colours will interact with the background. Many games will have the main sprite assume the colour of whatever background element is behind it. However, you can also choose to display the main sprite with its own colour, resulting in a coloured mask that follows the character around. The Wally games are a good example of this.
1 x

Ralf
Dynamite Dan
Posts: 1161
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: ZX Spectrum Game Development Noob Questions

Post by Ralf » 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.

Examples for C64 and Amiga:


1 x

Post Reply