BlackBerry Game Development Challenges Jeff Bacon, Sr. Smartphone Product Manager Simon Dale, Smartphone Services Team Lead J15.

Slides:



Advertisements
Similar presentations
CSE 380 – Computer Game Programming Tile Based Graphics Legend of Zelda, by Nintendo, released 1987.
Advertisements

2D Platform Games: Tiles & Scrolling
4.2. G RAPHICS II Image Ribbons and Image Tiles. Building a scrollable background using several ‘joined’ images.
Cosc 5/4730 Blackberry Drawing. Screen size With Blackberry devices, they have a known screen size in pixels. If you are programming for specific device.
More Java Drawing in 2D Animations with Timer. Drawing Review A simple two-dimensional coordinate system exists for each graphics context or drawing surface.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
Game Design and Programming. Objectives Classify the games How games are design How games are implemented What are the main components of a game engine.
Smartphone Touchless Screen
Advanced Java Class GUI – part 1. Intro to GUI GUI = Graphical User Interface -- “Gooey” Just because it’s “gooey” does not mean you may write messy code.
Cosc 5/4755 Algorithms Size and efficiency. Why? On modern desktops and laptops, – Memory size gets larger and larger 8 GBs is now common and 16GBs considered.
Windows 8 Windows Phone 8 Web Mobile … and WakeUpAndCode.com.
Windows 8 Windows Phone 8 Web Mobile … and WakeUpAndCode.com.
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
2D Physics and Camera Systems For CSE 3902 By: Matt Boggus.
Guide to Programming with Python
School of Geography FACULTY OF ENVIRONMENT Introduction to Cartography.
1 Scrolling and Panning CIS 487/587 Bruce R. Maxim UM-Dearborn.
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
CSE 381 – Advanced Game Programming Basic 3D Graphics
1 k Jarek Rossignac,  2008 Processing  Install Processing  Learn how to edit, run, save, export, post programs  Understand.
Embedded Software SKKU 28 1 WebKit/EFL. Embedded Software SKKU 28 2 WebKit Parsing Layout and Painting WebKit and EFL Contents.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Java Graphics. Review 3 kinds of elements in components API? Layout managers Events Extend vs. Implement.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
2 COEN Computer Graphics I Evening’s Goals n Discuss application bottleneck determination n Discuss various optimizations for making programs execute.
User Interface Programming in C#: Direct Manipulation Chris North CS 3724: HCI.
High Performance Java Swing Animation David Wallace Croft Presented to the Plano Java Users Group Plano, TX Copyright 2004 David Wallace Croft.
“The perfect project plan is possible if one first documents a list of all the unknowns.” Bill Langley.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
CSE 380 – Computer Game Programming GUIs for Games.
Java Direct Manipulation Chris North cs3724: HCI.
Real Estate Issues by Will Luers please open chrome and the iOS simulator Layout for Mobile App Design.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
CSE 380 – Computer Game Programming Player Controls & Scrolling Mega Man, by Capcom, released 1988.
CSE 380 – Computer Game Programming Tile Based Graphics & Scrolling Legend of Zelda, by Nintendo, released 1987.
Object Oriented Analysis & Design Game Patterns. Contents  What patterns are  Delegation  Game Loop  Scene Graph  Double Buffering  Component 
Java Dynamic Graphics.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
Copyright 2010 by Pearson Education Building Java Programs Chapter 10, 11 Lecture 22: 143 Preview optional reading: 10.1,
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Visible Surface Determination (VSD) To render or not to render, that is the question… 1 of.
T HE G AME L OOP. A simple model How simply could we model a computer game? By separating the game in two parts: – the data inside the computer, and –
LESSON 15 – UNIT 0 ADAPTING YOUR WEB SITE FOR MOBILE DEVICES.
Mapping Like Google Edward Svirsky Presented by Mark Scheel.
Construct 2 Game Development for Kids Platformer Tutorial: Part 1 Shahed Chowdhuri.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 22 Game Graphics.
Distortion Correction ECE 6276 Project Review Team 5: Basit Memon Foti Kacani Jason Haedt Jin Joo Lee Peter Karasev.
Advanced Java Screen Update Techniques SD’98 - Session 4406 Ted Faison Faison Computing Inc.
Efficient Game Graphics From Flash MX 2004 Game Design Demystified.
Variables. Something to mention… void setup(){ size(200, 200); background(255); smooth(); } void draw() { stroke(0); strokeWeight(abs(mouseX-pmouseX));
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
Reference: What is it? A multimedia python library – Window Management – Graphics geometric shapes bitmaps (sprites) – Input Mouse Keyboard.
Chapter 11: Scrolling with Greenfooot. What Is Scrolling? Scrolling is an important and often necessary concept in games. It can be used to: a)Convey.
How to Program a Game: A Super Crash Course, A Talk or Something!
2D Graphics Optimizations
Sprites (Images) and Sounds
Week 2 - Monday CS361.
CS 134 More Graphics.
Frame Update, Level Representation & Graphics
Web Games Programming Creating Split-View Cameras and Camera Overlays.
2D Viewing & Clipping 한신대 류승택
Java Programming: Guided Learning with Early Objects
Game Loop Update & Draw.
Positioning.
MTA-4201 Game Programming Chapter 8 : Scrolling Background & Font
Catchup. Work on project.
Computer Graphics Introduction to Shaders
Game Programming Algorithms and Techniques
Construct 2 Game Development: Flapping Bird
Presentation transcript:

