Battle System Up and Running

Ok so my last update was just shy of 3 weeks ago. I’ve got myself a job now which has been cutting into my time a little, but I’ve tried to get at least a couple hours in each day during the week and significantly longer days on the weekends. At my last update I think my code had about ~600 lines or so, and I’ve reached over 1800 now. I’ve implemented the entire battle system – the party can go into a fight, use all of their abilities kill the randomly generated opponents, then exit the fight and continue walking around the map again. I finally got one battle to kick through last night and I was absolutely ecstatic. There are still a lot of little bug I need to fix here and there, but after spending probably my last ~10 hours of programming fixing bugs I think I’ve fixed the majority of them.

I’m going to cover the big things I’ve done since my last update. The first step was setting up the focuses for the enemies and allies. While I’ve got the different areas all written up, they aren’t all applied yet over the course of a battle. The bonus health and resistances, as well as bonus damage, penetration and critical strikes are all applied. The big ones I’m missing is the regeneration ability on the support shadows and Thorman and the dodge ability of the mage shadows and Lela. I know how to put them in, though, so I should be able to get those in there without killing myself too badly.

After I got the focuses completed I went on to defining move priorities. I did this by putting together a list of moves that gained increased move priority (or decreased move priority), then organized the various priorities along the secondary stat, speed. I got this to work and so was able to send that through, but I’d also like to expand this to add a little variability to the speeds. I think it would be nice to alter the speed by some small factor between 0.9 and 1.1 to each and every speed, which would allow a different order of moves for each set, instead of the same one each time.

After I had that set I then had the moves displayed on the screen based on who was attacking whom and with which ability the attacker was using. This was a little messy because each character might have different people they might be targeting – they could target an enemy, an ally, all enemies, all allies or themselves. I also had to put together a system to successfully implement enemy targeting of allies, as I didn’t want to define the enemy target before all the varying statuses have been used. For instance, if Toma were to use the ability ‘Draw Fire’ early in the fight, it should increase her likelihood of being hit; this wouldn’t work if the target had already been chosen before the ability were used. Anyway each time a shadow came up it would choose its target before it used an ability and the ability is applied.

After all of the moves had been stated, it came to updating and implementing the various statuses and damage dealt based on all of the varying moves party members and enemies can make. This was really the bulk of the code – each ability probably took up anywhere from 5-20 lines of code, and there were probably around 25-30 abilities, which then spat out a rather enormous amount of coding. Regardless, this would apply all of the moves in the correct order in the correct way. It was generally an enormous mess and was a huge part of what caused my code to bug out like crazy (I couldn’t test any of the stuff as it was put in because I wanted to throw them all in at once, which meant I had to bug fix all of the abilities at the same time which was why the bug fixing took so long).

Anyway, after I had all of that put together I got to where I am now. In total, I’m thinking it was around ~50 hours of work 2-3 hours a weekday for 13 days and another 10 per weekend day, so… yeah. I’m really happy I got to where I am now though, even if there is still a lot of work to do to polish up the battle system and make sure everything is working the way its supposed to. I’m pretty sure I’ve got about 60-70% of the abilities working correctly, but there’s always more work to be done. I also want to come up with a way to better visualize the status affects currently applied to the varying members of the party – it’s not fun to just blindly remember all of that junk in your head. I also want to write out a little note when damage it dealt or an ability is applied. For instance, right now it says ‘Toma has used Draw Fire’. However, this doesn’t state for how long it might last or if the ability actually worked (she only has a 67% chance of landing it). You won’t know when it runs out unless you physically keep track.

Of course, I can implement all of this visually for the player. The game, of course, has to keep track of this stuff or it wouldn’t work correctly. It’s probably at least a few hours (I’m thinking around 10 or so including bug fixing and all that junk) to actually figure out how I want to display it and actually get it up and running, but it would be well worth it. For now, though, I think I want to work on expanding the map size and seeing about moving the character around the map in a meaningful way. I think it would be really cool to be able to explore the maps I’ve designed for the game, and it would be a big step for me and the game.

Also, as an aside, I should really comment my stuff in my code. I know I know how most of it works and why it does what it does, but I’m almost positive I’m going to end up forgetting why something is where it is and end up breaking my code when I try to clean it up a little. Oh well. Life of a programmer, I guess (although I wouldn’t call myself a programmer, but I figure this is the stuff they have to go through =P)

I’ll try to get another update out with whatever my next plan is or maybe if I figure out my map implementation or something. It’ll be fun!