• No results found

Cross-Platform Game Development Best practices learned from Marmalade, Unreal, Unity, etc.

N/A
N/A
Protected

Academic year: 2021

Share "Cross-Platform Game Development Best practices learned from Marmalade, Unreal, Unity, etc."

Copied!
38
0
0

Loading.... (view fulltext now)

Full text

(1)

Cross-Platform Game Development

Best practices learned from Marmalade, Unreal, Unity, etc.

(2)

Agenda

• Understand the major mobile platforms

• 5 steps to being “truly” cross-platform

• How to {sup}port Android, Windows, iOS

(3)
(4)

Step 1 –

Abstract hardware/OS

1. Abstract the GPU with OpenGL

2. Abstract the CPU by using standard C/C++

3. Any architecture specific code (ASM, SIMD,

(5)

Step 2 –

Unified code base

1. C/C++ is the most portable language!!

2. Use multiple files instead of a ton of #defines

3. Define common OS functionality in a common

header:

system_Android.c

system_Windows.c

(6)

Step 3 –

Build from one place and in one way

1. Most developers build from Visual Studio

(works with everything except iOS).

2. There are lots of options to emulate OpenGL

ES on Windows. You can implement most

major functionality in an environment with a

good debugger.

(7)

Step 4 –

Plan ahead for multiple screen sizes/resolutions

1. Multiple screen dimensions and resolutions are

a problem on all platforms (including iOS!), so

plan ahead.

2. Scale with OpenGL (the UI needs the most

work).

(8)

Dynamic Resolution Scaling

(9)

Step 5 –

Use the right tools

1. There are no good “completely cross

platform” tools. They are generally hardware

specific.

2. Use Intel® Graphics Performance Analyzer

and Intel® VTune™ Amplifier for Intel

(10)

Profile: Intel® Graphics Performance Analyzer

1. Install APK

2. On dev machine,

run System Analyzer

3. Profile

(11)

{Sup}port Android

1. Let the NDK do the hard work. Write minimal JNI wrapper.

2. Add multiple ABIs in Application.mk file (ARMv5, ARMv7, x86).

Build ARM v5…

Build ARM v7a…

Build x86…

(12)

Test on HAXM emulator

1. Download the HAXM

emulator from the

(13)

Test on HAXM emulator

2. Create a new virtual

device with x86 as the

target.

The emulator will run with

hardware acceleration.

(14)

{Sup}port iOS

1. Objective-C works well with C/C++. Isolate

Objective-C code and call into from standard

C/C++.

(15)

{Sup}port Windows

1. Treat Desktop and Metro (aka Windows 8

Store apps) as separate platforms.

2. It’s easy to add touch to the Desktop (with

the latest APIs).

(16)
(17)

Example: Fruit Ninja

A game that runs everywhere

15+ Platforms supported:

iOS

Android

Windows Desktop (XP/Win7) -- Primary Development Platform.

Windows 8 Metro

Windows Phone

Xbox 360

Flash

HTML 5

Symbian^3

Bada

Coin op-arcade

Linux

Smart TVs

Courtesy of

Richard McKinney,

Halfbrick CTO

(18)

Mortar Engine

Mortar Engine

Rendering API (360, D3D9, GLES1, GLES2, D3D11, etc)

Abstractions around Meshes, Vertex Buffers, Index Buffers, Effects, Shaders,

Textures, etc.. Pretty much every API has these concepts which we can

abstract per API.

Sound/Music API (OpenAL, OpenSL, Java, XAudio2, Xact, etc)

We don’t get too complicated with sound in our games, so we’re able to easily

provide abstracted sound handles to games that don’t know the underlying

API.

We’ve actually recently moved towards a software mixer implementation on

most platforms due to the extreme fragmentation within different

(19)

Mortar Engine

Mortar Engine

Input API (DirectInput, Metro, iOS, Android, etc):

This is always specific to the platform. You will notice that the Touch

and Mouse support in Metro is extremely similar to iOS. We have

generic Touch classes that encapsulate the multiple touches you can

subscribe to.

Smaller Items:

FileIO: Sometimes just CRT, sometimes optimal beyond that.

Networking and HTTP communications: Most games need to phone

home.

Social Networking APIs (Facebook and Twitter -> Share Contracts).

IAP/Microtransaction systems (Windows Store, Google Play, iTunes).

Cloud Services: We have rolled our own solution, but platform based

(20)

Mortar Engine

Mortar Engine

Of course not. BUT, most everything else is cross

platform C++ code that works between ALL of our

deployment platforms. Avoid platform

implementations for things you can do in a cross

platform way:

Collision

Math

UI

Serialization

Event Handling

True Type Fonts

Much, much more truly cross platform C++ code.

(21)
(22)
(23)

What is the Marmalade SDK?

Marmalade SDK is a powerful cross-platform SDK for the efficient

development of richer games and apps for mobile, desktop and Smart

TV platforms.

Marmalade is also FAST, FLEXIBLE and OPEN

Marmalade is also FAST, FLEXIBLE and OPEN

Marmalade is highly CROSS-PLATFORM

(24)

Cross-platform

• iOS (3.0+)

• Android (2.3+)

– NOW x86!

• BlackBerry 10 (+ PlayBook OS)

• Windows Phone 8

• Windows (7, Vista, XP3)

• Mac OS X (10.6+)

• LG Smart TV

• iOS (3.0+)

• Android (2.3+)

– NOW x86!

• BlackBerry 10 (+ PlayBook OS)

• Windows Phone 8

• Windows (7, Vista, XP3)

• Mac OS X (10.6+)

• LG Smart TV

Coming next

• Windows Store

• Roku

Coming next

• Windows Store

• Roku

From a single codebase, create native games and apps entirely in

(25)

Fast

• Marmalade enables direct access to

the hardware, providing native

performance on every device

• Compile natively for the CPU

– Maximum CPU performance (not limited

by virtual machines)

(26)
(27)
(28)

Case Studies

(29)

Marmalade Quick: Rapid 2D game dev

• Build 2D games quickly. No need to use C++

• Open source and extendable if needed

• Write in Lua, the fastest scripting language

around

• 2D graphics, animation, fonts, vector shapes,

particles, scene transitions, physics, audio,

databases, web views, networking, Facebook,

ads, analytics, cross-platform billing API

• Uses popular frameworks Cocos2d, Box2D, etc

• Integrated with free ZeroBrane IDE

(30)

Marmalade Quick: Case study

• Flagship game built by

Marmalade Game Studio

• Helped shape Marmalade Quick

• Super-smooth puzzle game

• Lots of great visual effects

• Released simultaneously on App Store,

Google Play, Amazon Appstore, BlackBerry

World

(31)

Marmalade Juice

Marmalade Juice removes brute-force porting from iOS

Keep using Xcode, Objective-C & iOS APIs, for all platforms

Port from iOS to Android without changing how you work

Target all platforms from a single codebase

A single codebase means app updates are easier and cheaper

Only minor modifications needed – so you can focus on optimisation

An Open Source add-on – edit improve/change as you like

(32)

Case Study: Tap Paradise Cove

Top-10 Grossing iOS game

Ported to Android using

Marmalade Juice

Launched on Google Play and

Amazon Appstore

Reached over 1m new users

Now looking to target

iOS/Android from single

Objective-C codebase

(33)

Richer apps are

(34)

Conclusions

• Follow the 5 easy steps to build a truly cross

platform game.

• Intel has a lot of tools and resources to help.

Please contact us!

(35)

The Next Session

• 4:00 p.m. to 5:00 p.m.

• OpenCL—Apply Parallel Compute Capabilities to

2D/3D Scenes

• Presenters: Michał Mrozek and Krzysztof Laskowski

(36)

The Next Session

• 5:30 p.m. to 6:30 p.m.

• Why Render Hidden Objects? Cull Them with a

Software Depth-buffer Rasterizer!

• Presenter: Charumathi Chandrasekaran

(37)

Legal Disclaimers

INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY RELATING TO SALE AND/OR USE OF INTEL PRODUCTS, INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT, OR OTHER INTELLECTUAL PROPERTY RIGHT.

Intel products are not intended for use in medical, life saving, life sustaining, critical control or safety systems, or in nuclear facility applications.

Intel Corporation may have patents or pending patent applications, trademarks, copyrights, or other intellectual property rights that relate to the presented subject matter. The furnishing of documents and other materials and information does not provide any license, express or implied, by estoppel or otherwise, to any such patents, trademarks, copyrights, or other intellectual property rights.

Intel may make changes to specifications, product descriptions, and plans at any time, without notice.

The Intel processor and/or chipset products referenced in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.

All dates provided are subject to change without notice. All dates specified are target dates, are provided for planning purposes only and are subject to change. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others. Copyright © 2012, Intel Corporation. All rights reserved.

(38)

References

Related documents

Except as provided in Vishay's terms and conditions of sale for such products, Vishay assumes no liability whatsoever, and disclaims any express or implied warranty, relating to

Except as provided in Vishay's terms and conditions of sale for such products, Vishay assumes no liability whatsoever, and disclaims any express or implied warranty, relating to

Except as provided in TSC's terms and conditions of sale for such products, TSC assumes no liability whatsoever, and disclaims any express or implied warranty, relating to sale

PROVIDED IN INTEL ’ ’ S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND

WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A

Except as provided in Intel's Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating

Except as provided in Intel’s Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating

Except as provided in TSC’s terms and conditions of sale for such products, TSC assumes no liability whatsoever, and disclaims any express or implied warranty,