The Basic Components of Hardware Integration
Don't get involved in partial problems, but always take flight to where there is a free view over the whole single great problem, even if this view is still not a clear one.
I suppose the first question to answer would be: why create custom hardware?
It's a valid question, as peripherals have a bit of a spotty history when it comes to games. Some live fondly in our memories, such as the Guitar Hero guitar or the Rock Band ensemble. Others are simply remnants of an ambitious but ill-executed pursuit. I'm looking at you, Power Glove.
However, the fact that the Guitar Hero controller has such a beloved place in our gaming repertoire shows that a piece of hardware, designed carefully with improving the game experience in mind, has the ability to elevate our perception of the game itself. Moving out of the home market and into location-based entertainment such as arcades, you run into a longtime favorite of mine: Dance Dance Revolution. Abstracted from a control scheme that utilizes your feet, it becomes a fairly dull experience.
Taking this into account, it should be clear how much potential exists for well-executed peripherals designed to enrich our virual sojourns. The immersion level is already heightened, and so the opportunity to add depth pushes that to a whole new tier.
But how do we get started with this whole process?
Anyone who has even a cursory understanding of the game development world today is aware of the main pair of heavy hitters. On the one side, you have Unreal, with its amazing product synergies and addons, and on the other you have Unity with its ease of access and massive asset collection.
I have all due respect for Unreal, both in its current innovations and historical place, but I am opting for Unity for one main reason: Unreal is extended by using C++, and Unity's scripts use the more accessible and forgiving C#. This is really the main thing that has kept me with Unity for a long time, as if you are familiar with the scripting, you can generally get something out that works fairly quickly while having a wide breadth of expandability options.
The best news? If you have existing experience using Unity to make games normally, then adding custom hardware is a fairly simple task. That is, the complexity depends on the nature of what you want to build, but the actual integration into your game can sometimes be handled with minimal scripts. We'll dive more into what I mean by this when we're looking at real projects.
All that out of the way, that brings us to the part of hardware development that many game developers may not be as familiar with: the hardware interface device.
There are a great many different controllers for robots and other physical devices. Essentially, each of them is in itself a computer; some are decidedly more complex than others, but each of them is designed to provide a sort of "brain" for your project.
One of the most well-known, as well as largely available at a low price, is the one that I will be using. This one is known as the Arduino, and it is described on the official site as "an open-source electronics platform based on easy-to-use hardware and software." This means that it is widely accessible and perfect for smaller projects such as our first one here on the site.
In our case, the starting point will be the model called the Uno. It is a basic model that will only set you back (as of this writing) about $23.00. It can be purchased on the official site, and if you're so inclined you can actually find a third-party knockoff for as low as 11 dollars.
But what does this bare little board actually do in regards to our goal of integrating it with Unity? That is a question whose answer lies primarily in your creativity. The Arduino can move motors, activate LEDs, receive input from potentiometers, and so much more. But even just with the board alone, you can do the most important thing…establish a serial connection with our Unity space. Everything else is an expansion and refinement on this.
The nature of this connection is what we'll be looking at next. It is probably the simplest communication method between devices, but at the same time, comes with some interesting and frustrating idiosyncratic behavior.
Stay tuned! The follow up will be here as soon as we can crank it out!
© 2021 Prodigia Games/Gareth Hewes