Hi Everyone, another little update.
Things have been going slow but I have definitely made some great progress...
GRAPHICS
Re-wrote the graphics renderer (again). I think this will be the final version of the polygon renderer. It still doesn't use the VERA FX line helper, but I've run out of energy thinking about drawing polygons lol... The final version uses a combination of bresenham to calculate edges, and fast 32-bit cache writes for filling the polygons. It's working 95% correct now. The only other graphics I haven't implemented yet is "screen shaking" and scrolling. You can see on screenshots below the other glitch is some polygons going beyond the bounds of the screen. These don't affect gameplay. Theres still room for more optimisation.
INPUT
The game now has input controls! Took me a little bit of head scratching to work out how to detect multiple keys etc. I ended up using the PS2 keyboard input CX16 kernel routines rather than the usual C64 GETIN, it works pretty good. I have bolted on a few extra interrupt routines. I'll also add joystick/gamepad too which I don't expect to be too difficult now that I have the framework there. Different versions of the game seem to have different input controls (eg the Sega Megadrive version uses 2 buttons), but I'm going to stick with the original I think - one button action and "up" for jump.
![250202-update.gif](./download/file.php?id=4130&sid=5601025da02d64c137a8651b542567b3)
- 250202-update.gif (11.08 MiB) Viewed 4918 times
AUDIO
I scrapped my old sound routine and started writing the new "mixed" 4 channel sound (ie 4 channels into 1 - see earlier posts). I'll probably shift my attention back to it now.
CURRENT ISSUES
1. The game is much slower than I anticipated. It turns out I overestimated how much time I have between vsyncs, so a lot of frames don't finish in time. I need to study it a bit more to understand it better. The more I optimise the better it gets, but some frames take longer than an entire vsync. I've done some cycle counting and each frame on average takes anywhere between 200,000 cycles to 600,000 cycles. Timing is something I struggle to wrap my head around when you include frame buffers, page flipping and page copying etc. I'll get there eventually. You'll see also there's timing issues in the gameplay example above, I was running the entire time but he still caught me (either that or I'm really bad at the game lol).
2. I've refactored heaps of code as I get better at 65c02 assembly. I've learned a few really good tricks using lookup tables and self-modifying code which have made things a lot better, but there's still bugs to be found...
3. ... one such bug I thought previously was with my zoom routine, but it turns out it's something else. I did fix my zoom - it uses fixed point 11.6 maths but I was having overflow issues because I was using 16 bits instead of 17. I've since clamped zoom to a max, and now it seems to work nicely.
4. But that still leaves an issue where residual images seem to be shown on previous frames (refer to animation in earlier posts where Lester seems to zoom in and out frequently). It also happens in other areas of the game. I thought it was the task scheduler (the game uses mutitasking), but I've poured over it and can't find a problem. Now I'm thinking it might be a logic test somewhere.
That's about it for now! We're getting close, I still want to have it unpack the data builtin, at the moment I'm using an external unpacker I wrote in python. That way people can just drop their game files in and play immediately.
Fun Fact: The game levels are little isolated games in themselves, so you can skip to any level without finishing the previous level, using code. So if I set the first level to be the end of the game I get this:
![250202-update-2.gif](./download/file.php?id=4131&sid=5601025da02d64c137a8651b542567b3)
- 250202-update-2.gif (4.4 MiB) Viewed 4918 times
Oh and
BONUS here's what it looks like using box16:
![GIF 2-02-2025 9-17-58 PM.gif](./download/file.php?id=4132&sid=5601025da02d64c137a8651b542567b3)
- GIF 2-02-2025 9-17-58 PM.gif (1.31 MiB) Viewed 4918 times