BlackBerry Game Development Challenges Jeff Bacon, Sr. Smartphone Product Manager Simon Dale, Smartphone Services Team Lead J15

Agenda Buffering Strategies Parallax Scrolling Case Study: Worms A Space Oddity Optimizing with the JDE Navigation API Deficiencies

Magmic Experience Original & Licensed IP Over 45 Games Feature Phones (J2ME/MIDP) BlackBerry Feature Phones (BREW) Windows Mobile Licensed IP: 60+ Titles J2ME/MIDPBlackBerry BREWWindows Mobile 5+ years of BlackBerry game development

Tiles 110 x Graphics.drawBitmap 11 x Graphics.drawBitmap Buffering Strategies What do we mean by buffering? Raging Rivers, Magmic Games

Why do we need to buffer the screen? Customers think big screen == big performance Meet customer expectations Optimization is FUN! Motorola V3x (QVGA) SonyEricsson Z750i (QVGA) HTC Touch (QVGA) BlackBerry 8300 (QVGA) BlackBerry Kickstart (QVGA) BlackBerry BOLD (HVGA) BlackBerry 8120 (240x260) JBenchmark JBenchmark 2D MQ Buffering Strategies Motivations

Bitmap buffer = new Bitmap(screenWidth, screenHeight); private boolean bufferDirty = true; private void repaintBuffer() { synchronized (buffer) { // … draw all the static content onto the buffer … bufferDirty = false; } public void setBufferDirty() { synchronized (buffer) { bufferDirty = true; } } Buffering Strategies Full Screen Image

// OPTION 1: Paint Method public void paint(Graphics g) { if (buffer_is_dirty) { repaintBuffer(); } g.drawBitmap(0, 0, screenWidth, screenHeight, buffer, 0, 0); // … draw all dynamic content … } Buffering Strategies Full Screen Image // OPTION 2: Game Run Loop if (buffer_is_dirty) { repaintBuffer(); } Good: guarantee clean paints Bad: frame rate choppy Bad: long synchronization in paint Good: control when frame rate suffers Bad: can have dirty paints

Buffering Strategies Full Screen Image: Working and Live buffers Reduces maximum paint time Low variance in FPS Risk of stale paints private void repaintBuffer() { synchronized (workingBuffer) { // … draw all the static content onto the workingBuffer … synchronized (liveBuffer) { Graphics g = liveBuffer.getGraphics(); g.drawBitmap(... workingBuffer...); } bufferDirty = false; } public void paint(Graphics g) { synchronized (liveBuffer) { g.drawBitmap(... liveBuffer...); } // … draw all dynamic content … }

Buffering Strategies Larger-Than-Full Screen Image Content Area Viewport Same basic code as Full Screen Keep track of viewport co-ordinates Offset rendering in drawBitmap with viewport Call of Duty 3, HandsOn Mobile

int numBuffers = (screenWidth/ bufferWidth) + 1; Bitmap buffers[] = new Bitmap[numBuffers]; private boolean[] bufferIsDirty = new boolean[numBuffers]; private int leftBuffer = 0; private int leftOffset = 0; public synchronized void setBufferDirty(int bufferId) { synchronized (buffers) { bufferIsDirty[bufferId] = true; } private void repaintBuffer(int bufferId) { synchronized (buffers) { // … draw all the static content onto the buffer … bufferIsDirty[bufferId] = false; } Buffering Strategies Segmented Buffer

public void paint(Graphics g) { synchronized (buffers) { for (int i = 0; i < numBuffers; i++) { if (bufferIsDirty[i]) { repaintBuffer(i); } } int currentBuffer = leftBuffer; for (int i = 0; i < numBuffers; i++) { g.drawBitmap(… buffers[currentBuffer % numBuffers] …); ++currentBuffer; } // … draw all dynamic content … } Buffering Strategies Segmented Buffer Remember to respect the leftOffset Remember to start at leftBuffer index

Screen Area More buffers == smoother scrolling Less buffers == faster painting when not scrolling Horizontal Scroller: buffer height == screen height width can be varied (ex. above) Vertical Scroller: buffer width == screen width height can be varied Indiana Jones and the Kingdom of the Crystal Skull, THQ Wireless Buffering Strategies Segmented Buffer, Example

What is parallax scrolling? New Super Mario Bros., Nintendo, Nintendo DS Parallax Scrolling

Avoid tiled backgrounds Use fewer, larger images Buffer the background layer(s) Only paint visible areas Eagle Eye, Magmic Games Parallax Scrolling Optimization: Reduce Number of Paints

Case Study: Worms A Space Oddity

Can we Buffer? Can’t draw to a large Bitmap Difficult to maintain transparency in a buffer How do we efficiently deform the world? Why? Large level maps (1024x512) Repainting on every tick Repainting using Graphics.drawRGB() Updating all map data for all changes Stationary camera: 3-5 fps Moving camera (viewport): 1-2 fps Explosion: 0 fps Case Study: Worms A Space Oddity Problem: Very Slow Frame Rate

Use lookup-tables for trig functions Faster calculations, less accurate Localize painting to the current viewport Remove some detail Decreases production quality Performance often outweighs detail Full Screen buffer Stationary camera improved dramatically Stationary camera: 17 fps Moving camera (viewport): 8-12 fps Explosion: 0-3 fps Case Study: Worms A Space Oddity Stage 1: Basic Optimizations & Full Screen Buffer

Worms A Space Oddity, THQ Wireless Create a world buffer: 1024x512px Manipulate ARGB data for transparency Painting buffer done on load Allows parallax scrolling Optimize explosions & bounds checking Localize small changes 1024px 512px Stationary camera: 12 fps Moving camera: 12 fps Explosion: 8-10 fps Case Study: Worms A Space Oddity Stage 2: More Optimizations & Segmented Buffer

Worms A Space Oddity, THQ Wireless Stationary camera: fps Moving camera: fps Explosion: 8-10 fps Case Study: Worms A Space Oddity Stage 3: Double Buffering Improve stationary camera frame rate Paint 1 live buffer vs. 1-4 working buffers Possible panning improvement Painting off-screen faster than direct to screen