top of page
Search

Looping the Game

  • Abbie Hipwell
  • Feb 28, 2022
  • 3 min read

Updated: Jun 14, 2022


Our game was coming along well and had very impressive mechanics at this stage of the project, something it was missing though was the game loop; currently there was no start or end to the game which would be a necessity for any production.


Game Begin


To create a game loop, I first started with the main menu. I chose to do this in a separate map, and open our core game from there. I decided that this would be the most efficient way to do this, as if I didn't, I would have to delay all of the blueprints in the core game until the 'start' button is pressed. Although this wouldn't be extremely hard to do, I felt like it was easier and more efficient to keep the main menu and the game in separate maps.


There is very little code in the main menu currently, and it will mostly remain this way - except for the UI. I created a main menu widget, and added this to the players viewport - the code for this is shown below:



Currently the main menu is comprised of two buttons; a start button and a quit button. Clicking the start button will open up the level 'Dodgeball_Map', which will then begin the gameplay. Clicking on the quit button will exit out of the game completely.



Game Over


Now that the game has a proper start, I need to create a proper end to the gameplay. I have created two basic widgets to display depending on which side wins, one of these will be added to the viewport at the end of the game. I have added two buttons to the bottom of each of these; one which which restarts the game on the dodgeball map (the retry button), and the other which takes the player back to the main menu level (the main menu button).



I began noticing an issue that occurred each time the player tried to start another game - an extra screen would appear, meaning there would be three players in the game. Obviously this is a huge issue which needed to be fixed, as our game is catered towards two players, not three.


For a while I was testing out different ways of stopping this from happening, my first thought was that the level needed resetting each time the game was over, however this was not working at all. After running out of ideas I asked Adam for help with this and how I could fix it - he soon found a fix which required me to remove a player after each map. This meant that, even though another instance of the player was being created, it was still staying at a maximum of two as I was removing one at the end of each game.


The code below shows this with the remove player node:



The game loop is currently working with no issues or bugs, the next stage in its development will be improving the aesthetic of the UI and making this look interesting. We have decided that this is something I will do with Harrisons help - he will texture and create UI, which I will then implement into the game and ensure that it works from a technical perspective.


I'm glad that this part of development is done, as adding in the proper game loop makes the project feel more playable.

 
 
 

Comments


bottom of page