Maxim's project vault

Cat door

Personal project
Game developer (Unity, C#)
27 Sep 2022

Source code for this project can be found here: Github

Cat Door is a prototype of a 3d puzzle platformer that focuses on non-euclidean geometry. This vision includes an unorthodox player controller, which allows for a player to walk on walls and ceiling.

This mechanic has a lot of constraints, which includes:

  • Ability to follow ground’s curvature.
  • Inability to follow ground on the right angles.
  • Ability to jump.
  • Ability to fall from cliffs.

constraints

The gifs below show implemented in unity behavior.

floor Demonstration of overall work of player movement scripts.

walls Demonstration of wall/cliff interaction.

I manage this by using the State pattern. Movement algorithm has following steps:

  • On Ground. Initial state.
  • On Edge. For when the player approached a cliff.
  • In Air. For when the player is falling.
  • Bumped. For when the player approached a wall.

UML diagrams are shown below.

state UML state diagram.

class UML class diagram.

Each state is represented by a class that derives from base class, which consists of a virtual function “Update” that dictates logic for players movement for each frame with the help of polymorphism.

Source code for this segment can be found here

This approach allows for simpler player transform manipulation, for example, gravitation-altering platform: when a player goes into trigger, their up direction changes onto the opposite and state changes to “In Air”.

private void OnTriggerEnter(Collider other)
    {
        if(other.name == "Player")
        {
            player.SwitchState(player.stateAir);
            player.PreviousUpDirection *= -1;
        }
    }

Unfortunately, the prototype is still in the making and can not be played.

Thanks for reading.
Maxim.