Final Project Week 14 - Visual Stat System
In the past 2 weeks, I was working on attachments and how they are applied to the weapon. This week I will be implementing a visual stat system that will allow the user to know what they are attaching to their weapon.
Research
Before I started making the stat system, I wanted to look at the systems other games have in place. The games I chose to look at were Battlefield 4, Ghost Recon Wildlands, and Rainbow Six Siege. I chose these because they all have the same style of attachments that I have created for my system. This means that their visual stat systems will be very similar to what I want to create.From the users' viewpoint, all of the systems are almost identical, they all show the majority of their stats as bars, and the stats that they show aren't exactly what they have programmed into the weapons, This makes sense as it allows the user to see at a glance what the weapon they are using is good at. Without having to look at a spreadsheet of numbers they know nothing about.
Battlefield 4 Weapon Stats | Ghost Recon Wildlands Weapon Stats | Rainbow Six Siege Weapon Stats |
Rainbow Six Siege and Battlefield 4 show numbers, as well as the bars, while most of the numbers are not actually directly related the variables of the weapon, some are, for example, one of the bars represent fire rate, so the number next to it shows the rounds per minute of the weapon. Battlefield 4 also has numbers not related to a bar, for stats such as fire rate.
One thing that I noticed with all of the games, is that the bars don't just reflect the attachments on the weapons, they also reflect the weapon itself, this means that switching between different weapons, you will see a large variety of stats, this allows you to see which weapon you want to use, as well as the attachments you want to use for that weapon.
Battlefield 4 Attachment Preview | Ghost Recon Wildlands Attachment Preview | Rainbow Six Siege Attachment Preview |
The last thing I noticed about all of the games, is that they will make it easy for you to compare between different attachments and weapons. They do this by changing the bars and numbers to red or green depending on the difference between the current attachment and the attachment you are previewing. This allows the user to see which attachments they want to choose quickly without having to click on each one, and figure out which stats have changed.
Implementing my stat system
Based on the implementations from other games I decided to give the developers using my system the ability to use most of the same functionality in their games. I added the ability to have the stats shown with numbers, bars, or both. It also allows the developer to choose the order in which it gets shown.Automatic System Issues
I spent a lot of time creating a system that would allow the developer to set the stats that they want once, then all of the weapons and attachments would take those stats and apply them to save the user from having to recreate arrays in different objects. This worked for objects in the scene, the weapon script was able to find the weapon system and create stat variables based on the stats created in the weapon system. The attachments would then do the same with the weapon, creating modifiers that could be edited and applied when the game is run. The issue that I found, was with prefabs. My system works by creating attachment prefabs that could then be applied to the weapon at runtime. but prefabs aren't children of weapon systems or weapon scripts, this means that they are unable to find stats to work with.Finding The Best Solution
An idea I had to fix this was to have visual stats based on the variables of the weapon and attachments, for example, a handling stat that will look at the sway, aim speed and hipfire of the weapon, then make a stat slider based off of that information. While this may be a good system specifically made for a game, it is very hard to create for a modular weapon system. this is because it would be very confusing, unintuitive and hard to use for the developer.The solution that I decided to implement in the end was an array in the weapon system, weapon, and attachment. This may take the user longer to set up, however, it will be more reliable and consistent, it also reduces the amount of code needed to apply because using the automatic system, it would need checks to make sure it isn't applying any modifiers that weren't meant to be applied.
Creating the UI
The next challenge was getting the stats to show up within the attachment selection screen, The goal of this is to show the user what a weapon is good at and bad at in a simplified way. The developer can add as many as they would like, and provided the stats they give are between 1 and 100 they will show up as a value on the slider. The values that I have included by default are a simple way of showing what the weapon and attachments are good at without having to scroll through all of the variables of the weapon. There is fire rate, Ammo, accuracy, handling, range and hip fire, each attachment will affect these stats differently.Pistol Example Stats | Rifle Example Stats |
Optimising the System
I spent some time thinking about how to apply and show the stats. This doesn't directly affect the user or developer, but if it is done inefficiently then it could cause performance issues on low-end hardware. I know that stats won't need to be updated if the user isn't on the attachment selection screen, however, they cant be updated like the attachment modifiers are, when the user closes the attachment screen because the user needs to see the changes as they select the attachment. Because of this, the stat UI is only updated when a new attachment is applied.Allowing the User to View Changes
After creating the basic system for updating and showing the stats, I began working on making the UI show the changes that selecting an attachment will make while you hover over it. This was made slightly harder because while working on the issues I was having with the automatic stat retrieval system, I forgot about implementing everything in such a way that would make it easier to implement this system.Previewing the changes attachments will make to the stats of the weapon |
Because of this, implementing this took longer than I had hoped, as I had to change a lot of the code. In the end, I was able to create the system that I wanted it takes the item that you are hovering over, and compares its values to the values of the attachment currently attached to the weapon. It will then change the colours of the bars or numbers dependent on the changes that would be made.
This was the last milestone that I had planned at the beginning of this project. this means that I am now able to move onto implementing some stretch goals, playtesting and fixing bugs.
The GitHub for this project is available here: https://github.com/ElliotChester/Modular-Weapon-System-Final-Project
References
Rainbow Six Siege. 2015. PC [Game]. UbisoftBattlefield 4. 2013. PC [Game]. EA Dice
Ghost Recon Wildlands. 2017. PC [Game]. Ubisoft
Comments
Post a Comment