top of page

Week 6: Nicholas McInroy

  • Nicholas McInroy
  • Feb 14, 2017
  • 4 min read

Introduction

It is the end of the second week of month two of final project. This week, I implemented a scoreboard system with a working kill feed, improved the pooling system, and added health bars to the minions.

Scoreboard

The score board took up the most of my time this week. This scoreboard looks something like this:


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Team Name1: Team Count {Timer} Team Name2: Team Count XXXX

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Blue Pig Name1 [Kill Icon] Red Pig Name3 XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Red Pig Name1 [Kill Icon] Blue Pig Name2 XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Red Pig Leader1 [Kill Icon] Blue Pig Name3 XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XXXX Blue Pig Name4 [Kill Icon] Red Pig Name2 XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Blue Pig Name4 [Kill Icon] Red Pig Name1 XXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


It took me a couple of hours to design the UI layout and arrange the UI elements in Unity to make it functional and intuitive to use in game. I wanted to limit the number of UI elements in our game because it can be taxing on the player especially in Virtual Reality where it is in your face. So I decided to use an element I see in many battle royale type games and movies. In the world the display who died and remaining contestants. In the culling for example, they have a scoreboard that is shown below:

It acts as a scoreboard (who has the most kills/ who is alive) and it also acts like a kill feed as it says who killed who. So the scoreboard I designed had 3 parts which could each be subdivided.

The first was the Timer. It is a radial slider that fills up until the time limit is reached so around 4 minutes. It also changes the color from green to yellow then to red based off how much time is left. Future plans include an announcer our sound effect just to let there be an audible cue for the player to know how much timer there is left in a match without having to look at the scoreboard.

The second part is the Kill Feed. Each kill feed has individual kill feed brackets. Right now we have 5 but I designed the code to be flexible so incorporating more brackets wouldn't be anything more than placing another bracket prefab. The way it works is that each bracket stores what team color the Killer has and what the Killer's name is. It also stores what the Killed's name is. Whenever it is told to update its text which is handled by the game manager when there is a death it will update the colors and text of the bracket. The kill feed manager manages all the brackets. it will store all the brackets and enable one by one until all the brackets are full from the kill feed. At that point it will make the first one the new kill and then proceed to move the first one to the bottom of the kill feed and move every bracket up one. This will be lerped as a future plan to have an animation like effect. The kill feed manager receives the requests from the GameManager and handles which bracket should get the message.

The third and final part is the Team Manager. This handles what the team material color is. In future builds we want the player or players, if we do multiplayer, to be able to decide their team color. This color will be their splat color team jersey color and on the scoreboard their background and and text color. Their team name, again they will be able to choose, and their team count. This will allow the players to know information about the current state of the game in a single glance.

Improved Object Pooling

The first iteration of the Object Pooling in our game was simple and got the job done. It required that we make a separate copy of the script for every single type of pool. I didn't like the clunky nature of this method, so I made a Pool System script and a Pool Member script. The PoolSystem would hold a list of Pools. Each pool can hold a name for the pool, a gameobject or prefab that you want to pool, a number of how much you want to pre-pool, a list of the pooled objects, and if it is dynamic or not; for example, if you want get an object from the pool and all objects are being used, it will create one and add it to the pool. When objects are added to the pool they automatically get the Pool Member script attached to them. Which contains a on disable over ride that adds it to the pool again. This is because when I get an object from a list i remove it at the last index because it is O(1) instead of O(N) checking the entire pool for a gameobject that is not active in the pool then creating one if not. Now I check if the count is less than 1 then i create one and add it to the pool, and then regardless I will return the last index of the list and remove it from the list.

Health Bars

These health bars turned out quite well, even though they didn't take long to create. I made a slider with a script on it that talks to the already attached Health Managers on the AI minions. It gets the information from the Health Manager then updates the health bar every 0.25f seconds. I put it in a coroutine for performance and realistically we dont need to make a calculation every frame, 4 times a second is fast enough. I then made the health bar always face the player when he moves around but I locked its X and Z rotation so that it wouldn't flatten out.

 
 
 

Comments


bottom of page