Great work! Love that you've combined JS/React with C64 dev - as a JS dev interested in learning C64 assembly I'd love to do something similar
The last piece of critical timing sensitive code that I need to get into place before I can begin on other things, is the sprite multiplexer. I don't need an extreme amount of sprites as I'll be using characters for player and enemy bullets. I'll just need enough to display Doc, a few enemies at a time, pickups such as lives or keys, and the doors (although these may end up also being characters too). Doc is going to require at most two sprites so I've decided to not multiplex sprite 0 and 1 so as to avoid the player ever flickering should the sprite load become too much (hopefully this will never happen) and this also ensures Doc is at the top of the sprite list so will appear in front of all other sprites. The remaining 6 hardware sprites will be multiplexed to create a total of at least 18 sprites, this should be plenty for my needs.
Actually implementing the multiplexer was simple as I had already created a dynamic IRQ system which allows me to sort a dynamic list of raster splits. So I just add the multiplex sprites to this list and they will be automatically sorted by the system, this actually makes the code pretty efficient compared to my previous multiplexers. The results at this stage look good, the scroller and timeline effect still function flawlessly with 16 moving multiplexed sprites and Doc on screen.
With the game engine looking solid and most of the timing sensitive code written. I decided to take a break and start looking at my map editor. The original map editor for the first game was written pretty quickly (about 2 weeks) in Electron/React and was just about fit for purpose. By this I mean it was buggy and slow but did allow me to quickly create the map for Doc Cosmos. The reason I wanted to make my own editor rather than use an existing map editor was that I wanted the ability to quickly switch between the map fonts for the old and new timeline, export all the relevant font, tile and map files in one click, and I also found that creating flick screen games a little cumbersome in other tools and so the original editor was designed to make these things much easier to do.
The editor also had a nice ability to export the entire map as an image, which is a nice thing to have when testing. It's also a nice thing to have while playing normally and so I've included them at the end of this blog post.
The problem with this editor however is its only really fit for that one purpose; creating a flick screen game with 2x2 tiles. For the sequel I'm going to need something that's able to handle a large 128x64 scrolling map and 4x4 tiles. While I could have just hacked this editor to make it work, I decided instead to rewrite it. Mostly because the performance of the original editor on anything but a high spec machine was abysmal.
So for the new editor I've been looking at Haxe, HaxeUI and Openfl. This combination of tools allows me to write all the same functionality I had in my original editor, but with the bonus of having it compile natively to multiple platforms. This means that I can use the map editor on my Mac at work and not suffer terrible perfomance drops (I use a Windows 10 machine at home), I can port it easily to a web application should I need to and can even easily release it as an iOS or Android app. So far progress has been slow as I learn the intricacies of the quite poorly documented HaxeUI system, however the performance so far is 100s of times better. Maybe sometime in the future I'll release the editor here on itch.io for the community to use. The following are some of the features I'm hoping to implement:
- MC and Hires font editing
- Switching between multiple fonts instantly
- Tile and map editing with large scrolling map
- Enemy sprite placement and configuration
- Enemy active tree generation (a way to reduce the number of enemy updates that need checking per frame)
- Trigger area placement and configuration including dialog#
- Font character animations and parallax
- Raster colour splits for BG, MC1 and MC2
This will be an ongoing editor that I expect to evolve quite considerably over the course of the project. Hopefully soon I will be able to use it to create the first maps and will share some screenshots at that time.
Anyway back to the code I go. Here's the maps for Doc Cosmos 1 as promised (right click and open in new tab or save to view them at full resolution). Enjoy!