|
|
I’m back on the weekly schedule! This week I have worked on a few different things, like one would expect. I’ll list the things I felt were most important like last time and hope it gives you a good view on what I did!
- It is from now on possible to have more than one board on the same level. This means that there can be, in theory, an infinite amount of individual boards on a level. I first thought this would be possible without any modification of the matchBoard script. When our level designer attempted to create more than one board on the same level what happened was that all the powerups only affected one of the boards, regardless of which board it was triggered on. The feature that lets you drag to swap two materials on the board was also not functional on any other board than the original.
To fix these problems I had to make sure that all the individual material scripts were all connected to the correct board on the level. This meant that the level designer would have to specify how many boards there are on a level inside the matching board script. The creation of more than one matching field also yielded a problem with the score calculation, because the script that fetched the score only did so from the first matching board. To solve this I made a small script that is in the player prefab inside the unity hierarchy that collects the score from every separate board. Lastly, hero abilities on the matching board had to be corrected so that they trigger on all of them.
- I have made it so that the checker pattern that is used behind all materials in the matching board is now created dynamically so that our artists won’t have to create custom checker patterns for every different size of matching board. It was a relatively easy procedure that required me to use the modulo operator to figure out which material should get the light grey square behind it and which one should get the dark grey square behind it. It is not that large of a feature, but it saves some time in the long run.
- A large part of my time was devoted to finding and trying to squash bugs outside of those that came up when I made it possible for more than one matching board. A big one that took me forever to figure out was why the find material match functions was called twice even though I only wanted to call it once. I sent everything that happened inside the code to the logging tool in unity to see exactly why it happened, but I could not for the life of me figure out why this was happening. I really was stuck. Then, when I was searching for the function in question I found an if statement that I must have missed earlier. This if statement that I wrote some weeks ago checked if a matched happen just as the player had swapped two materials, if the function was true the materials would stay where they were and match, if not they would move back since no match was made. The find match function was thusly called twice creating a lot of unwanted problems for me, like powerups spawning twice or even thrice sometimes. When I modified the function to just verify if there was a match and return instantly after that without adding powerups things worked as expected, which was what I wanted.
Nobody likes bugs
Another bug that I introduced with a feature that made sure nothing matched “for free” when one enters a level caused the game to completely freeze. I am not sure if I mentioned this in an earlier post, as this was in the game before we remade it without the usage of unity tags and the same thing happened then too. What happened is that the game got stuck in a while loop for reasons I can’t figure out. The while loop is set to continue until there are no more possible matches and no empty materials on the board, but for some reason that sometimes froze the game. I still am not sure why. To fix that I made it so that if the loop runs for a thousand iterations without breaking it forces it to break. So a for loop really.
I won’t go into detail on any more bugs because I could rave about it all day. Crushing a bug is like decapitating a hydra, it probably will introduce some other bug somewhere else.
- On the brighter side I added the new pikeman animation into the game! Animations will from now on have four different walking animations since we are using an isometric perspective, so some scripts had to be changed accordingly. The horse animation is next to be added, since time ran out before it could be added!
- On a non code related note we showed our game during the friday alpha testing with all other students and got positive feedback from most people. It was really nice to hear! The main complaint that seemed to pop up was the lack of feedback and some also raised concerns around the ui. This is just my own impression of the feedback that I got from the people I listened to, as we have yet to discuss all feedback together in the group! I am satisfied with how the alpha turned out, as nothing crashed on us when people were testing!
That is all from me this week! I hope the few of you reading this can find some clarity in what I did!

|