This dev diary will cover how we made our weapon and the game for Full Metal Barber. It will cover materials, technology and software we used in order to get everything to work.
The game in its current state is a toy, where you have to cut a persons hair using a minigun. The minigun is a controller you hold and aim with, in order to fire at a screen where you'll see the crosshair. Originally the game featured a shotgun, but we switched to a minigun after thinking about the experience.
The experience we are looking for, is a controller that feels good to use. We want a fair bit of heaviness to the weapon along with screenshake when firing in order to purposefully make the weapon imprecise to use. What we want from this game is for people to be able to cut weird hairstyles, and then upload an image of the hair on twitter.
Creating The Game
First of all we needed to make the shooting mechanic work, before working on everything else. While my teammates were off planning the build of the minigun itself, I sat down to create the game. First of all, I used a mix of scripts I already had and google to create a simple script that shoots using Raycasts. Raycasts are essentially invisible rays that can detect where they hit and provide a ton of information and uses doing so. Once this was ready, I had to make sure that when you fired the script would only react if you hit hair. This was done using Unity tags, and tagging a test object with the tag "Hair".
As you can see in the GIF above, there isn't a particle effect firing when I click anything else than the red ball. This was the basis for how we made the hair in the game.
We knew we needed a model to hold all the hair we wanted, and there was only really one place we knew where to get it. The Makehuman application. Makehuman is a program that let's you get a realistic looking human model for games or animations, fully rigged and entirely customizable. We made a simple, bald character in that program and imported him into Unity, where we started working on the hair to place on his scalp.
We weren't sure how we wanted the hair to work. We had long been brainstorming different ideas of using either shaders or a terrain hidden beneath his head, using grass as the actual hair and coding some sort of brush that would remove the grass in real time. We also had an idea for using a model of hair and looking into removing one vertex at a time. What we eventually settled for is having a small prefab (made from a sphere) that was called hair.
Whenever hair was hit by the raycast, it would burst into a particle effect, and fly off the head. This was created using the Rigidbody component on the hair prefab. When the prefab got hit, we immediately disable the kinematic option and enable gravity, as well as giving it a force push in the up direction of he object itself.
When it comes to placement of the hair we had multiple methods. The first one was to hand place each ball of hair (which in the picture below, you can see that it would take some time). Finally, our lecturer suggested using Polybrush. Polybrush is an addon to Unity that allows you to paint on models. The special thing with this is that you can paint prefabs onto models, as if you were paining trees onto a terrain. This worked fantastically for us since we only had to draw a hair and beard onto him, cutting time massively.
We then decided to add some juice/polish to the game by implementing screenshake and particles. The main effect of the screenshake is both to make it feel like your actually firing a minigun and trying to aim with it. We also decided to make hair fly everywhere to really emphasize that you're shooting off hair.
For planning we used the program TinkerCAD in order to create an idea of what the materials were and what it would look like. Granted, it looked nothing like it in the end but it was good for us to start thinking about materials early on.
When it came to material gathering, my Teammate Paul found a place called "Reverse Garbage" here in Brisbane, where you can find a ton of stuff for a low price. We decided to take a daytrip there, and see what we could find
We ended up finding almost everything we needed for our build here, and it only cost us a total of $10. We found some plastic pipes for the barrel, some pool filter, a box with a really nice handle that could hold the arduino board and an old vacuum cleaner handle for... the handle.
The Build Part 1
As soon as we got home from Reverse Garbage, we started to put it all together. First of all, we laid everything out on the ground so that we could sort of see how to assemble everything.
First of all we decided to work on the barrel of the gun. We weren't entirely sure how to attach the barrels to the filter, but we decided to just duct tape it for this first iteration of it.
We also very crudely taped the vacuum cleaner to the main component box, as well as moving its handle so that you could hold it. At this point we were very pleased with how it was looking and how it felt. Our only problem at this stage was connecting the heavy barrel to the very light component box.
The Build Part 2
After assessing our materials and what we had, we decided to remake the body of the minigun. We had access to an empty speaker, which looked really good and also could fit some sliding door rollers so that we could have the barrel spin inside it.
All we really needed at this point was a motor. We had been experimenting with an arduino board and a small motor, but we needed to transfer it to a bigger one and build it all into the gun for it all to work properly. Thanks to Paul spending many hours with the barrel, we managed to put it together and make it more sturdy.
After having tested with a few small motors, we managed to find the motor from a drill, which was quite powerful and heavy enough to provide some weight to the minigun. Below you can see the current state of the minigun after most parts have been attached.
So let me explain how it is all hooked up. the handle is screwed to the body of the minigun. Inside the handle are two alligator clips attached to the arcade button that acts as a mouse click. Inside the body is the Arduino Leonardo. This is also connected to the drill motor and the MPU6050 (Gyroscope/accelerator) that acts as the mouse movement. What isn't pictured above is the new barrel's that we are in the process of attaching. We are currently attaching lighter plastic barrels to make it easier on the motor to spin.
That is all for now! we will showcase this game at events in the future, so keep a close look at my twitter for more information. Two of them are Synergy at SAE Brisbane next wednesday, and Squiggly River Artscade at Netherworld in the near future.
Take care, and thanks for reading!