IOS PERFORMANCE. Getting the most out of your Games and Apps

Similar documents
INTRO TO COCOS2D. 360iDev 2011

the gamedesigninitiative at cornell university Lecture 13 Memory Management

the gamedesigninitiative at cornell university Lecture 10 Memory Management

The Application Stage. The Game Loop, Resource Management and Renderer Design

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

Optimizing and Profiling Unity Games for Mobile Platforms. Angelo Theodorou Senior Software Engineer, MPG Gamelab 2014, 25 th -27 th June

Mobile Performance Tools and GPU Performance Tuning. Lars M. Bishop, NVIDIA Handheld DevTech Jason Allen, NVIDIA Handheld DevTools

Memory Management: High-Level Overview

Copyright Khronos Group, Page Graphic Remedy. All Rights Reserved

Working with Metal Overview

ArcGIS Runtime: Maximizing Performance of Your Apps. Will Jarvis and Ralf Gottschalk

the gamedesigninitiative at cornell university Lecture 12 Scene Graphs

Optimizing Your Android Applications

Optimizing DirectX Graphics. Richard Huddy European Developer Relations Manager

Apple Watch Design Tips and Tricks

Optimizing for DirectX Graphics. Richard Huddy European Developer Relations Manager

the gamedesigninitiative at cornell university Lecture 6 Scene Graphs

Game Programming with. presented by Nathan Baur

Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead

Direct3D API Issues: Instancing and Floating-point Specials. Cem Cebenoyan NVIDIA Corporation

PowerVR Performance Recommendations The Golden Rules. October 2015

DX10, Batching, and Performance Considerations. Bryan Dudash NVIDIA Developer Technology

PERFORMANCE. Rene Damm Kim Steen Riber COPYRIGHT UNITY TECHNOLOGIES

COPYRIGHTED MATERIAL. 1Hello ios! A Suitable Mac. ios Developer Essentials

Introducing Metal 2. Graphics and Games #WWDC17. Michal Valient, GPU Software Engineer Richard Schreyer, GPU Software Engineer

Mobile HW and Bandwidth

Bringing AAA graphics to mobile platforms. Niklas Smedberg Senior Engine Programmer, Epic Games

Direct3D 11 Performance Tips & Tricks

Building mobile app using Cordova and AngularJS, common practices. Goran Kopevski

Mali Developer Resources. Kevin Ho ARM Taiwan FAE

Compressing loads of content into only 20mb

Tips and Tricks: Designing low power Native and WebApps. Harita Chilukuri and Abhishek Dhanotia

Profiling and Debugging Games on Mobile Platforms

Computer Games 2014 Selected Game Engines

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

ios Memory Deep Dive #WWDC18 Kyle Howarth, Software Engineer James Snee, Software Engineer Kris Markel, Software Engineer

Best practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer

Raise your VR game with NVIDIA GeForce Tools

Marmalade SDK FAQ v1.02

Sprite Animix. Content. Sprite Animix Version 1.0

Streaming Massive Environments From Zero to 200MPH

Animation Essentially a question of flipping between many still images, fast enough

Computer Hardware. ICS2O Mr. Emmell

CSEE 4840 Embedded System Battle City. Tian Chu Huangfu Quan Yuan Liuxun Zhu Tianchen Li

Game Development for

the gamedesigninitiative at cornell university Lecture 15 Game Audio

Working with Images and Multimedia

OpenGL ES for iphone Games. Erik M. Buck

Coding OpenGL ES 3.0 for Better Graphics Quality

What s New in SpriteKit

Under The Hood: Performance Tuning With Tizen. Ravi Sankar Guntur

More frames per second. Alex Kan and Jean-François Roy GPU Software

Profiling & Optimization

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

Michal Valient Lead Tech Guerrilla Games

Whiz-Bang Graphics and Media Performance for Java Platform, Micro Edition (JavaME)

FlashtoUnity Monday, October 7 th, Flash to Unity User s Manual

LECTURE 5. Announcements

Starling Insider Tips

Introducing On Demand Resources

Developing Applications for ios

Designing for Performance. Arseny Kapoulkine

GROW-IT. Plug-in for Daz3D Studio

Godot engine Documentation

Tuesday 6th October Agenda

Unity Game Development

Low-Overhead Rendering with Direct3D. Evan Hart Principal Engineer - NVIDIA

Performance OpenGL Programming (for whatever reason)

UberFlow: A GPU-Based Particle Engine

Computer Games 2012 Game Development

How to use the ruler, grid, guides, and the Align panel

LPGPU Workshop on Power-Efficient GPU and Many-core Computing (PEGPUM 2014)

Metal for Ray Tracing Acceleration

Three OPTIMIZING. Your System for Photoshop. Tuning for Performance

Spring 2011 Prof. Hyesoon Kim

Optimization Tips 杜博, 美国高通公司资深工程师

Profiling & Optimization

NVIDIA Parallel Nsight. Jeff Kiel

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING

ARCHITECTURE FOR CASUAL GAMES

February 18, Nintendo. Bob Rost January 14, 2004

Understanding XNA Framework Performance. Shawn Hargreaves Software Development Engineer XNA Community Game Platform Microsoft

Computer Games 2011 Selected Game Engines

Quick Guide to the NoMachine GUI

Tacky Golf Senior Project Write-Up By Robert Crosby

Hardware Accelerated Graphics for High Performance JavaFX Mobile Applications

Mount Points Mount Points is a super simple tool for connecting objects together and managing those relationships.

Realistic and Fast Cloud Rendering in Computer Games. Niniane Wang Software Engineer Microsoft Flight Simulator (now at Google Inc) Intro Video

Vulkan: Scaling to Multiple Threads. Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics

Windowing System on a 3D Pipeline. February 2005

Living through Flash to ipad/html5 Conversion and Development

Gecata by Movavi 5. Recording desktop. Recording with webcam Capture videos of the games you play. Record video of your full desktop.

Chapter 19- Object Physics

Internet and Phone Connection Guide. Para español, ve el reverso.

RSX Best Practices. Mark Cerny, Cerny Games David Simpson, Naughty Dog Jon Olick, Naughty Dog

Scratch Lesson 2: Movies Made From Scratch Lesson Framework

PowerCenter 7 Architecture and Performance Tuning

Hiroyuki Kobota Director Principal Engineer. Alex Adjadj Director Global Strategic Development & Mobile Sales

Everything You Ever Wanted To Know About Resource Scheduling... Almost

Standard File Formats

Transcription:

IOS PERFORMANCE Getting the most out of your Games and Apps

AGENDA Intro to Performance The top 10 optimizations for your games and apps Instruments & Example Q&A

WHO AM I? Founder of Prop Group www.prop.gr Background in enterprise software, now iphone+ipad games! 2D physics game, Payload in the AppStore

In Progress... www.cocos2dbook.com

SPACE VIKING GAME Learn how to build the Space Viking Game! www.cocos2dbook.com

WHY CARE ABOUT PERFORMANCE? Better Performance = Better experience and responsiveness to the user Less battery use Headroom for additional features

POP QUIZ! What is the slowest (non-network) hardware subsystem/ component on ios Devices? What is the 2nd slowest? (Hint: They are both battery hogs) Answer: Flash Memory (storage) and RAM

IT S ALL ABOUT THE MEMORY On iphone 3GS for example: L1 Cache ~ 1 CPU Cycle L2 Cache ~ 10 CPU Cycles Normal RAM ~ 80 Cycles Addition ~ 3 Cycles

TIP #1 IMAGE BIT DEPTH Images are stored in RAM decompressed (Length X Width X Bit Depth )/8 = Bytes in RAM Example: Black 1024x1024 image, saves as a 25K PNG file (1024x1024x32)/8 = 4.1 Megabytes!

TIP #1CONTINUED Use the lowest bit depth you can. Less bits per pixel = less memory = faster game Set the CCTexture2D default format before loading [CCTexture2D setdefaultalphapixelformat:kcctexture2dpixelformat_rgba4444]; You can change the CCTexture2D format anytime

TIP #2 USE SPRITE SHEETS Use tightly packed Sprite Sheets via the CCSpriteBatchNode Reduce your OpenGL ES texture binds from many calls to 1 Easy to create using TexturePacker or Zwoptex Less Texture Memory = Better Performance

PERF TIP #2 (CONTINUED) USE SPRITE SHEETS

PERFORMANCE TIP #2 CONTINUED

