A busy bank holiday weekend threw me off, so this one’s up a few days late. It’s been a very productive sprint, with only 2 items left incomplete from my Trello board. I’m now able to detect whether two characters can “see” each other by drawing a straight line from the head of one to the head of another. It doesn’t take into account things like partial cover yet, but it at least lets you know if they’re behind a building. I’ve discovered that the aim-cam I’ve set up will need some tweaking, as it makes it look like you can see a character from some positions, despite the edge of the building being completely in your way. I want to tackle that next sprint, as it’s going to cause problems if I’m constantly getting confused about Colliders and Raycasting. I’ve also got a rough hit chance calculation in place for when you take a shot. It’s pretty basic, only reducing it based on distance, but I don’t need anything fancier until I’ve got a more thorough design done for this weaponry and combat in general. If you do hit someone they take damage, but this doesn’t have any in-game effect. That’s going to take a bit of thinking about, but I can polish it off at the start of next sprint.
Finally for combat, firing a shot ends the turn and moves play to the next character. There’s some flakiness still, as it does this at the same time that it tells you whether you’re shot hit, and what happened to your target. Usually you’d sort this by spinning this out into a separate thread to tidy things up after a certain amount of time passes, but in Unity you can only do certain things, like hide the aiming crosshair, from the main thread. And I can’t delay that thread too much without blocking the UI, which would also stops things such as firing animations, watching characters take damage, etc. It seems that the accepted way to fix this is to start a timer and move the code to sort out these changes into the Update thread. I’m not particularly fond of this idea as it will clog up the main Update thread and you lose some control over when the difference actions will occur, but at the moment I can’t see an alternative.
While it’s not as big as getting basic ranged combat working, I’ve now got some rough team mechanics in place. Again, it’s nothing major, but characters are now split into 2 teams, with members of each one only able to shoot the others. I’m not sure if I’ll be changing it later, but the way it works now it will always shift to the next usable character in the other team. So if Team A has 3 members and Team B only has 1, it will always change to that 1 member after Team A finishes their turn. I took some inspiration from Worms here, where even if you’re one or two team members down, you can still scrape through to victory with one plucky survivor. It’s never felt enjoyable to me when you lose someone early on and it ruins your chances for the rest of the game just down to sheer numbers.
As said a couple of times earlier, I’ve only partially implemented health. Each character has a health score which starts at 100, and when it reaches 0 they’re taken out of the game. I’ve also not worked on the cover mechanics yet, using simple line of sight to decide if they can shoot someone, and this will take a bit more thinking about. If someone’s hidden behind a barricade with only a few gaps in it, then that would be considered heavy cover, but if the person behind the barricade is shooting, should the other guy also be considered behind heavy cover because the barricade’s between them? I’d say no, but then how close to the barricade should you be for this to not be the case? What about if it’s not a barricade, but a gap between two large obstacles, such as buildings. How far can this impromptu cover go out before you can’t just aim around it and stop them from using it as such? What about two people on opposite sides of a set of girders, should both of them or neither of them get cover? So yeah, this will need a bit more thinking about before I try to do anything. It may just be safer to put this off until later so I don’t end up doing a bunch of work that’ll need completely rewriting after a design change later on.
Which brings us to next sprint. The first thing that needs finishing off is taking characters out of the game when they run down to 0 health. I’d like to keep their models around, so I plan on pushing them over to show where they were. The game will also need to end up there’s no more characters alive on one team. While I’m likely to leave full cover calculation until later, I’d like to put some rough work into place so you at least get some protection from standing behind a chest-high wall while shooting out at someone standing out in the open. Other than this I want to focus on tidying things up a bit so I can start taking some screenshots. There’s a lot of huge buttons all over the place, some of which don’t matter when you’re moving, and others which are just as useless when aiming. It makes sense to hide those and free up more of the screen. I also want to stop a button-press from counting as movement if it’s positioned over a walkable piece of terrain. I’ve looked into this before early on, but I hope that now I know more, I can figure out where I was going wrong. Mostly there’s just lots of little tidying up tasks that need working, which aren’t worth going into major detail here. I’ve also taken reading The Art of Game Design out of my sprint, as every time I finish one chapter, it’s replaced by another straight away. I’m still reading it, but it wasn’t helping anything by having it up there.
As usual, you can see the my current sprint on my Trello board.