38
Introduction to BlackBerry NDK for Game Developers Aaron Ardiri Principal Developer Evangelist [email protected] twitter: @ARDIRI

Introduction to BlackBerry 10 NDK for Game Developers

  • Upload
    ardiri

  • View
    300

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Introduction to BlackBerry 10 NDK for Game Developers

Introduction to BlackBerry NDK for Game DevelopersAaron Ardiri

Principal Developer Evangelist

[email protected]

twitter: @ARDIRI

Page 2: Introduction to BlackBerry 10 NDK for Game Developers

Development Platform Freedom

2

Page 3: Introduction to BlackBerry 10 NDK for Game Developers

Open Industry Standards

3

Page 4: Introduction to BlackBerry 10 NDK for Game Developers

Commitment to Open Source

4

http://blackberry.github.org

Page 5: Introduction to BlackBerry 10 NDK for Game Developers

Code Sample: Main Entry Point

5

#include <stdio.h>#include <stdlib.h>

int main(int argc, char **argv){ fprintf(stdout, “Hello World\n”); return EXIT_SUCCESS;}

Page 6: Introduction to BlackBerry 10 NDK for Game Developers

BlackBerry 10

6

Integrated Social Beautiful

Page 7: Introduction to BlackBerry 10 NDK for Game Developers

BlackBerry Platform Services

low level integration with the BlackBerry platform

7

Page 8: Introduction to BlackBerry 10 NDK for Game Developers

BlackBerry Platform Services

8

overview

the BlackBerry Platform Services (BPS) library provides an application with a single consistent interface to a number of different services during the execution of the application.

- universal event management- user interaction – working with the navigator- input/output (sensors, audio, LED, screen, multimedia)- device information, locale and payment services- network status and geo-location

Page 9: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Event Loop Code Sample

9

