Make Your Logs Work for You

The days of logging in to servers and manually viewing log files are over. SolarWinds® Papertrail™ aggregates logs from applications, devices, and platforms to a central location.

View Technology Info

FEATURED TECHNOLOGY

Troubleshoot Fast and Enjoy It

SolarWinds® Papertrail™ provides cloud-based log management that seamlessly aggregates logs from applications, servers, network devices, services, platforms, and much more.

View Capabilities Info

FEATURED CAPABILITIES

Aggregate and Search Any Log

SolarWinds® Papertrail™ provides lightning-fast search, live tail, flexible system groups, team-wide access, and integration with popular communications platforms like PagerDuty and Slack to help you quickly track down customer problems, debug app requests, or troubleshoot slow database queries.

View Languages Info

FEATURED LANGUAGES

TBD - APM Integration Title

TBD - APM Integration Description

TBD Link

APM Integration Feature List

TBD - Built for Collaboration Title

TBD - Built for Collaboration Description

TBD Link

Built for Collaboration Feature List

Blog > Improve Live Ops for Games Using Papertrail

Improve Live Ops for Games Using Papertrail

Posted by By telliott on December 14, 2018

Live Ops is an ever-increasing practice in the gaming world. Games today often include multiplayer competition, events, the ability to trade items, and more. These require backend services and a platform team to set up and manage those services. They also require customer support to interact with players who experience issues and to make adjustments as needed. All these pieces need to be working flawlessly to deliver a good experience and retain players whom you worked hard to get.

When operating games, real-time data and monitoring are critical. Being able to track how and what players are doing is important for a long-lasting and exciting experience. A big part of that is monitoring operational problems with your game, whether from bugs in the app or backend servers that go down. With so many games readily available, hooking players early and finding out where and why they might be pushing a game aside in exchange for another is a critical part of making a successful game.

This tutorial will walk through on how to monitor Unity applications using SolarWinds® Papertrail™. We’ll show you how to add Papertrail to a simple example game called “Tanks!”, and how you can use it for Live Ops and improve your player retention.

PT-Improve-Live-Ops-1
Tanks! Is a two-player arcade game created in the Unity engine. © 2018 Unity Technologies, LLC. All rights reserved.

How Developers Monitor Games

The most common practice for monitoring a live service is thoroughly logging servers and client-side events. This allows developers to pinpoint the exact moment in time when a problem occurred and how to fix it. This helps save both time and development costs.

Telemetry and analytics are also important things to track. Knowing how many users your game has and how they are playing your game is important. Being able to analyze and make changes to increase retention is critical to having a successful game.

Combining both analytics and remote logging, it’s possible to pinpoint reasons why your player base may be dwindling, and how to fix the issue to create a better overall experience. For example, if you see a reduction in the number of active players that coincides with backend errors, the backend is probably to blame. Sending an alert to your operations team can help them quickly identify and address the issue.

It’s important to log enough information to paint a clear picture of what is happening in your game. Common events to log include:

  • Errors
  • Operational problems (e.g. connection issues)
  • Latency
  • Game state for player support

How Papertrail Can Help

Papertrail is a service that allows remote logging, searching, and analyzing those logs in real time. For games and apps that run on a number of devices, it’s important to have easy access to all the relevant logs and information needed to quickly iterate and fix bugs.

Papertrail integrates seamlessly with Unity to allow for a real-time view of all logs from any device anywhere in the world, all aggregated, searchable, and viewable in real time. This enables quick pinpointing of issues and debugging. It can also monitor for patterns of events and alert your team when there are critical problems in your game release or production environment.

Using the Papertrail Unity SDK

The Papertrail Unity SDK allows seamless integration between Unity’s logging system and Papertrail. All logs that already exist in a Unity application are automatically forwarded to Papertrail for recording and viewing them to help track down bugs, monitor player activity, or provide support to users.

Papertrail Account Setup

To get started, sign up for a free account to get access to an unlimited number of apps, and 50MB of logging a month. Once you’ve signed up, download the Papertrail Unity SDK from GitHub. (Requires Unity version 5.6.1+)

Tanks! Implementation Example

PT-Improve-Live-Ops-2
© 2018 Unity Technologies, LLC. All rights reserved.

