I first created some Mind Maps to generate some ideas for the menus.

And the HUD

I then created a Menu Flow chart to plan out the main menu and sub menus.

The colours and theming of the UI was important. The medieval and rustic theme played into the use of natural tones in the UI.
Part of the project specifications was to have a background toy or interaction in the menu. I decided upon a little distraction where the player can make barrels and crates fly around using a physics impulse generator linked to a line trace.

And how it works in game:

A real loading screen with a progress bar was a must, so all of my loading code was placed into the loading screen, and I placed an add to the progress variable between each section of the load.

And the in-game view:

Another goal of this project is to have controller support in the menus. This proved more difficult than first envisioned, but I managed to solve the problem all the same.
The basics of this code are, all of the buttons are added to an array, then the event tick checks each array element for focus, then changes the button style appropriately. To avoid multiple highlight errors, mouse hover is converted to focus events.
Pause menu functionality was another area that required extra steps to function with controller inputs.
When the game is paused, only the menu is actually running, the in-game player controller pauses, which means you cannot use an input map on the character to come out of pause. I had to work around this by putting an input override into the menu code to capture the start button, which uses an event dispatcher to tell the game to un-pause.

I implemented a Main Menu with controller support using the methods above and created the menu below:

The options menu was a more difficult task. I wanted a grid of buttons which showed the options chosen by the user and stayed highlighted.

I used an array of text strings to set the options, then used a loop to run each console command in sequence when the apply button was pressed.
I also implemented some simpler menus, such as Quit, Restart and the controls screen.

On the character select screen, the two characters will highlight based on which character is hovered by the mouse or by which button is being hovered or focused by the controller.
This was achieved by first using the controller code for menus mentioned earlier so that the buttons can be selected, then having the menu instance as a variable in the dummy character code, which is then read by the two character model blueprints to set weather they have highlight or not.
The result in game:


For the character customisation, I wanted several things: To be able to rotate the character when in the customisation menu, to allow changing of weapons and armour, and for all of the customisations to replicate into the game.
To get the rotation, I used the dummy characters player controller to capture the input values of the right stick and the mouse, then this used event dispatchers to communicate this to the character model blueprint and update the rotation.
The ability to change the weapons and optional bracer all had menus associated with them, as shown below, along with a shot of the replicated weapons.
The menu code tells the character model blueprint to iterate up or down though the appropriate array, changing the shown model.

To replicate the options into the game, the player character has a construction script which reads the variables set in the customisation menu and sets the models to the correct objects on the character.

With the jumping main boss, I needed a way to track the position in 3D space. I decided to create an on-screen arrow that rotated in relation to the world space of the player character. Sort of like this example:

To make this into a 2D UI element, I had to think of a way to make it into a flat texture and remove the background to make is transparent in the UI.
I decided to make it so that I could use a material function to remove a solid colour from the background.
First I made a 'bluescreen' kind of studio for the arrow to be inside, which was a high contrast colour to the red of the arrow.


I used the render target and an alpha mask in the material to make it so that all the blue area became the transparency for the final material.

The arrow rotation used the player location and the boss location as the vector for a look-at target, then the camera Yaw was removed so that it was relative to the camera, not just the player model.
And here's how it appears in-game:

For the second playable character I had a character model I had created earlier in the course which used a gun. I thought this would be good practice to implement shooter mechanics.

I rigged the character in Mixamo and downloaded animations I thought I'd need for it.

Using the experience from implementing the original character, getting the model into engine and animating with controls was relatively simple.

And I used a multi-directional blendspace for the aiming mode.

To get the hair and tail to act with physics, I extracted them from the model in Maya and rigged them with bones.

I then used the skeletal mesh physics in Unreal to make them act realistically.

Then re-attacked them to the character using sockets.

To get the character working as playable, I had to create the gameplay mechanics for shooting.

This code aims the gun when a button is pressed, then fires a line trace to determine which enemy was hit and apply damage to it.
I added an aiming reticule and an ammo count. The player can fire 10 times, then there is a re-load animation which replenishes the bullets.

In addition to the standard firing, I added a couple more gameplay mechanics. This is a bullet-time mechanic, using the Time Dilation node.
And this is a explosive blast which pushes enemies away.
Another advanced feature I wanted was a on-screen mini map.
This involved using render targets again. I created a copy of the map under the world which allowed a camera to view it from above.

I created an object which would translate the relative position of the player character onto the map and show it as an arrow.


For the enemies, I created a Red version of the arrow object that would be spawned when an enemy appears and destroyed when it dies.
The updates for the enemy objects are transmitted from the enemies themselves and not tracked by the passive objects.
I also used this same map for the main map screen, which allowed it to be real-time.
Here is how they both appear in the game:
No comments:
Post a Comment