The main problem I encountered was that my trigonometric functions were, well, not working right. I dug around and found a test program I’d written for them and discovered I had fixed the issues there, so I just had to port the code over into the CRPG source.
Experimentation with positions was a bit of work too. I wanted it to be intelligent when placing units. Your top two units are your “front-line” characters, so they should usually be the ones closest to your foes, while the others hang back. So I included a starting angle and two different coordinates for each side of the map. Interestingly enough, the second set of coordinates end up trying to place units off-map, which kicks in the directional placement, that scoots them back in on the back line. Wow, it’s like I designed it that way. 🙂
For ambushes, there’s only one coordinate at the center, and both sets of units are placed around it at a different radius. I haven’t written this code yet, since it requires monster A.I. to make sure that they get the first turn.
Now I’ll move on to the battle’s end, when treasure is determined and clean-up and updates are done prior to returning to travel mode. Eventually this will also involve updating data on disk; I do not want the game to have the same encounters (and treasure) in the same place. If there’s one thing I’ve learned from reading up on the CRPG Addict’s blog, it’s that CRPG’s should make you feel like your actions CHANGE the world.