Networking component for Sony PlayStation Vita game (t@g)
We have been commissioned by a Leeds-based digital agency to provide them with specific support in the development of a game for the Sony PS Vita (follow this link to link to its official UK website). Our involvement consists in the design and implementation of the games specific networking components on the Sony PS Vita.
The Ashley Bolser Agency is developing an augmented reality game called t@g. This game will make use of the great graphic capabilities of the Sony PS Vita to provide players with the ability to design their own tags before allowing them to place them virtually anywhere through an intuitive augmented reality interface. Through progression, players will be able to obtain more font types, shapes, paints, etc etc, in order to design more elaborate tags, and more importantly to share them with their friends! Since every tag is geo-localized, players will be able to see each-other’s tags in situ through the augmented reality screen.
The nature of the game itself means that the networking component is one of the critical component of the t@g game: network connections are required extremely often, to both Sony specific servers and game-related servers, and a lot of data needs to be transmitted each time (image files and games data), meaning a dedicated compression tool had to be developed and integrated to reduce file sizes before transfer.
Even though the Sony PS Vita SDK provides support for HTTP/HTTPS, the key was to design an intermediary component to interface between the UI engines components and the Sony Networking components.
An important step was the definition of all the HTTP queries (POST, GET) between the t@g game and the game servers, complete with the integration of an XML parser in the game. A JSON parser was also added to allow for integration with Facebook, allowing for players to post directly onto their Facebook wall.
Here’s a high-level view of the overall architecture solution:
- An XML parser
- An LZ77 compression engine
- A networking interface comprising of:
- A dedicated Sony NP networking interface
- Bespoke REST client for game data
- A JSON parser to take care of Facebook messages
Some key design considerations:
1. Compartmenting the network requests
The networking components were designed in a modular way so that Sony specific network requests and internal servers specific network requests (through Representational State Transfer (REST) requests (mainly (HTTP GET and HTTP POST)) would be isolated from one another, however still using common networking components.
2. Optimizing their numbers
In order to efficiently use the networking interface, calls to it are reduced thanks to smart caching of data on the device, making sure that information is only requested once per session, whilst in-game notifications ensure that the data is kept up-to-date.
3. Reducing the amount of data sent using compression libraries
Sending images across a wireless network (WiFi or 3G) is a costly (time and money) event for a user, so a compression library based on the LZ77 algorithm was implemented in order to compress data prior to sending it across the network, hence reducing dramatically the size of the objects transferred (80% size reduction for image files).
4. Ensuring that the network ran in its own thread
In order to provide the user with the best possible experience when using the game, the networking components had to be configured to run in their own thread, meaning that the game thread would continue to run uninterrupted when network requests were made.
We also followed up with integration and support of the delivered components. Contact us for more details!