Barrel Roll

This project uses Unity3D an Arduino Micro. C# is used for the gameplay logic, the custom controller logic uses C++.


Project summary

During my second year at university, we got a new assignment that was very similar to a game jam. We were given 48 to 72 hours to work on a game. This game had to incorporate a certain theme. This project was all about exploring new and funny ways to control games. We built a custom controller that was used to balance the player while running through the level. I mainly worked on the electronics and the communication between Unity3D and the Arduino in the custom controller.

Most important things I learned

  • Implementing an Arduino to Unity3D serial communication interface.
  • Build a controller using various materials and electronics.
  • Serial communication in C# and C++.
  • Rapid prototyping and iterative design.

Role:Embedded & Gameplay Programmer
When:2018
Duration:3 weeks
Skills:C++, C#, Electronics, Arduino, Serial Communication
Software:Unity3D, Arduino IDE, Visual Studio
Team size:8 team members

Exploring new ways to control games

This game is all about skill. Grab our custom controller and try to be the fastest pig of the wild west! The video below shows the core gameplay. It does not look that great, but that is because this is a video of an early version of the game. Sadly, we lost a level due to a messed up ignore file in our version control folder. This is why the pig is untextured and why we are missing some assets for the level. Since we only had two weeks to build this game, we were unable to recreate the level again.

Anyway, enough talking, the video still shows off the gameplay really well. Enjoy!

The goal of the project

This project was part of three other projects we made. The main focus of this project was to experiment with custom controllers. The core of the controller is an Arduino Micro. This microcontroller was a perfect fit for the project, as it was rather small, yet capable of sending data to a computer via the serial port.

Although I enjoy game programming in general, the custom controller posed a nice challenge so I am happy that I decided to work on that instead.

Summary of my tasks

The total time allocated for this project was two weeks, give or take. The team consisted out of 8 members, 6 of which ended up working on the project until it was finished. Due to this short time-span, we had to manage our tasks well and adjust our planning when needed.

Over the years, I had already been experimenting with electronics, microcontrollers, and microprocessors. This knowledge came in handy for this project, as it allowed me to focus on the end result without having to worry about doing research into the Arduino platform and the like.

Even though I worked a bit on the gameplay, I was mainly working on the controller. A fellow programmer designed the controller (and built it out of wood). I was responsible for the electronics and Unity integration.

The engine of choice for this project was Unity3D. In the end, this turned out to be a perfect choice. Because of the C# support in Unity3D, I could take advantage of the SerialPort class. This allowed me to poll the Arduino and read the contents of the serial port on the computer.

First working prototype of the controller

Due to the time constraints of this project, we first built the controller out of cardboard. This allowed our design team to quickly get a feel for the controller before deciding what to do with it (scrap the idea or refine it). It turned out to be a big success, we decided to work out the prototype of the controller and turn it into a solid piece of hardware.

Replaced the cardboard structure by wood

After a couple of days, a team member of mine had finished the wooden box that would house the controller. I made the “barrels” out of empty paint cans and a threaded M8 rod. This is held in place by a few nuts and skateboard bearings. Due to the weight and high-quality bearings, the cans were easy to rotate and felt great to play with!

Final result

The sensors and the Arduino microcontroller are being held in place by duct tape. This is far from perfect, but it gets the job done. If I would have had more time to build this, I would have made sure to secure these components with glue instead of tape. We just happened to have duct tape readily available.

Testing the controller at university

We managed to finish the project in-time. There was some time to do a bit of playtesting, so that was really nice. We got some valuable feedback that day. One of the things that people appreciated was that the controller was built out of wood. It made our controller feel sturdy and allowed the players to play the game without having to worry about breaking anything.

Achievements

I learned a lot during this project. Most notably how to build a custom controller and use it to interface with an application. The build process was a lot of fun and while the controller was not that accurate, I am proud of the end result. It works pretty well and it is extremely sturdy.

During the development cycle, we had to constantly change little things and adjust parameters in the game to make the gameplay feel good. These constant iterations on the design led to a way better end product. We were lucky that we “finished” the project in-time because it allowed us to further improve the balance of the game.

This project was my first real Unity3D product. While I did not know a lot of C#, I never felt lost. The documentation is really good and the forums are helpful. The engine uses C#, which made it really accessible for new users. I quite like this engine and will probably use it for future projects.

Challenges

Halfway throughout the project, some of our team members left the team. This was unfortunate, as we had to scrap some (minor) features from the end product. It forced us to reevaluate the scope of the project and choose which features were no longer worth pursuing. All things considered, I think we did a decent job. The project was in a working state after 48 hours.

Because we were lacking some manpower, we had to change the planning a lot. It has taught us a lot about how to determine a realistic scope for the project, as well as how to deal with setbacks and the like. We used the agile SCRUM workflow, so it was not too difficult to change the planning.

Leave a Reply

Your email address will not be published. Required fields are marked *