top of page

Dev log 09/03/2021

  • Match states

The match states have been linked to both the game mode and the player UI. The game mode controls the game loop overall and will call the game state when the state of a match needs to change. In the "StartPlay" method below, the match is set to in progress in the game state.


Start play method


For debugging purposes, the match state enum has been added to the Log system as a warning message to see if the state changes. This was also a chance to learn how to convert an enum into a string in Unreal Engine 4. Another factor was to make sure only the server could change the match state by adding the Role Authority check.


Set Match state method

For now, this is linked to the player UI and only updates widgets. However, this can be expanded further to call more advanced functions e.g. in a two player game, someone disconnects so this will automatically declare the remaining player the winner.


Match state updated to all players in the User interface


  • Moving player score into player state


Moving the player score from the player character into the player state was the next step. Potentially, if the player pawn is destroyed that would result in the player’s current score being deleted. Also the player state and controller move when possessing pawns so having the score in one centralised place that is unique and doesn’t get deleted until the player moves seems more network friendly.


A small change was made inside the coin actor to remove the call to the character.


Removed score stored in character

The player state was already being called to determine the team ID of the player scoring a point so the additional call was added to set the player score:


PlayerState called to add points

Set Player Score method in player state



The next step was to change the player UI blueprint to call the get player score from the player state.


Player state called to get the individual player score


To do list


Add the game over and win condition for teams e.g. if the red team wins, they show the winner message on screen, blue team shows that they have lost the game.


Once the win and game over conditions have been added, the project will be copied into a new project to be used for more advanced features.


5 views

Comments


bottom of page