Institute of Computer Science
  1. Courses
  2. 2019/20 fall
  3. Mobile Computing and Internet of Things (LTAT.06.009)
ET
Log in

Mobile Computing and Internet of Things 2019/20 fall

  • Main
  • Lectures
  • Labs
  • Homeworks & Home Assignments
  • Projects
    • Teams & Topics
    • Presentations & Report
    • Grading & Submission
  • Google Group
  • Task submission
  • Results
  • Other

Home Assignment 2: Multiplayer Pong

In this task, we will create a 2-player Pong game. The game is displayed on the Android device screen, player controls 1 their paddle with the smartphone sensors, while player 2 controls their paddle from ESP32.

Game UI & Physics (5 pts)

  • Draw the game UI: the ball and two players.
    • Use a custom view and canvas drawing to display the game UI and create game physics
    • See Lab 11 for more about custom views
  • The ball should collide with the player paddles and top,bottom screen edges.
  • The ball should be reset to the center of the screen if it runs out of bounds (left or right edge).
  • The intersects() method is helpful to check for collisions in some of the cases.

Accelerometer control for player 1 (3 pt)

  • Use accelerometer input to control the player one (left) paddle
    • For this task, you can only account for 1 accelerometer axis.

MQTT + ESP32 control for player 2 (7 pts)

  • Host a MQTT broker on your development machine (1 pt)
  • Use a MQTT client on Android that accepts messages on a topic and translates them to movements for the 2nd players (right) paddle (3 pt)
  • Create a Arduino/ESP32 MQTT Client that sends messages to the broker based on ESP32 touch pins (3 pt)
    • The ESP32 has capacitive Touch Sensor pins, which can sense variations in electrical charge - including when touched by human skin. Not all pins can be used as touch sensor. On ESP32, pins 32 and 33 can be used for this task. See here for more info.

Both players should be able to move up, down, or stand still.

Other requirements

  • Lock the screen orientation to landscape mode for this assignment.
  • Remove the action bar of the app
  • Closing the application / re-opening it should not cause any unexpected crashes

General tips:

You can base the refreshing of the game UI, physics & state on the accelerometer update events - they happen frequently enough & at a constant rate to make the game feel responsive.

From a game development perspective, the usual approach (not needed for this task), would be to implement a game loop.

Submission

In your submission, submit both Arduino and Android code.

  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment