It's been really long since I wrote my last article. And now that we are living this so-called "new normal", I'm dedicating more time for other activities than watching tv or playing games. So, I started to remember good things from my past, and one of them drove me to the 80's: my old Speccy. When my passion for game development officially started.
Ok, so I was reading books about the golden era of videogames, watching related videos, reading posts regarding the ZX Spectrum Next (and the Z80 architecture, in general), and playing new creations for the Speccy when I thought "hummm ... how hard would it nowadays be to develop a game for the Speccy? Is there any cool dev stack that help me avoid feeling that I'm going back to the stone age?"
At this point you may be saying "what?!", but let's face it, game development has evolved a lot since those days where tools weren't handy at all for mere mortals and debugging was a real pain in the back. Plus, I would bet that many of us got accustomed to comfort. Maybe too much sometimes, but hey, it is what it is.
Now, by the time I was doing my discovery process to build a stack that suits my needs I happened to find a few tools that caught my attention so much that I felt motivated to write an article about them, in an attempt to also get distanced for a brief moment from game development for modern platforms and bring some "retro" vibe to these pages.
Enough chit chat. Let's get into it ...
(I) LANGUAGE & COMPILER
Before installing any compiler and related tools I searched for languages other than both, the original basic and assembly. My goal was twofold: (a) to write the general parts of the game with such language, and (b) left critical code for assembly.
And this is when I came across interesting projects like ELENA, a language based on C#, which looks promising but there have been no posts about from the author for more than a year. And of course, there is C, but as I will mention in the next section I wanted full integration with VS.
And then enters BORIEL ZX BASIC! This is a compiler written in python, available for major platforms (Windows, Linux and MacOSX), that translates an extended version of Basic into Z80 assembly code. Why extended? Because his author, José Rodriguez (@boriel), has based on the syntax of FreeBasic to introduce features of structured languages into it, like functions, subroutines and labels. And also, he has provided a set of functions and subroutines as well as new data types and of course, tutorials.
But this is not it, at all. There is one key feature that I still have to mention: ZX Basic allows to inline assembly instructions!!! This is a killing feature for me and here's a link to an example of it.
This one became a challenge for me. The reason? I use Visual Studio (for games with Unreal, for games with Unity, for games with everything really). I know that for many using VS could be an overkill and a blocker, but being accustomed to long sessions of compilation this would present no issues, so it's quite a natural step for me.
At first, I started with z88dk, and then I looked for more intuitive tools, and even found solutions for VS Code, but nothing really integrated into VS. Luckily, I found SPECTNETIDE a project in github created by István Novák (@istvannovak). This is an advanced framework that integrates into VS from the get go, with many handy features. It supports all traditional platforms. It allows to work with multiple projects on a single solution. And yes, the debugger ... that amazing debugger that allows to set breakpoints on the instructions while you visually inspect what is being rendered on its integrated emulator!
In addition to that, the framework comes with other tools that allows you to inspect the CPU, the ULA, the memory, the call stack, and even tape files.
The author is really open to suggestions. As a matter of fact, he implemented many of my requests, including the support of Boriel ZX Spectrum! A win-win scenario, if you ask me.
A bit of a downside here is that currently there is no support for the ZX Spectrum Next, but the good news is that such support is part of the roadmap. So I cannot wait for it to happen ...
Lately, the IDE was gaining speed since many new users were active in the project's page with new requests and bug reports. Bravo, István!
Although SpecNetIDE comes with a build-in emulator, it is always useful to have an external emulator in the toolset. And the one I prefer is SPECCY. It's free. It's simple to use. It does the job ok. So, it's enough for me.
Now, there are alternatives. A couple of them are: ZESARUX and CSpect emulator. The former, originally released for Unix-based OS, and now available for other operating systems like Windows. And the later, another well-known and very popular multi-platform emulator. Both, imvho, fine alternatives.
But, to my surprise, there is a third emulator: Spec256. It allows to use 256 colors with no clash. Being picky here for a moment, it's an emulator for a hypothetical Speccy, not a real one, since it emulates a Z80 architecture with 64-bit registers along with a 64-bit memory map (instead of 8). A very interesting alternative but unfortunately it requires modifying the original games to get these outstanding results, so only a few have been adapted.
A real-world alternative would be to replace Speccy's ULA with ULAplus, which allows for example, using 64-colour mode, organized as a lookup table of 4 palettes of 16 colors, which is quite impressive. But again, the ZX Spectrum Next has been released, right? An many would prefer to keep their Speccy machines intact, for nostalgic purposes. But, the option is there. Your call ...
Now, regarding artwork, there are many tools out there that allows to create pixel art (free and commercial), but the problem is that none of them support exporting produced graphics in the format expected by the Speccy -at least, afaik, and I found no plugins or addons that provide such feature. Fortunately, we can find some options to cover this need.
One of them is SevenuP, a simple editor that does the job since it supports the palette of colors and exports data as expected.
Another option is Multipaint, an editor with more features than SevenuP, which also includes support for ULAplus.
Both are really handy editors, and despite differences in the GUI, results can get really close if you are skilled with pixel art, so at the end, whether you pick one graphic editor or the other may reduce reasons to a matter of taste.
Before ending this article, there is also other cool sites I'd like to mention.
The first one that comes to my mind is archive.org, also known as "The Internet Archive". This site has been backing up in digital form, sites and other artifacts, and yes, ... including videogames. Why do I mention it here? Because it has a section devoted to Sinclair Spectrum's titles, and despite the fact that not all of them are currently included (where's Narco Police?!), for the ones available, you can play them online since they have embedded M.A.M.E!!!
Finally, there are blogs that may can help you to take your first steps and also move into more advanced areas, for example Adventures in ZX Spectrum Dev, a thread which is devoted to the original Speccy (as opposed to the one dedicated to the Next) with lots of interesting information and also links to useful videos in Youtube.
(V) SUMMING UP
To wrap it up, my current stack to develop games for the ZX Spectrum is:
1. Boriel ZX Basic + Z80 Assembly
2. SpectNetIDE (for Visual Studio)
3. Speccy Emulator
I hope you enjoy this post. As usual your comments are welcome and, if anyone is currently writing games for the Speccy (or for any other Z80-based platform like Amstrad, MSX, etc.), what's your dev stack?