Briley Witch RPG Diary – 13/10/2017

I’ve been busy coding an RPG to run on the Commodore 64, an old 8-bit computer I used to program. I’ve written a few blog posts, but I thought diary format might be interesting, so here’s the first! (okay, so it’s more a progress so far…) Please excuse my ramblings in places… Oh, let’s just get on with it!

Recently I’ve been creating a load of new sprites for the game, and-

Okay, I’ll admit, I’ve been procrastinating. I’m not an artist, but I’ve done the best I can, and I’m quite pleased with my efforts.

I like to be organised (although my memory map seems to keep changing for various reasons), so I’ve worked out what RAM I can use for graphics. The C64 uses a VRAM bank of 16k. I use 2x1k for my flip screens, 2k for the charset (split between 160 for each background, 96 for the font, window borders, plus other shared chars), leaving the remaining VRAM for sprites. Each sprite is 24×21 pixels, using 64 bytes each. So I have 12k for sprites, which gives me 192 sprites. Currently, I’m using 32 for combat weapons and spells, 32 for combat character animations, and 30 for creatures. In combat, each creature uses 6 sprites, so that gives me 5 creatures in memory at a time. Hopefully this will be enough. Creature sprites can be loaded per map area, so I should be able to add lots of variety.

That leaves me 96 sprites to use on Briley and Smokey, and the major party characters; the remainder of the 96 are used for each graphics set. At the moment I have just a village graphics set, but there will be underground sections, towns, other villages, special sites, an ancient citadel, and others…

So far I’ve created sprites for 7 creatures: rat, bat, spider, wasp, snake, boar, and a buzzard. I still want to add loads more, so I’ll do them when I find the time. I’ve also created some sprites for all the male characters in the game, enough to allow me to start creating more cutscenes!

I use SJASM, my assembler/build system to help me. SJASM has the ability to assemble all the code in one go, spitting out the cutscenes as code overlay files. This has many advantages, the main one being the ability for each overlay to call directly any subroutine in the main game, as well as access any variable. In the past I’ve used jump tables to link blocks of code together, but my present system is much nicer!

One reason for procrastinating on graphics was trying to decide colours. C64 can either use a single colour for sprites (24×21), or use multi-colour mode (12×21) where bits are paired up to give 4 colours. Multi-coloured pixels are twice as big as hires pixels.

Sprite colours are: 0 – transparent, 1 – multi-colour #1, 2 – multi-colour #2, 3 – sprite colour. Each sprite has its own colour, but the two multi-colours are shared by all sprites, so deciding what colours to use was quite a headache. I’ve settled upon using black and orange; black for outlines, and orange to be used as a flesh colour. Orange is great as it can be used with brown for wooden objects.

For people, I can use the sprite colour to change clothing. The one limit I’m having to impose is to make every character have black hair. With the severe colour limits, I don’t see a better way to do everything. So, I’ll have to live with it, even if it doesn’t match my novels. I’m sure I’ll be forgiven…

Having some sprites created means I can work on some cutscenes. I’m reserving a 2k buffer to load a cutscene. In my game, a cutscene is a byte stream of commands, plus any code/text required. Commands are actions like opening a text window, displaying text, changing hardware registers to place sprites, plus a few other special effects like screen wipes and triggering sprite animations. Adding text to the cutscene data takes the pressure off my tokenised text system; I had reserved 12k for all text, but soon realised this was nowhere near enough. So now I just need 4k for generic text, the rest being loaded with a cutscene.

Now, cutscenes need lots of text, right? Well, I’ve written and self-published 10 Briley Witch novels, so I can use them for my dialogue.

One such cutscene is Briley’s arrival in the new world she finds herself. To start with, I grabbed the text from book 1, built the cutscene file, and examined the file length. Well, it was 6k! Okay, so it wasn’t going to fit into my 2k buffer! Time for plan B. I managed to trim the text a little, then it occurred to me I can load the cutscene in two parts! With a more serious text trim, I managed to get the two parts a little under 2k each. Perfect. There’s still a bit more work to be done, but it’s now looking rather good.

Oh, I can also add sprites for cutscenes! Let me explain… Although the cutscene buffer is only 2k, after a memory map rearrange, I’ve located the cutscene buffer memory just before the main data load buffer. Result: it can load a 2.5k file, then copy the sprites into VRAM. This will free up some sprites from the main sprite set and mean I can add special cutscene sprites when I need them. At first I’ll try using a maximum of 8 sprites (0.5k) per cutscene loaded at end of the creatures sprite area, so we’ll see how that goes…

So my next step is to code the cutscene sprite system. Should be easy…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s