From UBC Wiki

Platform-based game engine

Authors: Finn Hackett, Peter Deltchev

What is the problem?

We are interested in creating a generic game engine for 2D platforming games. This engine will run using the sdl2 package which uses the Simple Directmedia Layer to provide Haskell programs with a graphical interface and access to user input.

What is the something extra?

Key areas of interest are customisability and performance.

For customisability, we aim to implement a level editor that allows the creation of basic platform game levels which can then be played.

For performance, we hope to implement a quadtree-based data structure for level storage, giving us logarithmic search operations on level geometry as opposed to more basic linear structures. This is inspired by the 3D first-person shooter engine Cube 2, which uses a similar technique for its own level geometry.

What did we learn from doing this?

Collision detection and physical simulation can be challenging. We learned how to do raycasting over quadtrees, and what kind of things you need to know in order to properly make a character move in a platform world.

We also experimented with applying folds to multidimensional data structures - the quadtree that is. In retrospect we could have instantiated Foldable and made our code more generic.

We ended up with a proof of concept that implements most of what we set out to do, give or take some imprecision and edge cases we missed simulating the player physics.

Full cross-platform compatibility is something we couldn't take for granted, even when using the SDL2 library that supposedly helps ensure it. We were only able to get keyboard and mouse input to work on Linux OS's in the time we had - the same Haskell code does not give us functioning input when running the game on macOS.