游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

从开发者角度谈导致手游加载缓慢的3大原因

原文作者:Joseph Lewis 译者:Megan Shieh

游戏上线以后,开发者就会陆续收到来自玩家的评论,在这些评论中可能会出现类似“这款游戏加载太慢了”的字眼,这类抱怨较为常见。游戏的性能十分关键。大量的研究和实际经验告诉我们:移动用户在面对性能缺陷的时候,非常没有耐心。此外,用户对游戏的第一印象至关重要。

但是如果有用户抱怨你的游戏太慢了,下一步该怎么办?是什么在拖慢手游的加载速度,我们该如何解决这个问题?

cut the rope(from vicffie.blogspot)

cut the rope(from vicffie.blogspot)

首先,我们得了解你所面临的一些自然挑战。大多数移动应用程序都仍在使用TCP,TCP是最常用的互联网协议之一。虽然TCP对于30年前创建的有线网络而言效果不错,但是把它放到移动设备上的时候,却存在严重的局限性。TCP协议主要有三个缺点:一是传输效率低,二是不能有效地处理丢包问题,最后一点是它不能正确地处理IP地址的变化。

除了TCP的局限性和无法控制的移动网络条件之外,还有一些其他的因素会影响移动游戏的性能,你可以而且应该修复这些问题。下面让我们来看看一些最常见的问题,以及避免这些问题的方案。

1) 配置错误的缓存

虽然缓存可以帮助加快应用程序的用户体验,但你得配置对了才能真正带来好处。简单地说,游戏缓存的内容同时也会附带服务器的相关指令——从源服务器重新获取副本之前,这些内容应该在用户的设备中储存多长时间。频繁更改的内容应该储存较短的时间(例如,周末促销用的图像只需要存一个周末就可以了),而不频繁更改的内容则应该储存较长的时间。

开发人员通常会将它们设置为默认值,或者将所有内容都设置为短时间储存。这样的话,往返原始服务器的次数就会更多,因而用户等待内容的时间就会更长。

2) SDK

如今,平均每个安卓应用程序都安装了15个不同的SDK。这些SDK都有用,它们可以提供各种各样的服务,比如分析、崩溃日志、支付处理等其他重要功能;但它们也会对应用程序的性能产生很大影响。

使用第三方服务的SDK是一种为游戏添加功能的简便方法,但它们会使应用程序依赖于超出你的监督或控制范围的服务器和服务。如果一项服务速度慢,或者掉线了,会给你的用户带来糟糕的体验。用户不会在乎出错的是你还是第三方服务,他们会直接把责任归咎到应用程序身上。SDK发出多个或频繁的请求可能意味着更长的CPU时间,移动设备发送和接收数据的时间也会变得更长,这不仅会影响到性能和速度,还会影响到电池寿命和用户的流量。精细化地管理安装在应用程序中的SDK,以确保用户拥有尽可能好的游戏体验。

一种特殊的常见SDK–广告网络SDK—会带来一些特殊的难题。许多广告网络也是转售商,这意味着你可能无法知道每个广告的来源,或者你可能会意外地通过正在使用的同一个网络来为新的供应商提供广告服务,从而导致了性能的突变。问问你的广告网络提供商,他们采取了什么措施来保持最好的性能?如果有一个网络正在持续地影响应用程序的速度,那么尝试着把这个SDK删掉或者降低它的优先级,看看它是怎么影响游戏的整体性能的。

3) 处理内容的效率低

另一个常见隐患是,应用程序单次加载的内容量。它会因为各种不同的原因而影响到程序的速度:可能是在加载尚未在屏幕上显示的内容;也可能是在加载对移动设备而言,优化不佳的资源和图像。例如,当移动应用程序正在请求超高分辨率的图像时,就会发生加载缓慢的情况,因为这些图像最终也还是会在UI中被按比例缩减。市面上有这么多款不同的设备,以及随之而来的多种屏幕尺寸,确保你所提供的图像与用户的屏幕大小吻合,这点很重要。有许多的服务和解决方案可以帮助你处理这一问题。但重要的是要确保它们的配置正确,并且不要让应用程序在移动设备上重新调整大小。

最重要的是,了解你的应用程序

现在我们已经知道了导致游戏加载缓慢的一些原因。那么,在影响用户体验之前,我们如何能够实时地检测性能问题并排除故障呢?有效跟踪移动应用程序性能的一种方法是:使用“移动应用性能监测工具”(Mobile Application Performance Monitor,APM)。市面上有多种APM可供选择,最好是选一个专门针对移动应用程序的APM,它还需要带有警报系统和基本的控制功能。监测应用程序的实时性能,了解哪些URL在导致错误,更好地排列它们的优先级,这是管理应用性能的最佳方法之一。它还能帮助你提前发现问题,避免用户差评。早早发现问题,早早解决。

