top of page
Writer's pictureCallum Pearce

Game Implementation


Now that the simulation scene was finished I needed to actually create the game element from all the stuff I had produced. This meant I needed to start merging it into a master scene between me and my group.

The game is an endless runner meaning the player is constantly moving along the screen. As my AI fish were all bound to spawn and stay within a set wireframe it would be great for the first 10 seconds of playing the game until you eventually run out of the wireframe resulting in no more fish to eat. To fix this a lot of changes were made inside the main flock script that is attached to every fish object. It was now going to be bound on the z-axis only, allowing for the player fish to still eat them and not have them miles away from the camera/in front of the camera. They then roamed free, until they met one of the conditions that made them respawn in front of the player.

Whenever a fish is eaten, behind the player by a certain amount, or simply beyond a certain distance from the player the fish will be replaced within the scene. These fish are replaced in front of the player far enough so they do not see, and then slightly further to randomise their positions a bit more. It was chosen to replace the fish within the scene rather than destroying it and reinstantiating it to improve performance on the mobile. Still not having a proper build to test, to future proof it slightly to avoid performance issues, this, some other small lines of code as well as other group members code was optimised.

Optimising the code this way meant that the amount of the fish had to be fixed. It also had to be changed so that there was varying types of fish, but with different weights on how many of each type. The clownfish, surgeonfish, mackerel and red snappers were splt 4/10, 3/10, 2/10 and 1/10 respectively. This kept their rarities the same provided the total amount of fish is divisible by 10. From previous phone tests 50 continued to be the perfect amount of fish. I defined the scores to be 10,15,20 and 40 so when each fish gets eaten, they can pass on their score to the game manager, and increment the score variable by the corresponding amount.

Here me and my group had a reasonable build for the beta for our game. The player was able to swim, eat fish to increase score and avoid a predator. The next couple of weeks will be trying to improve on feedback given during the Beta Demo.

4 views0 comments

Recent Posts

See All
bottom of page