Unoriginal Goose Game

CSC8503-Advanced Game Technologies (C++) - Code Samples

Introduction

The third coursework for the final year of my degree. The aim was to use C++ to create a game in which the player controlled an angry goose, picking up apples and taking them back to an island, avoiding enemies along the way. We were given a very basic framework and added physics, collision detection/resolution, state machines, pathfinding and networking between multiple instances of the game.

What I Learnt

Although I had done some game physics and AI in the past, it was purely 2D. This coursework built upon this knowledge, moving it into 3D games, and explored topics not covered in the previous module, such as OBB colliders and constraints. It also gave me an introduction to networking within games, which I had not covered before.

Video

Implementation

Physics

  • Simple Newtonian physics allowing objects to be moved by applying forces on them. This can result in both linear and angular motion, by applying Semi-Implicit Euler Integration.

Collision Detection

  • Objects are represented by one of three collision volumes: Sphere, AABB, or OBB. The physics system can detect collisions between Sphere/Sphere, Sphere/AABB, AABB/AABB, or Sphere/OBB.
  • The collision detection is accelerated using a Quad Tree, splitting up the world and reducing the number of tested collision pairs.
  • Unity-style Collision Layers were added. These only collide with volumes on other specified layers, allowing some objects to not collide with each other. These are used by the goose and island, only letting them pick up and score particular items.

Collision Resolution

  • Collisions are resolved using projection (adjusting the object positions to return them to a valid state) followed by an impulse (adjusting their linear and angular velocity to account for the collision).
  • Collision volumes can be marked as Trigger Volumes. These detect collisions, but skip the resolution phase, allowing objects to detect certain collisions without responding to them. This is used in the game by the water to create a bobbing effect, and by the goose home, which surrounds the island and will score items placed inside.

Artifical Intelligence

  • Finite State machines are used by enemies, which will chase the goose if it walks nearby with an item.
  • A* pathfinding is then used when chasing the goose.

Networking

  • The game has a shared high-score table, which is stored by a server machine. After a player’s game ends, their score is added to the table, and the table is sent to the player’s game to display.

Possible Improvements

  • I would improve the quality of some of the code. As the coursework had a scrict deadline, there was little time to improve code after it was made functional, especially towards the end of coursework period.
  • There were several features I would have liked to add if I had more time. The largest of these would be a more expansive networked mode. For example, the networking was limited to a shared highscore table, however, I would like to implement a full multi-player version of the game.
  • I woud like to improve the performance of the game. A possible solution would be to amend the pathfinding so that agents only update the path every few frames. Alternatively, additional collision acceleration such as static and dynamic objects could be implemented.
  • The graphical capabilities of the Game Tech framework were very limited, with the focus being on other aspects of the game. I would like to try and improve the graphics of the game, bringing in aspects of the graphics coursework which were left out of the framework.