Sindicate

Programmer, Designer

Worked on a team of seven to create a two-player cooperative roguelike game. I primarily worked on implementing player controls, behaviors, abilities, and actions using C# scripts in Unity as well as the new Input System. I was also in charge of using Mirror for networking the player behaviors and synchronizing the player state and actions between server and clients.

Sample Work - Player Controls

One of our game’s core mechanics was the unique player control system. Both players control the same character but take turns controlling specific character behaviors. One player manages the “on-field” controls such as walking and melee attacks, while the other “off-field” player manages ranged attacks and abilities. The players can swap roles with the other player at any time.

To configure this in Unity, I used a set of three ActionMaps (one for on-field actions only, one for off-field actions only, and one for actions that all players should have like swapping) in the new Input System to set up customizable control schemes that could easily be enabled or disabled when necessary. By using ActionMaps for this, we also gain the ability to easily change controls and possibly implement custom user keybinds in the future.

With these ActionMaps, I was then able to use Actions to handle calling delegate functions related to the inputs detected by the InputActions in the ActionMaps. As an example, if the player is on-field, the InputAction for melee attacks is configured with a delegate to invoke an Action that handles custom player behavior from a player-specific kit class using inheritance and polymorphism.

As one final layer to ensure that both players experience the same thing, the Actions that handle player behaviors are set up to call a client-side function that sends a message to the server to handle the behavior, which is then sent back from the server to all the clients. As an example, the OnMeleeAttack Action configured earlier calls LocalHandleMeleeAttack which then sends a Command to the server that is then handled server-side and communicated to all the clients using a ClientRpc. This system ensures that player inputs are handled by both player connections as well as the server.