It's been a while since posting any progress on this project, but I've been working away quietly.
What's nice about Marbles is that because the game is so familiar to me, it let's me spend time experimenting in areas that are typically out of reach.
The bulk of the work I've done over the last few months has been all in assembly. The performance of the logic and maths work in NextBASIC was too slow, so I moved it all into a machine code library that I can call from NextBASIC.
I was able to use the excellent Dezog VS Code extension to debug, step and make the code do what I needed. I even went so far to including a test mode where the generated test .SNA file would load in a 48K emulator and allow me to select blocks (using the keyboard) and clear the grid:
Coding for the web
Having flexed some assembly skills I moved my sights over to the internet connectivity. I had a working solution using NextBASIC but had hit a problem with the driver I was using (either through my own unknown error or a bug in the actual driver it wasn't clear).
Also my previous solution relied on a bespoke socket based server and I really felt like there was legs in this to open it up to other developers wanting to add internet connectivity. … Plus, I'd seen a number of open source projects that did a bit of wifi hacking and I convinced myself it was possible for me to get there.
After an initial fast development and a much slower bug tracking and fixing over a period of a couple of months (mostly late at night), I produced httpbank and project that massively simplifies the process of getting data from a Spectrum Next memory bank to the web and visa versa.
One constraint I hit in the cspect emulator is that it only talks 7-bit over the web, which for the most part is fine, but if you want to send binary it's not fine. Took me a while to realise that bytes were being truncated to 0x3F
when they were too high, i.e. greater than 0x7F
.
So I also added base64 encode and decoding which all happens in 4 bytes of memory. I'm rather pleased with that.
So now that I've built these extra building blocks there's been some fun experiments from other folks and it's let me connect my game pretty quickly to the web.
What's outstanding isn't game logic, it's the parts of that surrounds the game like entering your name for a high score and screens with instructions.
Below is a screenshot showing how the high scores, that automatically are sent and validated through the web, are delivered over the web: