Ready, Aim, Fire!

 Real life has been super busy and complicated lately, but I found some time to hammer out and get the ranged combat system fully functional.

The big addition was adding sprite movement to the FX engine. I wrote up a small model in Extended BASIC to test moving one point to another, and implemented that in assembly code. Unfortunately, I found out my design was flawed… steep angles weren’t lining up right. I had to go back and implement Bresenham’s algorithm closer to the standard to get it right.

A complicated bit of code was calculating the correct pattern to use for ranged missiles. There’s basically five types:

  1. No direction, just single pattern
  2. 8 direction pattern, cardinals and diagonals
  3. 4 direction pattern, cardinals
  4. 4 direction but either left/right or up/down only, cardinals
  5. 8 direction but either up/down, left/right/, NW/SE, NE/SW

The code to determine what pattern to use based on the slope to the target was tricky to figure out, but it turned out to only require a single data array and some clever bit-masking for the different types. It’s by no means PERFECT, but it’s good enough for the effect.

I found a host of small bugs on the way, many on the design side. I had implemented a lot of the work at different periods, and what the code was doing and what the data was set to was in places two different things. For example, I had in my spreadsheets that a set color of 0 meant to rotate through all colors, but this wasn’t done in the actual animation code.

So, now that ranged combat is finished, I can move on to spells. I just finished re-writing my spreadsheets of spells and types to accommodate the changes to the combat system. Now I can do the work of implementing it in code. Unlike ranged combat, spells also can affect multiple targets. The affected unit determination code is written and in use for single targets, but how it will work with multiple remains to be seen…

Ranged Combat (Video)

After spells comes monster A.I. I was doodling up some ideas here today on paper, and have a good idea of what I want to do here. Testing it will be a pain, though, since much of the action will be determined behind the scenes. I may have to model it in Extended BASIC as well…

This entry was posted in Coding, CRPG, Screenshots, Video. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *