The Beginners Guide to Android Game Development by Cho James
Author:Cho, James
Language: eng
Format: epub
Publisher: Glasnevin Publishing
Published: 2014-10-27T04:00:00+00:00
Ellio: Optimization Matters
Ellio is a simple two-button game, but the nature of this infinite runner necessitates a discussion of optimization.
The Issue of Memory Management
Until now, we’ve largely ignored memory usage; we’ve created objects at will, assuming that our machine will always have plenty of memory (RAM) to store these as variables for as long as we need. When we start developing for Android, this assumption may not always hold. Mobile devices tend to have smaller amounts of memory than do computers, and this memory tends to be shared across multiple applications simultaneously. This makes memory management an important issue that you should actively think about when developing games, and we will start this process with Ellio.
If you look again at Figure 6-1, you will notice that Ellio has to avoid a series of yellow blocks coming from the right. Let me ask you this question. What should we do with the yellow blocks that have gone past the left side of the screen? These blocks are no longer visible, so keeping them around means that they will take up memory for no reason. Continuing to waste processing power to update them and render them will mean that our game will slow down with time.
You may have answered the question by saying, “We should destroy the unused blocks.” While that may sound like a great idea, that would mean we must create a new set of blocks to replace the destroyed ones. This is bad for a couple of reasons. To understand why, let’s talk about some optimization techniques that will make our game run faster.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6532)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Kotlin in Action by Dmitry Jemerov(5062)
Odoo 15 Development Essentials - Fifth Edition by Daniel Reis & Greg Mader(3343)
Odoo 15 Development Essentials by Daniel Reis(2814)
React Native - Building Mobile Apps with JavaScript by Novick Vladimir(2529)
Learning Angular - Second Edition by Christoffer Noring(2358)
Pride and Prejudice by Jane Austen(2350)
Mobile Forensics Cookbook by Igor Mikhaylov(2017)
Computers For Seniors For Dummies by Nancy C. Muir(1995)
Bulletproof Android: Practical Advice for Building Secure Apps (Developer's Library) by Godfrey Nolan(1872)
Android Development with Kotlin by Marcin Moskala & Igor Wojda(1797)
Building Android UIs with Custom Views by Raimon Ràfols Montané(1789)
1936941139 (N) by Bob Rosenthal(1731)
Building Progressive Web Apps: Bringing the Power of Native to the Browser by Ater Tal(1725)
Hands-On Internet of Things with MQTT by Tim Pulver(1706)
Android App Development by Franceschi Hervé J.;(1702)
Ember.js in Action by Joachim Haagen Skeie(1689)
Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz(1656)
