I had a whole week this sprint where I wasn’t able to get anything done for this game, so this ended up becoming an impromptu 3 week sprint. Even with that, there was a lot that didn’t get done. But first, let’s start with what did get done.
What I did
The biggest item I worked on this sprint was to make cover meaningful. When you aim at a target it calculates how much of the other character is visible, and assigns a cover level to it, ranging from 0 to 3 (0 meaning no cover and no penalty, while 3 is total cover and cannot be targeted). I did this by placing a single quad (basically a rectangle in 3D space) through the centre of the character, and rotated it towards the shooter. I then run a number of Linecasts between the shooter’s head and a number of points on this quad, then use the number of Linecasts that make it through to get a cover percentage, which is then converted into a cover level and displayed next to the target reticle. You don’t see anything through the UI other than the cover level, but in debug mode it looks like this.
My characters now rotate to face the direction they move and shoot in, which generally makes for a nicer game appearance. They’re still very much placeholders, but if I can spend just a bit more effort to make them look nicer then I consider it worthwhile. I’ve also replaced the movement circle with something a bit smoother. After lots of experimentation I learnt that, with the shader I’m using, a cone won’t do the job after all. I really need to use a shape with rounded edges such as a sphere, or maybe something shaped like a pizza. I did find an excellent sphere that looks perfect, but at 10Mb it seemed a high to include. I’ll have to come back to this again later, but for now it’s good enough. And finally, there’s a small button in the upper-left corner which allows you to exit the game. Testing this game entirely through the editor has taught me that there’s some issues which really don’t present themselves until you’re running it properly, which is why I missed items like this as well the cover level icon repositioning itself further away than I wanted it to. With this in mind I’m going to devote a full day to testing out a new version before I release a new tech demo. Early prototype or not, it’s a good habit to get into and there’s no point making this if it only works for the person making the game.
What I didn’t do
The biggest task I wasted far too much time on this sprint was the health bars. This seemed like a simple job at first, but eventually this ended up being a colossal time sink. At the time I couldn’t find a single good guide to do exactly what I wanted, and when I did find one they assumed you’d already watched and memorised content from some of the previous 50 articles/youtube videos. The methods I did try never seemed to work quite right, and contained problems which I’ve already learnt will cause serious memory issues later on. Eventually I discovered that the methods I was trying did not work in version 4 of Unity, but only in older versions of Unity 3… I’ve since been pointed at a new guide that covers how to do this in Unity 4, and it seems much more promising. This will take up the bulk of this next sprint.
In addition to this I’m still having some problems with the cover mechanics, which is baffling and very intermittent. Every so often when it rotates the quad to point towards the target the game seems to detect the collider as if it were pointing at a different angle. I’m not sure why it’s doing this, and if anyone fancies a go at figuring it I’ve posted the question on the official unity answers here.
With the amount of time spent on these 2 areas there were several things I didn’t even have time to look at. The simplest one was the Game Over screen when you take out the last target so that the game doesn’t just endlessly throw errors at you. I also wasn’t able to fix up the firing process to let you see if your shot hit before it moves to the next player.
What I will do next time
Due to how overloaded I was last sprint, this sprint is focused on finishing up everything I didn’t get around to doing last time, with particular attention paid to getting the health bars working. Before starting on that, I want to tidy up a couple of smaller UI issues such as adding the Game Over screen, as well as a Title screen to start the game from. Additionally I need to show the controls within the game somehow, so I’m adding an extra screen to display this information which you’ll be able to view with a button click. Considering how this is a feature of every single game out there I don’t expect too much trouble from this, and it seems pretty essential to have it in there before I release an updated tech demo in 2 weeks. This may seem a little light, but last sprint a lot of time was lost trying to get the health bars working, so I’m making that the one big job to concentrate on for now.
As always, you can see the current state of my sprint on my Trello board.