I attempted to implement the scoreboard this week but I have ran into an issue. Most methods of storing the scores require the score to be a public int but my score is a float. I can’t change it however because that allows my increasing score to work. This issue seems to be time consuming so at this point I feel it’s best to not bother implementing the scoreboard and instead try to focus on other aspects of the project.
I have come up with a hack solution to make up for the scorebard however. I have some form of text pop up when the game is over that displays the players final score. This doesn’t store the scores but it does give the player a better idea of how well they have done. I had to change the game over function to get this to work as I had to unfreeze it at the end so that the text would appear and that the restart will work as well.
I also had the issue where the score kept increasing in the background, the final score displayed fine but the constant changing score in the background didn’t look right. I added an if statement to the update score function so that it only works if game over equals false. This solved my issue.
I did manage to get extra convoy ships working eventually. My problem was when I was adding more anchor points I wasn’t connecting them in the game controller inspector so it wasn’t recognising them properly. Once I was able to add more ships I played about with ship formations to see what worked best.
The GIF on the left shows what I call an ‘arrow’ formation. This made the game too difficult as the ships nearest the edges were hit far too easily. Players could find this frustrating as they would basically lose points right away. The formation on the right is what I call the ‘X’ formation. This was better as it added some difficulty in the fact that there were more ships to look after but they weren’t as easy to hit. This was also an improvement on just having three ships as the the ship in the middle was so close to the ship that it was quite hard to lose it. It could work in the fact that it would be your last one so it should be the hardest to hit but I felt like at that point it didn’t really feel that involved in the game.
Another feature I managed to get working was the game ending when all ships are destroyed. My method to do this wasn’t perfect but it still worked. I created a int value in the game controller and treated it like lives. I set the int value as the same number of ships that spawn and everytime that a ship is destroyed the value is reduced by 1. Then when the value is less than 1 the game is then over. This will help give more value to keeping your ships alive as long as possible because previosly you could lose all your ships and keep playing, your score would be a lot lower but it still reduced the impact of losing all of your ships. I wanted that to be a scenario the player wanted to avoid as much as possible and with this in place I feel like i’ve accomplished that.
My final tweak was to increase the speed of the asteroids, this made it more difficult but I made sure that it wasn’t too difficult. This not only gets the player moving around lot more but makes them less likely to fire their weapon, this is good because I want the weapon to be like a last resort for the player.
With the submission Deadline set for Tuesday the 1st of May there won’t be any time to work on the game any more. The game is at a point where it does the basic function that I wanted it to do, it could have been fleshed out more in certain places but I have enough to judge if this is an effective approach to take. The main focus now will be to finish other aspects of the project like the Postmortem.
This week I began by changing the button to fire from a mouse click to a key press. I was having a problem changing to the key press but I figured out that I hadn’t been changing a certain part to the code to make the key press work but once I changed that it worked fine.
The next thing I worked on was trying to increase the number of ships to see how much more difficult it would be. Whilst not a space shooter I looked at the game lemmings. That game involved the player trying to get as many of their lemmings to the end of the level whilst avoiding various hazard. That game had lots of lemmings to keep safe, so whilst I started started with three ships I wanted to increase the number of ships to be similar to lemmings. This would make it so that it was hard to keep all of your ships safe for a long period of time.
Unfortunately trying to increase the number of ships threw up some issues. The extra ships would either spawn static and not move at all or prevent the original ships from moving to an anchor point. At this point the three ships are challenging enough. It would be ideal to find out if adding more ships would improve the game but any attempt to add more ships breaks the ship spawning. I feel it is best to focus on other aspects of the game at this point.
Next week I will try to implement some form of scoreboard. I am unsure how difficult it will be to do so I will give it a try but if I can’t get it to work I will leave that feature out. Below is a visualization of what the scoreboard should look like if I implement it.
After attempting to implement that feature I’ll give the game a final few tweaks (i.e. change speeds, score, etc). This will hopefully help me figure out the perfect amount of difficulty to set the game at. The main focus will be on the amount of asteroids that are spawned as at the moment it is relatively easy.
I will also look to make it so that when you lose all three ships the game is over. It is quite difficult to lose the ship closest to the player, if I add this extra penalty it will add extra incentive to the player not to lose all of the ships, at the moment the slightly lower score doesn’t seem to be a strict enough penalty. I may also look into increasing the score deduction as well as the game over aspect.
I will also look back at the initial tutorial I used for this and look at the extended section. This section covered extra elements to add to the game to flesh it out a bit more, I will mainly be looking at this to see what kind of additions they have made. Hopefully it will give me an idea for any final additions I can make to the game to make it that bit more polished.
After that the game should be complete and I will focus on other parts of the coursework.
This week I added a increasing score to my game. I had a few issues to begin with as the score would increase by one but then stop, I found out, thanks to some helpful advice from Robert Harper that I hadn’t been calling the function in the update section but once I did it worked fine.
I also reduced the amount the player could fire to make it more difficult to deal with asteroids. At first because it was the kind of game focused on getting points from destroying asteroids it masde sense to have a high fire rate but becuase i’ve shifted more towards the survival angle I needed to reduce the amount the player could fire to make it more of a challenge.
The best example of this is in survival horror games, to make the game that much more suspensul there is usually less ammo for the player to use unlike first person shooter games where there is an abundance of ammo usually. Take the Dead Space games for example. In these games you have very little ammo to use and it reall adds to the tension of the game. It also adds to the difficulty as the higher the difficulty you choose the less ammo will be availible in the game.
I think it could be reduced further but I’ll leave it as is right now, the next focus for me is to have a key press to fire the weapon instead of a mouse click as the mouse click is quite awkward to use.
This week I continued looking into changing the penalty for a ship being destroyed. I’ve decided to go with the reduced score approach as it will be easier to implement and it will give more meaning to each ship you lose. At the moment the score will reduce sometimes but not all the time. I believe this issue is down to the shaking issue I mentioned earlier. I need to find a solution for this issue now as it is effecting the game now.
After removing the speed increase from the convoy I noticed the collision issue still persisted so the shaking wasn’t the cause. I then inflated the mesh collider in the hopes that would work. After some testing the issue hasn’t resurfaced so I believe that has resolved it.
In terms of other work I have done I have also made it so when the game ends it stops altogether. I did this by making the timescale = 0 when the game is over. It doesn’t look as good as the game still playing in the background but that way made it possible for asteroids to still hit the convoy ships when the game was over and the player could do nothing about it so this method is preffered.
Next I will work on reducing thee amount the player can fire, look at what an acceptable penalty should be given for losing a ship, add 3 more ships and possibly add an increasing score counter to reward the player for staying alive for longer as well as destroying asteroids.
This week I wanted to work on the speed of the convoy as I felt having them as slow as they are in the GIF shown made the game quite difficult.
I ran into an issue whilst increasing the speed as it had no effect. This was due to the recent changes to the code for the convoy. In order to make the changes have an effect I had to use the speed variable in the movement code. This lead to another problem as the increased speed caused the convoy ships to shake and then dissappear.
To stop the ships dissapearing I used the restict access code that I commented out after last weeks work to restrict movement on the Y axis. I had a feeling the shaking was causing the ships move out of bounds which is why they dissappeared so restricting them on the Y axis stopped them dissappearing. There was still some shaking when the ships were still but this wasn’t too much of an issue.
My next change will be to make it so that all the ships must be destroyed before the game is over, either that or have the score decrease for each ship that is destroyed as at the moment having the game end after one is destroyed is too difficult.
At this point i’ve removed the part that ends the game if one ship is destroyed but have been unable to make the score decrease when the ship is destroyed.
This week I enlisted the help of Gareth to help with my issue of getting my convoy ships to follow my player in formation. He was really helpful and managed to get this part of the game working. He added some anchor points for the convoy ships to follow instead of the player. This made it so that the ships wouldn’t overlap each other. These anchor points were also put into a for loop so that it could check if they are being used or not. I have a brief idea of how the code works that Gareth helped me with but I do need to further my understanding a little more.
In terms of work I done on my own I cleaned up my convoy spawning code . I came across some code in the unity documentation that allows you to spawn various versions of a prefab in a for loop. They all spawn at the same place but because of the code Gareth helped me with they all move to the anchor positions so this method will work fine for my game.
This week I began with trying to spawn the convoy ship instead of placing it in the level. I looked at the code that spawned the asteroids and took away anything that was unnecessary. I then changed the spawn position to spawn the ships at certain locations. This worked well for the one ship.
To get this working for other ships I just copied the code multiple times. This would do fine in the meantime but I will need to figure out a better alternative in the future. Spawning these ships at different locations unearthed a problem. My current method to get the convoy to follow the player isn’t ideal because if two ships are next to each other they try to follow the player and end up overlapping each other as they both try to move to the players X position. My aim is to have the ships in a formation to make it more likely to get hit by an asteroid as they won’t just be in a straight line.
I also worked on the collision of the convoy. The convoy would sometimes collide with the asteroids but not be destroyed. My issue was my collider was a box collider that was smaller than the mesh. To resolve this issue I replaced the box collider with a mesh collider and used the player ship mesh collider.