Engine: Unreal engine 4
Production time: 2-3 years “On indefinite hiatus”
Team: Only me
Project BXB is a 2-player 3D fighting game set in a feudalistic cyberpunk japan. I worked on this project for a period of years. It helped me learn the various intricacies of working in Unreal Engine. Additionally it helped me develop as a programmer and my understanding of what it takes to make good gameplay. Ultimately I abandoned the project once I had done a sunk cost analysis.
I wrote everything located in this repo.
The repo contains only one of the systems in the game
- Develop a dynamic and reusable state machine based close combat system, that encompases the majority of functionalites found across close combat games.
- Design a fighting game that is a mix between traditional 2D and 3D fighting games.
- Develop a distinct and eye catching graphic style that stands out.
- Design and implement 6 different characters that all have distinct gimmicks and fighting styles.
The input stream
An input stream or input buffer is important to have in a fighting game, because it is a way of storing the inputs the player produces in a continually changing list. By storing the sequence of the players inputs in an input stream, it makes it easier to detect what moves the player is trying to do.
Having an input stream also allows players to queue up future moves for their character while being stuck in the animations of their current move. Meaning that the input stream allows the player to have a move ready to come out, as soon as their current move animation is done.
The state of all input buttons on a player controller is saved in a struct every time an input is generated. The input struct contains six buttons and their button states, as well as a timestamp and a thumbstick direction. The saved input struct is then added to a list called the input stream. The input stream is used for comparing if a player has entered the correct input sequence to do a certain move.
The button states:
A button in the game can have one of five different states:
- Up, the button has not been activated.
- Just pressed, the button has just been activated.
- Held, the button has been held down for a certain time.
- Count, the button has been just pressed and is counting till it enters being held.
- Released, the button has been released from either the just pressed or held state.
The state machine
State machines are used in fighting games to keep track of what moves can transition to other moves. The state machine in this game is composed of multiple state objects, that each keep track of what states they are connected to. The states are connected via state links, each state only knows which states it can transition to. The state links have conditions that need to be met for the transition to happen, the conditions in this case are input sequences needed from the player.
Every time the player hits a button it is added to the input stream. The state the player is in then goes through all of its links until it finds a link with an input sequence that ends with that button being pushed. The state then looks through the input stream to find the first input required in the sequence. If the state manages to find both the last and the first input requirements in the inputstream, it then compares their time stamps to see if they are within an acceptable input time window.
If the timestamps are within the required time frame, the state then defines a search area in the input stream between the found inputs, and starts looking through that for additional required inputs. Every time a required input is found, the search area shrinks, until all required inputs are found or the area shrinks to zero. At last if every required input is found within the search area, the link is accepted and the state transitions to the move connected via that link.
The combat moves
Each state has a move connected to it, which contains the info for what the player character does when the state is entered. Things like animation, damage, hit boxes, hurt boxes, and proximity boxes are defined in each move.
What are hurt boxes, hit boxes and proximity boxes? Hurt boxes define the area where the character can get hit and wounded by an enemy hit box. Proximity boxes are used for determining a rough area where an attack will hit, allowing a player that is trying to block to able to enter the block state when they are overlapped by a proximity box. By using anim notifies inside the animation it is possible to easily control when hitboxes, hurtboxes and proximity boxes appear on the character.