SPRITE SHEETS EXAMPLE

HOW DO WE GET TO THIS?

BACKGROUND

BACKGROUND ANIMATIONS

TRUCK & CONTROLS

HOW MANY BIND CALLS?

SPRITE SHEETS CCSpriteBatchNode - collection of CCSprites from a Sprite Sheet, OpenGL ES draw calls batched Support for using Zwoptex Sprite Sheets/Texture Atlas

TIP #3 REDUCE, RE-USE, RECYCLE Re-Use your CCSprites, and other Cocos2D Objects. If you have a set number of characters/sprites, allocate them at initialization time

TIP #4 AUDIO FORMATS/LOADING Load audio in a background thread, or during an intro sequence. Preload it before you need it. Take care of mp3 hardware decoder, send the background track first (or your largest mp3 file)

TIP #5 THUMB SUPPORT Thumb, turn it OFF for Armv6, and ON for Armv7 Thumb on Armv6 has NO floating point support. MapKit uses a ton of floating point!

TIP #6 COCOS2D TEXT LABELS CCLabelTTF is... super slow - creates a new texture every time you change the text. (Hint: This is Bad Bad Bad) Use CCLabelBMFont instead Create your font atlases in Glyph Designer or Hiero

TIP #7 USE THE SCHEDULER Never update in -(void)draw Use [self scheduleupdate] -(void)update:(cctime)deltatime method called on every frame Update Driven by CADisplayLink Render

TIP #8 LIMIT PARTICLE SYSTEMS SIZE Remember ios Device!= Mac Re-Use particle systems instead of re-creating every time you need it Test on the actual device

TIP #9 MEMORY WARNINGS Respond to memory warnings. What can you unload? (Animations, sound effects, textures) Call CCTextureCache, to purge the textures after you dealloc your scene. [[CCTextureCache sharedtexturecache] removeunusedtextures];

TIP #10 PROFILE YOUR APP Profile early and often Find your bottlenecks and focus on the biggest issues Don t optimize prematurely Leaks in the Simulator, everything else on the actual device!

WWDC 2011 INSTRUMENTS SESSIONS Session 310 - What s New with Instruments Session 312 - ios Performance and Power Optimization Session 416 - Tools for Tuning OpenGL ES Apps on ios

WWDC 2010 INSTRUMENTS SESSIONS Session 304 - What s New with Instruments Session 309 - Advanced Performance Analysis with Instruments Session 311 - Advanced Memory Analysis with Instruments Session 306 - Automating User Interface Testing with Instruments

INSTRUMENTS EXAMPLE Ole the Viking versus Space Debris Tons of falling debris, lots of elements on the screen Similar to space shooters, side scrollers, and tower defense games

SPACE VIKING + SPACE DEBRIS

1100 CCSPRITES - NO CCSPRITEBATCHNODE IPHONE 4 (18FPS)

WHAT ABOUT A TEXTURE ATLAS?

1100 CCSPRITES - 1CCSPRITEBATCHNODE IPHONE 4 (40FPS)

CCSPRITES VS CCSPRITEBATCHNODE CPU Utilization for drawing sprites went down: 58% to 17% Frame rate doubled: 18FPS to 40FPS But...

SPRITE RE-USE Each time a debris CCSprite reached the ground it was removed (dealloc) and a new one was created (alloc) Why not just re-position it and reuse it?

1100 CCSPRITES - 1CCSPRITEBATCHNODE IPHONE 4 (60FPS)

CCSPRITEBATCHNODE AND REUSE CPU Utilization for drawing sprites went down: 58% to 17% to 0.3% Frame rate increase: 18FPS to 40FPS to 60 FPS

ONE MORE THING...

BATCH YOUR ACCELEROMETER DATA Store the data in an array, don t do anything else with it on the callback Process the accelerometer updates (array) on the -update call before each frame is rendered.

COMBINE LIKE TASKS Think about what you can calculate together instead of 1 at a time AI/Enemy Logic, Collisions? Can you partition and only calculate what is needed? Use ScheduleWithPriority to control update callback order

MORE DETAILS ON THE BLOG http://cocos2dbook.com

THANK YOU rod@prop.gr twitter.com/rodstrougo www.prop.gr www.cocos2dbook.com