3D Blender Portfolio of David Wehr

Custom Game Controller

Game
The game is very simple. You move a laser up and down to shoot targets. Each target has a random number of points which is multiplied by a decimal number between 1-2, depending upon how close you hit to the center. The product of those two numbers is added up to create you final score after one minute. I might later add better graphics and gameplay to the game.

Hardware
The real focus was the controller and communication. There is a spinning wheel and a button. Spin the wheel to move the laser up or down, and press the button to fire. The spinner is connected to a potentiometer to get the rotation. The fire button is just a simple switch. The switch and potentiometer are read by an Arduino and then sent over a serial connection(USB)

Communication
This was the toughest part. I had to make a way that the Arduino could send two separate values and have them read and identified by the computer. I used the pySerial module for Python that allows me to access the data sent through USB. The Arduino sends a constant stream of data, separated by spaces. The python script reads 15 bytes, and finds a full data packet (when it reads data, the first packet is usually only a partial one) It does some manipulation and separates the two values and assigns them to variables; one for whether to fire, and one for the rotation of the laser.

One response

  1. The word “messages” should be understood in a much wider range than just text messages. UnrealScript functions can have up to 16 parameters and each parameter can have one of many built-in and custom types. Replicated function calls can use almost the entire range of feature you can imagine. For parameters the same restrictions apply as for variable replication, with two additions: The entire function call with all parameter values must fit into a single network packet, and only the first element of a static array parameter is replicated, the others are set to their corresponding null value. If you hit the upper data size limit, you may have to find a way to break down the data into separate calls. If you need to replicate a static array, wrap it into a struct. This also makes passing it around in other cases much easier because structs can be copied as a whole, while static arrays cannot.

    January 22, 2013 at 10:19 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.