for (;;){ bps_event_t *event_bps = NULL; bps_get_event(&event_bps, timeout); // -1, forever if (event_bps != NULL) { event_domain = bps_event_get_domain(event_bps); if (event_domain == xxx) { // request event information within the domain } }}

Page 10: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Platform Services Template

handling {service} events

{service}_request_events({param}); // request events

then capture the appropriate {service} events

event_domain = bps_event_get_domain(event_bps); if (event_domain == {service}_get_domain()) { // handle the {service} event

10

Page 11: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Navigator

handling navigator events

navigator_request_events(0); // request events

then capture the appropriate navigator events

if (event_domain == navigator_get_domain()) { e_id = bps_event_get_code(event_bps);

11

Page 12: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Navigator Events

navigator events of use for game developers

NAVIGATOR_EXIT NAVIGATOR_SWIPE_DOWN NAVIGATOR_BACK NAVIGATOR_WINDOW_STATE NAVIGATOR_ORIENTATION_CHECK NAVIGATOR_ORIENTATION NAVIGATOR_LOW_MEMORY ...

12

Page 13: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Navigator

invoking other navigator services navigator_invoke(“http://developer.blackberry.com”, NULL); navigator_invoke(“camera://photo”, NULL); navigator_invoke(“settings://about”, NULL); navigator_invoke(“videos://recorded”, NULL); ...

13

Page 14: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Screen and Window Handling

composite window handling

the BlackBerry 10 platform provides a composited windowing API (low level) – which allows the creation of a windows and defining the appropriate properties (colors, depth, dimensions).

screen_create_context(&scr, SCREEN_APPLICATION_CONTEXT);screen_create_window(&win, scr);screen_set_window_property_iv(...);

14

Page 15: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Screen and Window Handling

creating a 1280x768, 16bpp 565 (RGB) window

int param = SCREEN_FORMAT_RGB565; screen_set_window_property_iv (win, SCREEN_PROPERTY_FORMAT, &param); int rect[] = { 1280, 768 }; screen_set_window_property_iv (win, SCREEN_PROPERTY_BUFFER_SIZE, rect);

15

Page 16: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Screen and Window Handling

FrameBuffer

for “oldskool” computer graphics enthusiasts – a pixel FrameBuffer can be easily obtained from the window object allowing for the development of retro games and emulators.

screen_create_window_buffers(win, 1); screen_get_window_property_pv(win, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&pFB);

16

Page 17: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Screen and Window Handling

Open GL ES 1.1 or 2.0

to take advantage of the hardware accelerated 3D graphics (Open GL ES 1.1 or 2.0) – simply use the standard eglXXX API calls to initialize the environment.

17

Page 18: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Screen and Window Handling

handling screen events

screen_request_events(screen_ctx);

then capture the appropriate screen related events

if (event_domain == screen_get_domain()) { event_scr = screen_event_get_event(event_bps); screen_get_event_property_iv(event_scr, SCREEN_PROPERTY_TYPE, &e_id);

18

Page 19: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Screen and Window Events

screen events of use for game developers

SCREEN_EVENT_POINTER SCREEN_EVENT_MTOUCH_TOUCH SCREEN_EVENT_MTOUCH_MOVE SCREEN_EVENT_MTOUCH_RELEASE SCREEN_EVENT_KEYBOARD SCREEN_EVENT_DEVICE new in 10.1 SDK

(gamepad) ...

19

Page 20: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Sensors

handling sensor events

if (sensor_is_supported(sensor_type)) sensor_request_events(sensor_type);

then capture the appropriate sensor related events

if (event_domain == sensor_get_domain()) { e_id = bps_event_get_code(event_bps); ...

20

Page 21: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Sensor Events

21

sensors that may be available (check before use)

SENSOR_TYPE_ACCELEROMETER SENSOR_TYPE_MAGNETOMETER SENSOR_TYPE_GYROSCOPE SENSOR_TYPE_AZIMUTH_PITCH_ROLL SENSOR_TYPE_ALTIMETER SENSOR_TYPE_TEMPERATURE SENSOR_TYPE_PROXIMITY SENSOR_TYPE_LIGHT ...

Page 22: Introduction to BlackBerry 10 NDK for Game Developers

BPS: Network Status

22

handling network status events

netstatus_request_events(0);

then capture the appropriate network status related events

if (event_domain == netstatus_get_domain()) available = netstatus_event_get_availability(event_bps);

to check the network status at any time:

netstatus_get_availability(&available);

Page 23: Introduction to BlackBerry 10 NDK for Game Developers

Scoreloop Integration

23

social integration

• user profiles

• challenges

• achievements

• leader boards and high scores

• virtual goods and currency

Games

Page 24: Introduction to BlackBerry 10 NDK for Game Developers

3rd Party Game Engines

24

Page 25: Introduction to BlackBerry 10 NDK for Game Developers

Simple Directmedia Layer

25

GNU LGPL v2 License

• FrameBuffer and hardware accelerated Open GL

• audio and multimedia playback

• threads, timers and endian independence

http://www.libsdl.org

Page 26: Introduction to BlackBerry 10 NDK for Game Developers

gameplay

26

Apache 2.0 License

• hardware accelerated Open GL scene graph

• audio and multimedia playback

• input, sensors, physics and particle engines

http://www.gameplay3d.org

Page 27: Introduction to BlackBerry 10 NDK for Game Developers

Cocos2D-X

27

MIT License

• hardware accelerated Open GL

• scripting support (JavaScript, LUA)

http://www.cocos2d-x.org

Page 28: Introduction to BlackBerry 10 NDK for Game Developers

Marmalade

28

Commercial License

• hardware accelerated Open GL (3D)

• audio and multimedia playback

• numerous licensing models – cross platform

http://www.madewithmarmalade.com

Page 29: Introduction to BlackBerry 10 NDK for Game Developers

Game Developer Highlights

29

let’s take a look at some regional indie developers making the most of the BlackBerry 10 platform.

Page 30: Introduction to BlackBerry 10 NDK for Game Developers

Developer: Tactile Entertainment

30

ChasingYellow

• Cocos2D-X

• Leader boards

• Challenges

• Achievements (entry point, add friend, rematch)

Page 31: Introduction to BlackBerry 10 NDK for Game Developers

Fruit Blitz

• C++ with Open GL ES 2.0, Open AL

• Leader boards

• Challenges

• Achievements (entry point, add friend, rematch)

• Progress Sync

Developer: Tactile Entertainment

31

Page 32: Introduction to BlackBerry 10 NDK for Game Developers

DynaStunts

• C with Open GL ES 2.1, Open AL

• Leader boards

• Challenges

• Achievements (entry point, add friend, rematch)

• Custom Profile Image

Developer: Tactile Entertainment

32

Page 33: Introduction to BlackBerry 10 NDK for Game Developers

Distribution and Marketing

33

how to sell and make your games a success

Page 34: Introduction to BlackBerry 10 NDK for Game Developers

Application Publishing

Publishing to BlackBerry World

• BlackBerry World is the on-device distribution catalogue• a publishing account is required to use BlackBerry World

• free to sign up• royalty share between RIM and developer (70% developer)

• provide payment details (paypal, et al)• create product (metadata) and release BAR files

• 480x480 icon, featured image, screenshots and description

Page 35: Introduction to BlackBerry 10 NDK for Game Developers

Application Monetization

Pre-mium, free-mium or combination?

many methods to monetize; all options are available to you

• paid applications• free applications with in-app purchases• free applications with advertising

Page 36: Introduction to BlackBerry 10 NDK for Game Developers

Built for BlackBerry

36

Application Certification

• recognized high quality

• the official “stamp” of approval

• give customers peace of mind

• improve visibility in BlackBerry World

Page 37: Introduction to BlackBerry 10 NDK for Game Developers

For More Information…

Native Development Resourceshttp://developer.blackberry.com/native/

BlackBerry Developer Bloghttp://devblog.blackberry.com/

BlackBerry Developer YouTube Channelhttp://www.youtube.com/user/BlackBerryDev

37

Page 38: Introduction to BlackBerry 10 NDK for Game Developers

Thank You!Aaron Ardiri

Principal Developer Evangelist

[email protected]

twitter: @ARDIRI