Technical Report
Technical Report
Technical Report
Invicta Uncloaked
Multimedia Laboratories, 2014
C ONTENTS
1 Introduction
2 System Architecture
4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4
5
5
6
6
7
7
7
8
9
9
9
9
9
10
10
4 Use Cases
10
5 Prototype
11
6 Conclusion
12
1 I NTRODUCTION
This document refers to a project currently being developed in the course Multimedia Labs
with the name of Invicta Uncloaked. The latter consists of a multi-platform experience that is
going to make the users go around the city of Porto, allowing them to discover it while they
engage in a thrilling puzzle solving game.
Herein, the technical part of this project, namely, all its platforms and how they interact
with each other, is presented. The goal is to offer a great insight on the projects technical
implementation and to expose its most challenging technical issues.
Therefore, this document will later be used as the main reference for the implementation
of the project.
2 S YSTEM A RCHITECTURE
On its essence, the architecture will have Client-Server scheme, where the Client is the Android
application and the Server a Java Application running in a backend PC. Of course there are
other relevent aspects, such as the use of the Facebook API or the Database access that will be
described further in this report.
among other features. On top of this API, Facebook offers some SDKs that provide developers
with high level interface that these can use in their applications, but there is none aiming for
Java development.
Since it was decided that it would be a backend server to perform such operations
(obviously in response to each users actions) and it would be developed in Java (explanation
further in this report), there was the need to find an open-source code suitable for this purpose.
Thus, after a good amount of research and development of test implementations, it was
decided that the chosen one would be RestFB, due to its simplicity and capability of addressing
this specific issue.
In order for the messages posted by an application to be seen by other users, this
application must have been approved by the Facebooks team. This implies that the app must
meet several requirements like being harmless (in their standards) and having a proper logo,
even if the application is not going to be available for other users, as it happens in this case.
Of course, the users would have to be automatically invited to the mentioned Facebook
page and this would only be possible if there was another Facebook application just for this
purpose. Therefore, besides the application that allows the fictional users to make posts, there
would have to be another application, just with the privileges to invite real users to the group.
Zs
Thus, the Android application (see further on this report) would have to use the FacebookA
Android SDK, in order to allow the user to login and ask him for the privileges needed to invite
him to the group.
3.1.1 S HORT D ESCRIPTION OF THE FACEBOOK S API
In order for an application to interact with facebooks data, it must have an Access Token.
There are several kinds of Tokens, each one with different privileges related to what it allows
the application to do, and they can last up to two months before needing to be renovated. For
the purpose of this project, i.e. in order for an application to post messages on behalf of the
user, it must have an User Access Token.
The way through which these are generated is a bit complex (at least regarding the low
level API), however, since in this project it is needed only one Token for each of the fictional
characters, they can be "manually" requested using an application testing platform called the
Facebook Graph API Explorer every two months.
Once the application has these tokens, it must provide them to the Facebook API in
each HTTP request in order to perform the required operations.
Runs a QR Code activity, which is also responsible to send the current stage of the game
to the server;
Therefore the application constantly communicates with the server in order to inform it
about the user stage in the game and will be the basis of the user to server communication.
Definition 2. Activity
In Android programming context, an activity is an application component that provides
a graphical interface to the user (screen), in which the user can interact in many ways with
the phone. In the mentioned examples these ways are typing his personal data, reading the
information and taking a photo.
Therefore, an application is a set of connected activities and each activity contains also
the logic of the interfaces.
3.2.1 A PPLICATION G RAPHICAL U SER I NTERFACE
The graphical user interfaces of the application will consist of the following windows/activities:
1. Login activity as the first window with the fields email and password of the Facebook
account that the user should fill in;
2. Activity with information about:
Which clues the user has already found out, so he can better keep track of the story;
Guidelines/instructions of how to use the interface;
Button that the user should press everytime he wants to use the QR Code activity;
Button to Stop/Resume the experience;
3. QR Code activity, which consists, from the user point of view, of a camera and a button
that the user should press to take a picture to the QR Code. When finished the task, this
activity should return to the previously described activity.
3.3 QR C ODES
A QR Code consists of black modules arranged in a square grid on a white background forming
a pattern which can represent a code. The latter can contain a website URL, leading to it
directly, a text, allowing to see it automatically, or can be also be used to store bank account
or credit card information. A QR Code can also contain information such as phone numbers,
email addresses or other contact info.
A QR Code is read by an imaging device such as a camera, and thus smartphones are
typically used as a QR Code scanner, displaying the code and converting it to some useful
form. To do so, it is necessary to access the QR Code application in the smartphone and simply
point the camera to it.
Due to its user-friendliness and fast access, joining the fact that it arouses curiosity as it
has a imperceptible appearance, this technology was chosen as a way to provide clues and
also to trigger warnings inside the all project application reporting the actual stage of the game
in which each user is. This way it is possible to track what each user has already found out and
thus the QR Code acts as a checkpoint, allowing the system to trigger other actions.
From the user point of view, the QR Codes will trigger game actions such as playing a
video to the user presenting scenarios with clues.
In what regards the implementation of this technology, this solution would use an
existing android QR Code application. Thus, the projects application would implement a code
in one of its activities in the background to call the QR Code application, which would display
the video and return when finished its task.
3.5 S ERVER
The server is the main module of the system, were all the information is gathered and processed. It consists of a Java application, due to the simplicity and predefined libraries of this
language which are adequate to the goals of this project. Its main functionalities are:
Receiving the data sent by the users (Android applications), including their positions
and current states in the game and keep it updated in a database;
Checking whether two users are near each other;
Checking whether a user is near a QR code spot;
Interact with the Facebook API in order to make posts/send messages on behalf of the
fictonal characters, and always in response to the users positions, current state in the
game and proximity to other users;
3.5.1 S ERVER - A NDROID A PPLICATION I NTERFACE
The Android application and the server will be connected through sockets, as usual, in a
request-response scheme. Since the communication will be bidirectional, i.e., since there will
be requests made by the server as well as requests made by the application, it is a good practice
to use two sockets, on for the servers requests and applications responses and vice-versa.
In order to ease the process of separating consecutive requests or responses in the same
socket, there will be used ObjectInputStreams and ObjectOuputStream. These are classes that
are constructed on top of a stream (in this case a socket stream) and that allow to send objects
that are individually read on the other end of the communication. The objects sent will be
called request and responses and will have the following declaration:
byte messageType ;
S t r i n g userID ;
double l a t i t u d e ;
double longitude ;
byte gameStage ;
}
public c l a s s ServerMessage implements S e r i a l i z a b l e {
public byte messageType ;
// Defines type of the message
public S t r i n g nearbyUserID ; // User ID of a user that i s nearby (when
// applicable )
}
T YPES OF A PP M ESSAGES
Message 1 - Just an update on the users position - relevant fields: messageType, latitude,
longitude;
Message 2 - Change game stage - relevant fields: messageType, gameStage;
Message 3 - Resume Game - relevant fields: messageType;
Message 4 - Pause Game - relevant fields: messageType;
Importante note: This list might be changed further in the development of the project because
it is to soon to tell if there will not be needed more types of messages.
T YPES OF S ERVER M ESSAGES
Message 1 - Notification of a nearby player - relevant fields: messageType, nearbyUserID;
Importante note: This list might be changed further in the development of the project because
it is to soon to tell if there will not be needed more types of messages.
Since this website will have a simple structure, it will be developed using online tools
that generate HTML/CSS code for simplicity purposes.
3.9.2 P ROMOTIONAL FACEBOOK
With a function similar to that of the Promotional Website, but integrated in this social network
due to its ability to spread what people like to their friends.
3.9.3 Y OUTUBE T EASER
Similarly with the two already mentioned promotional platforms, the Youtube platform will
have a video in order to captivate people to join the game. The aim is to give a glimpse of what
the user will experience and hopefully let him curious and excited to be part of the challenge.
4 U SE C ASES
The use case diagram is described as follows:
10
5 P ROTOTYPE
The all project was exposed in this report, howeve, the lack of time to implement it all aroused
the need to choose only the technologies considered to be the most challenging from a
technical point of view and most differentiating from the user experience point of view.
As mentioned before, the most innovative part is the interaction with Facebook fictional
characters. Since the Facebook developers section is much more aimed to the SDKs mentioned
in this report, it does not provide a clear documentation (like a tutorial) regarding how the low
level API works, that would be easy for an outsider to understand. On the other hand, it was
not easy to find an open-source library due to the lack of documentation that makes it very
difficult to assess what each library can do and how to use it.
Thus, since the Facebook interaction is by itself a complicated issue for the reasons
already exposed above, it was chosen to implement this technology.
For this purpose there is the need to implement also the GPS service running in the
android application, since the automatic posts and messages depend on the users position.
In short, the prototype will contain the demonstration of:
Automatic posts according to the users location;
GPS tracking;
Application prototype (short version).
11
6 C ONCLUSION
In this report it was given a clear insight on the complete system which is the technical
foundation of the project. While this was done from a high level point of view, no important
technical details were left out of this document. Therefore, the level of definition that this
report provides, allows the projects implementation to have a clear path to follow, that is
however, opened to new additions or small changes.
12