Big Game Project – Week 1
|
Week 1 is now over. It’s been a both short and long week, if that makes any sense. I haven’t had this much fun working on a game for a long time, so time has been flying, but at the same time there have been long days which feels quite exhausting towards the end of the week, especially when I’m not used to it from the lack of work the last couple of weeks. As I mentioned earlier we’re using Unity to make the game, and it has been quite convenient to work in for some parts, and less convenient for other ones. For example accessing classes from each other with objects and pointers is really convenient in C++, but here it’s a bit more work to do the same. On the other hand setting things up in the project is very smooth and testing things out on the scene is quick and easy, so it all works out in the end. Not having used Unity before of course adds to the inconvenience with it since I don’t always know the best way to work things out, but so far I think we’ve been doing well. We have decided to try to port the game to some kind of tablet towards the end of the project if possible, so we’re already trying to be aware of how much performance everything is using, and we optimize a bit as we go. This of course depends on which parts of the game since the focus at first lies in getting something playable that works. At the start of this week me and Teodor Norén hadn’t worked at all in Unity, so we decided to learn together as we set up the board for the match three. Eventually we were only working on his computer while the asset server was still in the works, and so it ended up with him having the match three part of the game to make. This meant I had focus on more of the towers and enemies for the Tower Defense part, which was interesting because I hadn’t done anything similar before. Creating projectiles with speed wasn’t new, but many of the Unity tools made it easy to pick targets and move the missiles to them. I worked out different functions depending on what type the tower was, picked my target from the tower class and sent that to the missile as I created it. For example the normal Arrow tower simply shoots at the first enemy that enters its circle collider. This let me save all enemies that entered the radius in a list, and then whenever the first enemy died or left the radius I went on to shoot at the next available one. For the Ballistic tower that shoots an Area of Effect boulder this was a bit trickier. The targeting was somewhat the same, although the missile would not home in on the target it shot, but rather the area the target was located at when the boulder was launched. Once it reached the area it would make a list of all the enemies within its collider and then damage all of them. It was fun to see it working as intended somewhat quickly, although there were some small problems as always when programming games. One of the simple things I was stuck on for a bit was the boulder not damaging them, and I couldn’t figured out why for about an hour. After that I realized it was actually working but the enemies never checked if their health dropped low enough to kill them. I also made an Enemy Spawner which holds another class called “wave”. I first wanted to make the wave into a struct, but it seemed like calling structs was somewhat different than I expected and from what I understood it ended up being something like a copy of what I actually wanted to change, meaning that changing the values in it wouldn’t actually be saved or usable. The wave class holds on a number of variables such as number of each different enemy to spawn, total enemies to spawn (if the total is higher than the sum of all the different types it randomizes the rest of the wave), whether some of the enemies are not enabled, frequency of the enemy spawns, size of the groups in the waves (if any) and if so the delay between them as well. This makes for a quite easy to handle enemy spawner and I couldn’t think of anything else that could be useful for it to be able to do, but I’m sure we’ll find something once we start working on the levels. Finally the last task I started this week was the Magic Tower. The Magic tower is supposed to shoot Chain Lightning, which means it picks a target, shoots it and then the lightning damages additional nearby enemies, in this case two. As it seems right now, I will be using something called a Line Renderer to get this effect. First I need to pick a target with the tower, then pick two nearby targets which I at the moment do with a function called FindGameObjectsWithTag which returns a list of all Game Objects with a specified tag. The risk of doing it like this is that it might potentially affect performance more than necessarily, but for now I will try to make it work. After I’ve gotten the list from the function I check each object in the list and determine the distance between the original target and this one. The first two targets are saved immediately, but after that it checks if the distance between then next one is shorter than them and overwrites them if they are, effectively finding the two closest targets. What I have yet to start on is rendering a line between them with a slight delay, to show the lightning. This line would eventually have to be an animated lightning sprite which I would transform to fit between each target. I’m happy with what we have accomplished this week despite not having worked in Unity before, and I’m very excited for the coming week. Especially since we have estimated to get a working prototype early in the week, worst case towards the end of it.
Until next week! |