Big Game: Week 1
|
This first week I created a basic bejeweled clone. I started with a grid that I filled with differently coloured squares, representing the different resources in the game. I made code that lit up a square if it was clicked and also changed it into a fixed color, for testing purposes. This was done during the first day of the week, so some time was also used to understand Unity which I have very little experience with. The way I have to access the list script from each square is a bit odd to me, although it did not cause too much of a problem until later in the week. The second day I made it possible to swap squares around and also implemented a basic match code. When things are matched the “gravity” pulls other blocks down. The code that pulls things down didn’t work quite as I wanted. Sometimes things got pulled down even though it should not have been possible, essentially removing blocks from the board. The third day I solved the problem with the blocks going missing. I also got directives that the way my matching worked was not what we wanted, so I had to redo that. I should have checked the design document instead of assuming. I finished the matching remake that same day. The second last day of the week I started to work on code that was going to make sure that the board with squares did not match at the very start of a session. I struggled with this a bit as I thought I had gotten code that worked, because I tested it at least twenty times in a a row and it worked like a charm every time, then when I tried it again it froze in a while loop. I tweaked it but I still did not manage to figure out why it was happening. Late that day I finally figured out a way to make it work, but I’m not quite content with how it works yet, it should be faster in figuring it out, as it takes a bit over a second currently. The last day of the week we had got word from a programmer from another group which had checked our game out that our garbage collection size was too big. We plan on porting our game to a tablet and or phone and he told us that we should try to optimize that if we wanted it to run on such a device smoothly. My board and square scripts took up almost 10 kB each which is not very good. I changed function calls to cheaper ones that he recommended and replaced undeclared strings with declared ones. This halved the board script and the squares went down to about 2 kB. There is still room for improvement so that is one important thing to always keep in mind as I go forward. |