Course:CPSC312-2017-AirHockey

From UBC Wiki
Jump to: navigation, search

Air Hockey

Authors: Malinda, Harvey, Cham

What is the problem?

Investigating the feasibility of implementing a game of Air Hockey in Haskell.

What is the something extra?

We will implement our game using a third-party game engine for Haskell called FunGEn. This will require us to use the API they have provided.

What did we learn from doing this?

We were able to successfully implement a full game of Air Hockey (complete with a scoring system) using the third-party game engine. You can demo it using the link at the bottom of this section.

We learned a number of things from this project.

Firstly, we learned basic game design principles (mainly how to setup a game using a main function and a game loop to check for conditions) including how to simulate certain properties like friction.

Secondly, we learned a lot about using an existing API in Haskell. The fact that Haskell has type declarations made browsing the API a lot easier to read (because functions were almost self-documenting - this can be seen in the API docs).

Furthermore, we learned about the limitations of the game engine itself - this included the fact that it has no cross-platform sound support and only supports 24-bit bitmap files for image resources.

Overall, using Haskell to write this program was a pleasant experience - in fact, some features were especially useful. Our favorite example is how compact the if else statements are within functions (see example function) and the fact that the compiler warns you if your conditional combinations aren't exhaustive (this was very useful for defining cases).

Code (including setup instructions): https://github.com/chamkank/air-hockey