Portfolio


  • Home
  • DirectX Raytracing
  • Advanced Graphics
  • Roboflux
  • Boat Simulation

Green game jam



The Project



I created this project with a friend for the Green Game Jam. The theme of the game jam was environment so we decided to create a game based loosely around zoo tycoon except the animals were free to walk around. We decided unity would be a good engine to use as it is simple and intuitive to use.



Splitting up the work



We collaborated on this project with the help of Github. Once we had set up the skeleton of the repository we started deciding who would complete which tasks. I was in charge of creating the scripts for the camera controller, animal placement, UI controller and the main menu. My friend was then in charge of creating the animal AI, happiness calculations and sourcing the models.



The camera controller



The first task I completed was creating the camera controller. I did this by storing a forward and up vector for the camera. I then used these to allow the player to use WASD to move the camera along the axis. The next step was to add in mouse control. I did this by rotating the appropriate vectors relative to the amount of distance the mouse covered across the screen. This value was then scaled using the change in time to ensure it wasn't framerate dependant.



Animal placement



The next script I created was the animal placement script. I did this by having a variable acting as a pointer. You could then press a number between 1 and 7 which would select an object, be it an elephant or a rock, and assign it to the pointer variable. A raycast was then created from the mouse pointer on the screen. This meant I had to translate the mouse coordinates back down the graphical pipeline using the correct matrices. I then had to update the camera controller so that the scroll wheel controls how far away the object is being placed from the camera.



UI controller



The final script I created was the UI script. The first part of this script I created was the happiness total in the top right. This stores the amount of happiness the player has at the time. It then keeps track of the change in happiness per second being generated by the animals. If this is a positive number then the text is in green and if it is negative then it is red. The second component of the UI controller was to change the border colour of the item selected. I did this by creating a variable which pointed to the border currently selected. The original border colour was then stored. If the selected item changed then the border colour would be reset to the original colour and the variable would then point at the new border. The final component was to display the happiness generated by an animal when it is hovered over. I did this using a raycast. If the raycast collided with an object with the tag "animal" then it created some text at the mouse position.