The Beginner's Guide to Android Game Development by James Cho
Author:James Cho
Language: eng
Format: azw3
Publisher: Glasnevin Publishing
Published: 2014-10-27T05: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.
Deep Learning with Python by François Chollet(12528)
Hello! Python by Anthony Briggs(9873)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9763)
The Mikado Method by Ola Ellnestam Daniel Brolund(9754)
Dependency Injection in .NET by Mark Seemann(9300)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8264)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7748)
Grails in Action by Glen Smith Peter Ledbrook(7673)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7523)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6767)
Microservices with Go by Alexander Shuiskov(6536)
Practical Design Patterns for Java Developers by Miroslav Wengner(6427)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6406)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6385)
Angular Projects - Third Edition by Aristeidis Bampakos(5794)
The Art of Crafting User Stories by The Art of Crafting User Stories(5318)
NetSuite for Consultants - Second Edition by Peter Ries(5260)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5080)
Kotlin in Action by Dmitry Jemerov(5025)
