Unity Fighting game plugin & hitbox editor

For my dissertation, I wanted to create a way to simplify the game development process for users with less experience developing a game and users who wanted a template for a specific type of game. To begin with I settled on the idea of creating an framework in the Unity engine that would give users a head start in creating a two dimensional fighting game. For the dissertation I wanted to focus on three major parts: The animations, the control scheme and the hitboxes. I wanted to make sure that each of the parts were not reliant on each other so users could pick and chose the features they wanted to use. While both the animation segment and the controller segment were created in Unity, the hitbox segment was created using C++ and a GUI library called WxWidgets.

Controls

The first part I wanted to focus on was the control scheme. While Unity does support controllers, the information is usually displayed as raw numeric values which usually take a bit of time to translate into useful information. In order to make the information readable, I created a function that would feed controller information into enumerators relating to joystick directions and buttons pressed. Fighting game control schemes have a unique way of executing attacks. In order to perform special moves in certain fighting games, the player needs to input certain directions before pressing the attack button, for example in Street Fighter, the Hadouken attack is executed by pressing a punch attack button after inputting down, down-left then left on the joystick or direction pad. In my project I have implemented this by storing every input from the controller as the input is changed. When the project is running, a function is called every time the controllers state is changed checking if a special move has been executed. If it has, functions relating to animations are triggered (See below).

Animations

Next I focused on animations for fighters within Unity, specifically, how to trigger them. The animations themselves were designed to be sprite based animations rather than key frames so, for the animations themselves I used the default animation functionality in Unity and for the sprites I used sprites from the fighting game Street Fighter 2. In order to trigger the animations I had to create a fighter class. This class contained strings that correspond to trigger variable in the animation controller. When a move is performed on the controller the animation is triggered on the fighter. This project was quite specific and many of the features described here are probably better understood when demonstrated. Below is a link to the repository where the Unity project is stored.

Hitbox Editor

The last part of my dissertation was an external application written in C++ that used an external GUI library called WxWidgets. The purpose of this application was to provide developers with an alternative to the method of adding hitboxes in Unity. Hitboxes are one of the most important aspects of a fighting game and so adding and editing them in a simple way should make the process of developing a fighting game less frustrating. In this application users can add sprites into the application and can then draw hitboxes on top of the image by dragging. This information can then be exported to a JSON file and imported into Unity where the hitboxes can be added to the fighter class, mentioned earlier. Like the Unity project, the source code for this application is available on GitHub, the link is below. A built version of the application is also included in the Unity Project.