Showing posts with label gaming. Show all posts
Showing posts with label gaming. Show all posts

Saturday, December 31, 2016

Making a Custom PC Gamepad with Arduino



What: Making a simple gamepad from an Arduino that you can use on the computer

Why: I wrote another article earlier this year about using the RXTX java library involving basic communication with a computer and finally got a free weekend to make an even better project using that same tech. Furthermore, a Twitch streamer by the handle 'Rudeism' has become well known for using a 'Makey Makey' microcontroller in video games, and it should be noted that he inspired me to finally get working on my own fun game controller.

Required: 
- Arduino, Arduino IDE
- Switches, buttons, and/or joysticks
- Computer
- Java
- RXTX Java Library
- Code available on my Github

Notes: For this tutorial, I am using an old analog computer joystick. It used a gameport adapter, but I have since cut it off so I can get at the wires directly. The important take away is that I have wired the outputs from the potentiometers of the joystick directly into the analog input pins of the Arduino. Further, the buttons from the joystick are also wired directly into the digital input pins. The program files available for this tutorial assume only two axes and two buttons. If you want to make a more complicated gamepad, I encourage you to do so; the concept is the same. 

I am using an Arduino Uno R3. The Uno does not have native HID support which is why we need the Java program on the computer. The joystick I am using an old InterAct Raider Pro Digital that I found while thrifting. This tutorial does not require flashing the Uno’s core firmware.

Brief: The basic idea is that the Arduino will receive the inputs (either digital or analog) from a button or joystick you have and send it over the serial connection to your PC. The PC will then parse that input into something actionable. Using the Java ‘Robot’ class, your Java application will move the mouse, click a button, or enter a keystroke. Here is an abstract diagram for how it should work:



Steps:

1. Connect your switches, buttons, and potentiometers to the Arduino


[x-axis potentiometer signal] -> [analogPin0]
[y-axis potentiometer signal] -> [analogPin1]
[trigger button] -> [digitalPin3]
[thumb button] -> [digitalPin4]
[GND] -> [GND]
[5v] -> [5v]

2. Upload the Arduino sketch
     View my sketch example video HERE.

3. Run the Java application
     That's it! Your potentiometer inputs now drive your mouse, the trigger button is a left click, and the thumb button is a right click.

Troubleshooting:

-If you need more help with the RXTX library specifically, please refer to my previous article on using the library HERE.

-If you have questions about the process or this project in particular, post a comment and I'll try to help you out.

More process photos:
(Testing direct connections)

(Connections soldered and labeled)

(Ready for game testing)

Saturday, December 17, 2016

The Costs of Developing Games

I've been working on a simulator/game, and decided to investigate how much it would actually cost to deploy to as many platforms as possible. The platforms I investigated were the following: Xbox One, PS4, Wii U, and iPhone. My simulator wouldn't actually be appropriate for the iPhone given the system constraints and minimal points of interaction available to the user, but I included it for completeness. The areas I have considered in my investigation are the following: development kit, developer registration, listing fees, patch fees, and perks.

You'll find that most of the tangible costs, like price of dev kits and registration, are actually undisclosed, but we can guess at these costs based on user testimonials from various threads and online forums. Where applicable, I have posted links to any sources, though due to the limited lifetime of forum threads, forum links are not provided.

Xbox One / UWP
The costs of developing for the Xbox are a little more complicated since Microsoft has been pushing a unified platform dubbed "UWP." This means that the costs for developing a game on Windows are very similar to that of a game on Xbox, but the development kit costs change. If you are developing for Windows, you need a Windows computer. If you are developing for the Xbox, you'll need an Xbox. Here is a breakdown of the costs I was able to source:

  1. Development Kit : Xbox One console = $250.00
  2. Developer Registration: One time fee  = $19.00
  3. Listing Fee:                                           = $Estimated at 'couple hundred'
  4. Patch Fees:                                            = Free as of 2013
  5. Perks:                                                     = Two free development kits (Qualified independent developers)
The listing fee probably varies based on the studio budget, but if we estimate 'couple hundred' to have a ceiling of $200 dollars, the total cost of developing a game for the Xbox One is $469.00. This doesn't account for multiple development kits, but if you are a qualified independent developer, the price could be as low as $219.00 since you would get the kits for free.

Playstation 4 
Most of the price for developing on the PS4 is going to come from the development kit since you cannot currently turn any PS4 unit into a dev system like you can with the Xbox One. Let's take a look at the breakdown.
  1. Development Kit: PS4 Dev Console               = $2,500.00
  2. Developer Registration: Online Registration   = Free
  3. Listing Fee:                                                      = Unknown
  4. Patch Fees:                                                       = $10,000.00
  5. Perks:                                                                = First two patches are free. Free ESRB ratings
Right off the bat, we see that the cost of the development kit is already $2000.00 more than the Xbox One. Unfortunately, I could not find any information on the listing fee for selling your game through their online marketplace, but based on the other numbers, it is likely to be relatively expensive. Given the numbers I could find, I am going to conclude that the total cost of developing a game for the PS4 is probably about $2,500.00 to $3,000.00. However, if you are indie developer, you may be in luck. I found multiple accounts of forum users claiming that Sony was generously lending indie developers a free PS4 dev kit for the first year.

Wii U
Nintendo's next console is actually the Switch, but since it is still very new, there was not much information I could find on the price of developing for that system. Instead I will look at the Wii U where more information on development costs was available.
  1. Development Kit: Refurbished = $1,500.00
  2. Developer Registration:            = Unknown
  3. Listing Fee                                = Unknown
  4. Patch Fees:                                = Free
  5. Perks:                                         = Unity Pro License
Unfortunately, there are quite a few unknowns when looking at developing for the Wii U, but the development kit costs were probably the easiest to find compared to the other systems. If you are not buying a refurbished kit, the price rises another 1,000.00. Overall, if we assume that the registration and listing fees are free, the total cost of developing a game for the Wii U is about $1,500.00.00 with zero patching fees.

iPhone
The iOS platform is a very different system than the other platforms since the gaming system is essentially a hand held device. With the physical limitations comes limited hardware capabilities. None the less, let's look at the numbers I was able to source for developing a game on iOS:
  1. Development Kit: iPad/ iPhone = $200.00 - $600.00
  2. Developer Registration:             = Free
  3. Listing Fee                                 = $100.00 /Year
  4. Patch Fees:                                 = Free
  5. Perks:                                         = External test users (up to 200)
Developing for the iPhone or iPad seems to carry the lowest cost, but it is also the only platform that I could identify as having a recurring cost. The listing fee for applications and games is written as $99/yr, but it was unclear if the developer was responsible for paying the annual price after original game/application submission. Even with the recurring fee, developing for iOS appears to carry the lowest cost and the total cost of developing a game for the iPhone is about $300.00 if you are using a cheaper iOS device.

Hopefully you found this as informative and interesting as I did, and that it helps fellow developers make informed decisions about the platforms they choose. For my simulator, I will likely develop for the Windows platform first, and then expand if it makes sense. 

If you have more recent information on the costs associated with developing a game for various platforms, please contact me, and I would be happy to update the information provided above.