My week in game dev (2nd June)


Phew, it's been a tough week! Or rather, two weeks, but who's counting?

As you will recall, I am now coding two projects - Wormhole, and the soon-to-be-named Spectrum Next / Amiga / PC project. Firstly, the 8 bit game...

What you couldn't really do very well on the original Spectrum, was scroll a big screen at a decent speed. There just wasn't the CPU power and no hardware tricks to help. So, we're going to scroll properly in this new game because, in theory, the new Spectrum Next can do this stuff. And we want to exploit the new stuff.

First some numbers - stick with me, it's not like school, or doing your taxes...

Firstly, the screen / video memory. Our 8 bit colour, 256x192 pixel screen takes 48Kb of ram, or, 75% of the total memory! Like, huh?

Now, our graphics for the backgrounds. We're using 16x16 tiles, so each is 256 bytes of storage. Stoo (he of Cannon Fodder fame) has drawn a set with 160 individual tiles, which adds up to a grand total of 41Kb. And that's just so far, and only one level design, of many.

In other words, we've blown the machine apart before we've drawn a single pixel.

But of course there is a solution, and its name is bank switching. The Next itself has at least 1Mb of spare banks tacked on the side, so there's almost limitless off grid storage. 1MB total, but only 64Kb 'live'. So, the Next stores its screen memory in 3 banks of 8Kb and the programmer must switch banks in and out depending on which part of the screen needs redrawing. The tiles use the same tech, dividing up into multiple banks of 8Kb - six at the moment.

The coding is tricky as you're constantly switching memory in and out, but it's a way of thinking as much as anything.

Anyway, this whole project rests on me being able to return to Z80 assembly language, mastering the new Next tech, and getting the scrolling working.

Not gonna lie - it was a challenge! On a modern PC game you just redraw the whole screen each game cycle. If the screen is scrolled you simply tell the underlying engine (Love2D in this case) to draw everything offset a little, and no need to worry if you're half on, half off the screen. It's all easy peasy; a few hours work.

The Speccy Next is still too slow to redraw the entire screen each frame, but there's a neat new trick to roll screen up/down and left/right by any number of pixels, then you just redraw the edges where new graphics have scrolled on. You just need to keep track of where the screen memory start actually is, and where the graphics are, etc.

Hard stuff - at least for me. Probably the biggest coding challenge of the last, um, 10 years. Anyway, it works, Here's a demo :)

I'm rather foolishly suggesting that with this done the rest of the project will be a walk in the park by comparison. We'll see. Hardware sprites, next, and then some gameplay.

But what of Wormhole Dungeon? Despite the above, I have been making progress. Some of it just design, in my head. A little breather has been a good thing, I think. 

Early on in the game you happen across this little arcade machine, hidden away. It's actually a fully playable game (you have to pay) and your score carries a meaning. I figured this meaning out, and coded up a high score table for the game to facilitate the new design. I might even do another game as it was such fun to do. Games within games... no wonder this project is taking so long!

A few people have asked me if they can subscribe to a newsletter version of this blog, which isn't a bad idea. I have a substack which I'd forgotten about, but I'm not super keen on the platform. I might open a new one at beehiiv. Let me know if you'd be interested in this...

tony




Comments

Log in with itch.io to leave a comment.

(+1)

Thanks for the update! Looks all promising. And I am looking forward to every Amiga content. :-)


Regarding the newsletter: _I_ would not need it as I get notified via mail by itch.io when you release a new post. But others may want an extra newsletter.

(1 edit) (+1)

Thanks! Both these games should make it to Amiga. Wormhole will be quite a job but the Speccy game should be a breeze - and we'll boost it up to make the most of the machine.

(+1)

Sounds fabulous! Fingers crossed!

(+1)

I’d certainly be interested in seeing how you’re getting on via a dedicated blog especially for the Next and any Amiga activity. 

Cheers, Rob.I'll set the newsletter up this very week

Great Tony. Look forward to it as I’m sure others will too. I hope the Z80 re-baptism is going well!

Thank you - it's really tough but I am getting there!