Monday, July 27, 2009

Latest Flash UI changes

Final preparations for tomorrow's big show!
We added :
  • sounds in our application, allowing user to get auditive feedback
  • background and confirmation for hit sounds for improving the User Experience, creating an immersive experience who tries to transpose the user into the real wood atmosphere
  • self generating levels, allowing users to improve themselves beyond our ideas about their possibilities: the user gets 60 seconds levels in which he has to hit more and more animals as he becomes better in targeting ( and in ball retrieval :-) )
  • changed the aspect ratio of the game from 4:3 to 16:9 to better use the whiteboard's surface
  • we dropped a lower right sensor from our latest setup to improve the quality of sensor reading. The reason is that wooden board conducts very well the sound. Thus, too close sensors can receive same signal in almost the same moment, given false positive responses.
After some live tests with our entire platform configured, we noticed that sometimes the software interface between Arduino's serial port and Flash application freezes. Hope we'll not encounter this tomorrow!

Bellow is the final version of the application.


Sunday, July 26, 2009

Arduino-Flash communication

This week, we worked on connecting Arduino with Adobe Flash CS3 as well. Arduino cannot directly communicate with Flash. A communication protocol is needed which can create sockets for communication and can translate messages between the two. "Serial Proxy" is used for creating sockets. It is basically an XMLSocket server, a small program that runs
on pc and keeps a live connection between the serial port and Flash. This serial porxy server can be found at http://www.arduino.cc/en/Main/Software. A library of routines provides a wrapper around XMLSocket for making the communication code cleaner (
More information can be found at http://www.arduino.cc/playground/Interfacing/Flash). Communication between Flash and Arduino takes place on virtual serial port COM3 with port number 5333. Strings can be transmitted back and forth between Arduino and Flash. For our case, we are transmitting the sensor number as string -- the sensor which is hit by the ball. This string is converted to integer in Flash porgram and is utilized to kill an animal.


Enhancement to the hit detection

Earlier we had problem sensing the values from knock sensor correctly. Vibrations transmitted along the medium to which the sensors were attached (white board of lecture hall in BIT) were making it difficult for us to accurately determine the sensor which was hit by the ball. The estimation was 70-85% correct. However, we needed more accurate results for the game, since it would not be a fun game if an accurate hit is treated as a miss. We needed more than 95% accuracy. This week we changed the placement strategy of sensors and provided enough insulation among sensors. A thick layer of tissue papers was placed between sensor and the white board to absorb the transmission of vibrations from one sensor to another. This decoupling worked well and accurate estimation of hits became possible.

Moreover, we determined the criteria of exactly detecting the knock on the sensor. If the hit is in diameter of about 15 cm around the sensor, the values from other sensors are exactly 0. If hit is made somewhere between two sensors (outside this diameter), the nearest sensor gets highest value. The other neighboring sensors receive a value normally less than 10. This helped us in determining the hit accurately to about 98% of the time.

The figure shows a screen-shot depicting four sensors attached to the artificial wall.

Flash UI changes

Since last week the Flash application changed- I added support for numerical keys for hitting. We mapped the numerical keys 1 to 6 to the 6 animals positions that can be hit. This way, it is enough to press a key to simulate the throw of a ball.
The reason behind this application architectural change is that we needed an smart way to simulate the sensors that were hit, without actually having the entire setup in our workplace.
Also, a nice tweak in the application's ActionScript behind code allows it to easily be connected to an Arduino board.

Here is the new version:


Artifical Wall testing

Here is a video describe and document our testing process that we did before the exams for the artificial wall that we had built .

Saturday, July 18, 2009

The User Interface

This week we work also on the User Interface - the Flash GUI. It was challenging since neither me nor Loredana had previous experience in creating games under this application.
Because of this fact, we searched for some advices on the net and after quite a long trial and errors we found something interesting here . Even that it didn't met all requirements, this tutorial was what we needed to get a quick start.

The animal images are free clip arts taken from http://www.free-clipart-pictures.net/animal_clipart.html.

After following the steps and understood the concepts,we modified the application to :
  1. Change the resolution, as it has to run on a projector
  2. Redesign the entire scene graphics, but keeping basic elements like scoring and timer.
  3. Change the game's AI from
    • how many simultaneously balloons you can hit in a specific period of time to
    • having only one target available at one time and you can get another one only if you hit the current one
  4. Remove the old targets and create 6 new ones more appealing.
  5. Implement the Arduino interface classes taken from here.
After all this modifications, we present our visual part of the extraneous game (the resolution here was reduced to 400x300):



The application creates 4 spots in the bottom of the scene and 2 in the top to show randomly an new animal each time one is hit. This areas are hit areas designed to respond to phisical sensors placed on the back of the board on which the Flash Game will be projected.
Thus, the game will respond to user input (when he hits the board in a specific spot) by showing another random animal in a random spot.
For easy of testing, we kept also mouse interaction.