This section will review how to implement the Papertrail SDK into Unity’s Tanks! sample game. Originally recorded at Unite Boston 2015, the Tanks! tutorial series teaches how to create a two-player shooter game. Subjects include simple game mechanics, integrating world and screen space UI, as well as game architecture and audio mixing.

Set Up The Project

1) Search for “Tanks! Tutorial” in the Asset Store, then download and import the project.

PT-Improve-Live-Ops-3
Tanks! project in the Asset Store. © 2018 Unity Technologies, LLC. All rights reserved.

PT-Improve-Live-Ops-4
Project Import Window. © 2018 Unity Technologies, LLC. All rights reserved.

2) If you aren’t following along with Unity’s tutorial, move the contents of the _Completed-Assets into the main Assets folder.

3) Open the _Complete-Game scene and press Play. The game can be played by moving the respective tanks around using the WASD or arrow keys, and firing with Spacebar and Enter.

SDK Setup

1) Import the Papertrail SDK into the project by navigating to Assets/Import Package/Custom Package… and select the downloaded *.unitypackage file.

PT-Improve-Live-Ops-5
Import the SDK package into the project. © 2018 Unity Technologies, LLC. All rights reserved.

2) Open the Project View and navigate to the Papertrail/Resources folder and locate the PapertrailSettings asset file.

PT-Improve-Live-Ops-6
PapertrailSettings contains configuration settings for the SDK.

3) Log into the Papertrail dashboard by pressing the Open Dashboard button or visiting https://papertrailapp.com/dashboard.

4) Locate the Add Systems button in the upper right.

PT-Improve-Live-Ops-7
Add Systems in the Papertrail Dashboard.

5) After entering the Add Systems section, locate the hostname and port at the top of the page, directly under Setup Logging and copy this information into the hostname and port fields of the PapertrailSettings asset.

PT-Improve-Live-Ops-8
Hostname and port are displayed at the top of the Add Systems page.

PT-Improve-Live-Ops-9
Copy the information into the PapertrailSettings configuration. © 2018 Unity Technologies, LLC. All rights reserved.

6) Papertrail logging is now set up. Any logs made using Unity’s Debug logging system will be automatically forwarded to Papertrail.

Adding Debug Log Messages

Next logs will be added into the game so that they can be viewed in real time in the Dashboard.

1) Locate the GameManager script in the Scripts/Managers/ folder and open it.

2) The following logs will be added into this script:

GameStarted

  • At the bottom of the Start() method, add the following Debug.Log
    PT-Improve-Live-Ops-10
  • Add the GameStarted log message © 2018 Microsoft Corporation. All rights reserved.

Round Started with round number

  • At the bottom of the RoundStarted()method, add the following Debug.LogFormat
    PT-Improve-Live-Ops-11
  • Add the round started log message © 2018 Microsoft Corporation. All rights reserved.

Round End with winner

  • At the end of the RoundEnding() method, add the following Debug.LogFormat
    PT-Improve-Live-Ops-12
  • Add the round ended log message © 2018 Microsoft Corporation. All rights reserved.

Game Exited

  • Below the Start() method, we will also add a new method using Unity’s OnApplicationQuit callback for when the user quits the game.
    PT-Improve-Live-Ops-13
  • Add the game exited log message © 2018 Microsoft Corporation. All rights reserved.

3) Save the script and return to Unity. Press play and the log messages will appear in the console window. They will also be sent to the Papertrail.

4) Return to the Papertrail Dashboard and locate the system by searching for the name entered in the PapertrailSettings asset.

PT-Improve-Live-Ops-14
Search for the System Name in the Papertrail Dashboard.

5) The logs will now appear as they happen in the Events view of the system.

PT-Improve-Live-Ops-16
Logs are sent to Papertrail in the background as the game is played. © 2018 Unity Technologies, LLC. All rights reserved.

PT-Improve-Live-Ops-15
Logs appearing in the Papertrail Events page.

You can see events streaming in real time to the Papertrail events page. As you can see in the video above, we’ve sent both the message and the stacktrace with each log event. Now you can quickly search these logs for specific events, like which round they are playing, or set an alert on error messages.

Monitoring is important for game success, and using Papertrail can make that step of the process easy. This will help you identify problems faster, retain more players, and spend more time making a great game! Sign up for a free SolarWinds Papertrail account.