- Practical guide to optimization for mobiles
- Мобильные устройства не созданы одинаковыми
- Оптимизацию не следует считать последней стадией разработки проекта
- Optimization: not just for programmers
- Design your game for a smooth runtime
- Профилируйте на ранней стадии и почаще
- Unity Profiler
- Internal profilers
- Practical guide to optimization for mobiles
- Мобильные устройства не созданы одинаковыми
- Оптимизацию не следует считать последней стадией разработки проекта
- Optimization: not just for programmers
- Design your game for a smooth runtime
- Профилируйте на ранней стадии и почаще
- Unity Profiler
- Internal profilers
- Практическое руководство по оптимизации для мобильных
- Мобильные устройства не созданы одинаковыми
- Оптимизацию не следует считать последней стадией разработки проекта
- Оптимизация: Не только для программистов
- Планируйте игру так, чтобы во время исполнения она работала “плавно”.
- Профилируйте на ранней стадии и почаще
- Внутренний Профайлер
- Внутренний Профайлер
Practical guide to optimization for mobiles
This guide is for developers new to mobile game development, who are probably feeling overwhelmed and are either planning and prototyping a new mobile game or porting an existing project to run smoothly on a mobile device. This guide should also be useful as a reference for anyone making mobile games or browser games that target old PCs and netbooks.
Optimization is a broad topic, and how you do it depends a lot on your game. Because of this, this guide is best read as an introduction or reference rather than a step-by-step guide that guarantees a smooth product.
Мобильные устройства не созданы одинаковыми
The information here assumes hardware around the level of the Apple A4 chipset, which is used on the original iPad, the iPhone 3GS, and the third generation iPod Touch. On the Android side, that would mean an Android phone such as the Nexus One, or most phones that run Android 2.3 Gingerbread. Most of these devices were released around early 2010. Out of the app-hungry market, these devices are the older, slower portion, but they should be supported because they represent a large portion of the market.
For an overview of Apple mobile device tech specs, see documentation on iPhone hardware. The very low-end Apple mobile devices (such as the iPhone 3G) and the first and second generation iPod Touches are extremely limited, and even more care must be taken to optimize for them. However, there is some question as to whether consumers who have not upgraded their device will be buying apps at all. So, unless you are making a free app, it might not be worthwhile to support the old hardware.
There are much slower and much faster phones out there, and the computational capability of mobile devices is increasing at an extraordinary rate. It’s not unheard of for a new generation of a mobile GPU to be five times faster than its predecessor. That’s incredibly fast when compared to the PC industry.
Оптимизацию не следует считать последней стадией разработки проекта
British computer scientist Michael A. Jackson is often quoted for his rules of program optimization:
“The first rule of program optimization: don’t do it. The second rule of program optimization (for experts only!): don’t do it yet.”
His rationale was that, considering how fast computers are and how quickly their speed is increasing, there is a good chance that, if you program something, it will run fast enough. Additionally, if you try to optimize too heavily, you might over-complicate things, limit yourself, or create bugs.
Однако, если вы разрабатываете мобильные игры, есть еще одно мнение: аппаратное обеспечение, представленное сейчас на рынке, сильно ограничено по сравнению с компьютерами, которые мы используем для работы. Поэтому высок риск того, что ваша ваша игра не будет работать на большинстве устройств и оптимизацию рекомендуют делать с самого начала разработки.
Throughout this guide, we will try to point out situations where an optimization would help a lot, versus situations where it would just be frivolous.
Optimization: not just for programmers
Artists also need to know the limitations of the platform, and the methods that are used to get around them, so they can make creative choices that pay off without having to re-produce work.
- More responsibility can fall on the artist if the game design calls for atmosphere and lighting to be drawn into Textures instead of being baked.
- Whenever anything can be baked, artists can produce content for baking instead of real-time rendering. This allows them to ignore technical limitations and work freely.
Design your game for a smooth runtime
These two pages detail general trends in game performance, and explain how you can best design your game to be optimized or how you can intuitively figure out which things need to be optimized if you’ve already gone into production.
Профилируйте на ранней стадии и почаще
Profiling is important because it helps you discern which optimizations will pay off with big performance increases and which ones are a waste of your time. Because of the way that rendering is handled on a separate chip (GPU), the time it takes to render a frame is not the time that the CPU takes plus the time that the GPU takes. Instead, it is the longer of the two.
That means that if the CPU is slowing things down, optimizing your Shaders won’t increase the frame rate at all, and if the GPU is slowing things down, optimizing physics and scripts won’t help at all.
Often, different parts of the game and different situations perform differently as well. This means one part of the game might cause 100 millisecond frames entirely due to a script, and another part of the game might cause the same slowdown but because of something that is being rendered. At the very least, you need to know where all the bottlenecks are if you’re going to optimize your game.
Unity Profiler
You can use the main Profiler in Unity when targeting iOS, Android or Tizen. See documentation on the Profiler for basic instructions on how to use it.
Internal profilers
Andriod and iOS both have a built-in internal profiler, which spews out text every 30 frames. It can help you figure out which aspects of your game are slowing things down (such as physics, scripts, or rendering), but it doesn’t go into much detail (for example, it can’t tell you which script or renderer is the culprit).
- If the profiler indicates that most of your processing time is spent in rendering, see documentation on Rendering Optimizations
- If the profiler indicates that most of your processing time is spent outside of rendering, see documentation on Scripting Optimizations
See documentation on Internal profilers for information on how they work and how to turn them on.
Источник
Practical guide to optimization for mobiles
This guide is for developers new to mobile game development, who are probably feeling overwhelmed and are either planning and prototyping a new mobile game or porting an existing project to run smoothly on a mobile device. This guide should also be useful as a reference for anyone making mobile games or browser games that target old PCs and netbooks.
Optimization is a broad topic, and how you do it depends a lot on your game. Because of this, this guide is best read as an introduction or reference rather than a step-by-step guide that guarantees a smooth product.
Мобильные устройства не созданы одинаковыми
The information here assumes hardware around the level of the Apple A4 chipset, which is used on the original iPad, the iPhone 3GS, and the third generation iPod Touch. On the Android side, that would mean an Android phone such as the Nexus One, or most phones that run Android 2.3 Gingerbread. Most of these devices were released around early 2010. Out of the app-hungry market, these devices are the older, slower portion, but they should be supported because they represent a large portion of the market.
The very low-end Apple mobile devices (such as the iPhone 3G) and the first and second generation iPod Touches are extremely limited, and even more care must be taken to optimize for them. However, there is some question as to whether consumers who have not upgraded their device will be buying apps at all. So, unless you are making a free app, it might not be worthwhile to support the old hardware.
There are much slower and much faster phones out there, and the computational capability of mobile devices is increasing at an extraordinary rate. It’s not unheard of for a new generation of a mobile GPU to be five times faster than its predecessor. That’s incredibly fast when compared to the PC industry.
Оптимизацию не следует считать последней стадией разработки проекта
British computer scientist Michael A. Jackson is often quoted for his rules of program optimization:
“The first rule of program optimization: don’t do it. The second rule of program optimization (for experts only!): don’t do it yet.”
His rationale was that, considering how fast computers are and how quickly their speed is increasing, there is a good chance that, if you program something, it will run fast enough. Additionally, if you try to optimize too heavily, you might over-complicate things, limit yourself, or create bugs.
Однако, если вы разрабатываете мобильные игры, есть еще одно мнение: аппаратное обеспечение, представленное сейчас на рынке, сильно ограничено по сравнению с компьютерами, которые мы используем для работы. Поэтому высок риск того, что ваша ваша игра не будет работать на большинстве устройств и оптимизацию рекомендуют делать с самого начала разработки.
Throughout this guide, we will try to point out situations where an optimization would help a lot, versus situations where it would just be frivolous.
Optimization: not just for programmers
Artists also need to know the limitations of the platform, and the methods that are used to get around them, so they can make creative choices that pay off without having to re-produce work.
- More responsibility can fall on the artist if the game design calls for atmosphere and lighting to be drawn into Textures instead of being baked.
- Whenever anything can be baked, artists can produce content for baking instead of real-time rendering. This allows them to ignore technical limitations and work freely.
Design your game for a smooth runtime
These two pages detail general trends in game performance, and explain how you can best design your game to be optimized or how you can intuitively figure out which things need to be optimized if you’ve already gone into production.
Профилируйте на ранней стадии и почаще
Profiling is important because it helps you discern which optimizations will pay off with big performance increases and which ones are a waste of your time. Because of the way that rendering is handled on a separate chip (GPU), the time it takes to render a frame is not the time that the CPU takes plus the time that the GPU takes. Instead, it is the longer of the two.
That means that if the CPU is slowing things down, optimizing your Shaders won’t increase the frame rate at all, and if the GPU is slowing things down, optimizing physics and scripts won’t help at all.
Often, different parts of the game and different situations perform differently as well. This means one part of the game might cause 100 millisecond frames entirely due to a script, and another part of the game might cause the same slowdown but because of something that is being rendered. At the very least, you need to know where all the bottlenecks are if you’re going to optimize your game.
Unity Profiler
You can use the main Profiler in Unity when targeting iOS, Android or Tizen. See documentation on the Profiler for basic instructions on how to use it.
Internal profilers
Android and iOS both have a built-in internal profiler, which spews out text every 30 frames. It can help you figure out which aspects of your game are slowing things down (such as physics, scripts, or rendering), but it doesn’t go into much detail (for example, it can’t tell you which script or renderer is the culprit).
- If the profiler indicates that most of your processing time is spent in rendering, see documentation on Rendering Optimizations
- If the profiler indicates that most of your processing time is spent outside of rendering, see documentation on Scripting Optimizations
See documentation on Internal profilers for information on how they work and how to turn them on.
Источник
Практическое руководство по оптимизации для мобильных
Это руководство предназначено для новичков в мобильном геймдеве. Для тех, кто испытывает трудности при планировании и прототипировании новой мобильной игры (или портировании уже существующего проекта). Также этот раздел будет полезен в качестве справки для каждого, кто делает мобильные или браузерные игры (с целевой платформой — старые ПК или нетбуки).
Оптимизация вообще широкая тема, и то как вы ее сделаете, целиком зависит от вашей игры, поэтому данное руководство следует рассматривать как некое введение или ссылку, а не пошаговое руководство.
Мобильные устройства не созданы одинаковыми
Информация здесь предполагает аппаратное обеспечение на уровне чипсета Apple A4, который используется в оригинальных iPad, iPhone 3GS и третьем поколении iPod Touch. Из Android предполагается устройство подобное Nexus One, или большинства устройств, работающих на Android 2.3 Gingerbread. В основном, эти устройства были выпущены в начале 2010 года. Эти устройства старее, медленнее современных, но так как они составляют большую часть рынка, их также следует поддерживать.
Есть очень быстрые и очень медленные телефоны. Вычислительные мощности мобильных устройств растут с потрясающей скоростью. Для нового поколения мобильной GPU, быть в 5 раз быстрее своего предшественника — обычное дело. Скорость мобильных устройств уже сравнима со скоростью ПК.
Для обзора технических характеристик мобильных устройств от Apple, см. Hardware.
Если вы хотите разрабатывать под мобильные устройсва, которые станут известными в будущем, или эксклюзивные high end устройства прямо сейчас, вы можете это сделать. См. Мобильные устройства будущего.
Очень низкая производительность (например, iPhone 3G или первое и второе поколение iPod touches) требует особого внимания к оптимизации. В противном случае могут возникнуть проблемы когда покупатели, не обновившие устройства, будут покупать ваши приложения. Если же вы делаете бесплатное приложение, можно не беспокоится о поддержке старых устройств.
Оптимизацию не следует считать последней стадией разработки проекта
Британский ученый Майкл А. Джексон часто цитируется своими Правилами оптимизации программ:
_Первое правило оптимизации программы: не делаете ее. Второе правило оптимизации программы (только для экспертов!): не делайте ее пока что.
Он обосновал это тем, что учитывая рост скорости компьютеров, ваша программа будет достаточно быстрой. Кроме того, если вы попытаетесь слишком много оптимизировать, то сильно усложните код, ограничите себя и создадите много ошибок.
Однако, если вы разрабатываете мобильные игры, есть еще одно мнение: аппаратное обеспечение, представленное сейчас на рынке, сильно ограничено по сравнению с компьютерами, которые мы используем для работы. Поэтому высок риск того, что ваша ваша игра не будет работать на большинстве устройств и оптимизацию рекомендуют делать с самого начала разработки.
В данном руководстве мы постараемся указать ситуации, когда оптимизация сыграет большую роль в производительности, по сравнению с обратными ситуациями, когда оптимизация большого значения не имеет.
Оптимизация: Не только для программистов
Художникам тоже полезно знать ограничения платформы и методы, которые используются для того, чтобы их обойти. Зная это, они могут принимать креативные решения, которые в итоге сэкономят их труд.
- На художника ложится большая ответственность. Если дизайн игры предполагает атмосферность и освещение, их можно нарисовать в текстурах вместо запекания.
- Каждый раз, когда что-либо может быть запечено, художники могут готовить контент для выпекания, вместо рендеринга в реальном времени. Это позволяет им игнорировать технические ограничения и работать свободно.
Планируйте игру так, чтобы во время исполнения она работала “плавно”.
Эти две страницы детально описывают основные тенденции в игровой производительности и объясняют, как лучше спланировать оптимизацию своей игры или как интуитивно выявить места, нуждающиеся в оптимизации (в случае, если игра уже вышла в продакшн).
Профилируйте на ранней стадии и почаще
Профилирование важно, потому что оно поможет выяснить, какие оптимизации действительно приведут к большому приросту производительности, а какие являются пустой тратой вашего времени. Благодаря тому, что рендеринг обрабатывается на отдельном чипе (GPU), отрисовка одного кадра занимает в два раза меньше времени (только GPU, а не CPU + GPU). Это означает, что если CPU замедляет работу, оптимизация ваших шейдеров вообще не повысит частоту кадров, и если GPU замедляет работу, не помогут оптимизация физики и скриптов.
Часто бывает так, что разные части игры и разные ситуации работают по разному, так что одна часть игры может привести к 100 миллисекундным кадрам полностью из скрипта, а другая может привести в замедлению игры, потому что в данный момент что нибудь рендерится. Поэтому, если вы собираетесь оптимизировать свою игру, нужно по крайней мере выявить узкие места.
Внутренний Профайлер
Профайлер в Unity в основном используется при ориентации на iOS и Android. См. Руководство по профайлеру для основных инструкций по его использованию.
Внутренний Профайлер
Внутренний профайлер выкидывает текст каждые 30 кадров. Это поможет вам выяснить, какие аспекты вашей игры замедляют ее, будь то физика, скрипты, визуализация, но без множества деталей (например, только название скрипта или визуализации).
См. Встроенный Профайлер для подробной информации о том, как это работает и включается.
Источник