本文由游戏邦编译,转载请注明来源,或咨询微信zhengjintiao

You’ve finally done it. After all your effort and hard work, your mobile game is live. At last, gamers are going to experience with your creation. But then it happens. The user reviews start coming in, and they aren’t pretty. “This game loads too slow!” is a common complaint, but you don’t have any insight or metric to help determine WHY it’s slow.

Performance matters. A growing mountain of research and real-world experience tells us what you can probably already guess: mobile users are very impatient when it comes to performance, and you really only get one shot at a first impression.

But if your users say your game is slow, what next? What makes a mobile game load slow, and what can be done to fix the problem?

The first step is to understand some of the natural challenges you’re up against. Most mobile apps are still using TCP, one of the most commonly used internet protocols. While TCP is perfectly fine for wired networks that were created 30 years ago, it has serious limitations when used for mobile devices. TCP has three main drawbacks: It uses available network bandwidth inefficiently, it handles packet loss ineffectively, and lastly, it can’t handle a change of IP address properly. All of these are common issues on mobile networks and require a different, mobile-centric approach.

Beyond the limitations of TCP and uncontrollable mobile network conditions, there are other factors that can compromise a mobile game performance, which you can and should fix. Let’s take a look at some of the most common issues, and what you can do to avoid them.

1. Incorrectly Configured Caching

While caching can help speed up your app’s user experience, it needs to be properly configured in order to actually confer a benefit. In simple terms, content being cached comes with instructions for the server about how long a copy should be cached before it needs to be re-fetched from the origin server. For content that changes frequently, this should be an appropriately short value (the images for a weekend sale or similar event need only be cached for the length of the event, for example) while content that doesn’t change frequently should have a longer value.

Often, developers leave these values set as a default, or use the same, shorter time for all their content. This results in more round-trips overall to the origin server, which translates to more waiting for content for your users. You can find more detailed information on caching and how to configure it in this blog post.

These days, the average Android application has 15 different SDKs installed. These SDKs are useful, providing valuable services like analytics, crash reporting, payment processing, and other important functions, but they can also have a big impact on application performance.

SDKs that make use of 3rd party services are a convenient way to add functionality to your game, but they leave your app relying on servers and services beyond your oversight or control. If a service is slow, or goes offline, it can lead to a poor experience for your users, who don’t care if the problem is with your app or some 3rd party service used by your app. SDKs making multiple or frequent requests can mean more CPU time, and more time that the mobile device is transmitting and receiving data, which can impact not only performance and speed, but also battery life and your user’s data plans. Careful management of the SDKs installed in your application is an important part of ensuring your users have the best possible experience with your game.

One specific and common type of SDK – advertising network SDKs – come with their own specific sets of challenges. Many ad networks are also resellers, meaning you may not always know for sure where the ads in your game are coming from, or you may suddenly be serving ads from a new provider through the same network you’ve been using, leading to sudden shifts in performance. Ask your ad network provider what measures they’re taking to keep performance at a maximum, and if a network continues to affect your app’s speed then try removing their SDK or reducing its priority and seeing how it affects your overall game performance.

3. Inefficient Asset Handling

Another common pitfall affecting app performance is simply how much content the app is loading at a time. This can happen for a number of reasons. It might be loading content that isn’t displayed on the screen yet, or it might be loading images and resources that are poorly optimized for mobile devices. This happens when apps are requesting desktop-resolution images that are going to be scaled down in the UI anyway, for example. With so many different devices and the myriad of screen sizes that comes with them, it’s important to make sure that you’re serving images that are an appropriate size for the screens that will be displaying them. There are a number of services and solutions that can handle this for you, but it’s important to make sure they are configured correctly, and that your solution isn’t handling the resizing on-device.

Most Importantly, Know Your App

Now that we know some of the causes for game slow load times, we’re back to the question: how can you detect the performance issues and troubleshoot them in real-time, before they affect your app’s user experience? One way to easily gain insight into your mobile app behavior is to utilize a Mobile Application Performance Monitoring (APM) tool. There are a lot of options available, but here, too, it’s essential to utilize a mobile-first APM and look for one that offers alerts and basic control features. Knowing how your app behaves in real-time, what url’s are causing errors, and how to prioritize them better is one of the best ways to start getting a handle on your app’s performance. It will also help you find out about problems faster, before you start hearing about them in negative app store reviews. (Source:www.gamasutra.com


上一篇:

下一篇: