WPUG - 3D Multiplayer from iOS and Android to WP8

44
iOS vs Android vs Windows Phone Windows Phone User Group Edition @ multiplayio # wpdev Phone Wars

description

Presented at Windows Phone User Group in London (22/04/2013). Video: https://vimeo.com/64767100 More info: http://multiplay.io

Transcript of WPUG - 3D Multiplayer from iOS and Android to WP8

Page 1: WPUG - 3D Multiplayer from iOS and Android to WP8

iOS vs Android vs Windows PhoneWindows Phone User Group Edition

@multiplayio#wpdev

Phone Wars

Page 2: WPUG - 3D Multiplayer from iOS and Android to WP8

In a galaxy far far Away.…

@multiplayio#wpdev

Page 3: WPUG - 3D Multiplayer from iOS and Android to WP8

Hello

@multiplayio

• Architecture Overview• Gameplay Demo• Getting Started• C# and C++• Direct3D and OpenGL• Controls• File Access• Profiling• Publishing• Bonus Demo• Q&A

#wpdev

Page 4: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio

3D Multiplayer Multi-Platform Games Engine

#wpdev

Page 5: WPUG - 3D Multiplayer from iOS and Android to WP8

Framework Layer

Engine

App Layer Platform Layer

@multiplayio

Supporting Multiple Platforms

Renderer API

App

#wpdev

Controls API

File API

Scenes

Objects

Page 6: WPUG - 3D Multiplayer from iOS and Android to WP8

Java C++

@multiplayio

Android onTouch

#wpdev

onTouch onTouch

Framework Layer

Controls API

Page 7: WPUG - 3D Multiplayer from iOS and Android to WP8

Objective C C++

@multiplayio

iOS onTouch

#wpdev

onTouch onTouch

Framework Layer

Controls API

Page 8: WPUG - 3D Multiplayer from iOS and Android to WP8

Framework Layer Device Layer

@multiplayio

Opening a File on iOS

#wpdev

OpenFile OpenFile

C++

fopen

App

Objective C

Get iOS User Folder

fread

fclose

Page 9: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio#MongoDBdays

Cross-Platform Hybrid Multiplayer Stack

MongoDB

Sockets

NodeJS

Networking Logic

Web View

DOM/Canvas App

WebGLApp

Native AppApp

Page 10: WPUG - 3D Multiplayer from iOS and Android to WP8

Gameplay Demo

@multiplayio

http://multiplay.io/play/phonewars

#wpdev

Page 11: WPUG - 3D Multiplayer from iOS and Android to WP8

Getting Started

@multiplayio#wpdev

• Folder structure• Debug Configurations• .vcproj files

• <IncludePath>• Bundling assets

• packager.bat

Page 12: WPUG - 3D Multiplayer from iOS and Android to WP8

Getting Started

@multiplayio#wpdev

Page 13: WPUG - 3D Multiplayer from iOS and Android to WP8

Getting Started

@multiplayio#wpdev

Page 14: WPUG - 3D Multiplayer from iOS and Android to WP8

Getting Started

@multiplayio#wpdev

Page 15: WPUG - 3D Multiplayer from iOS and Android to WP8

Just include all source files and you’re done

@multiplayio#wpdev

Page 16: WPUG - 3D Multiplayer from iOS and Android to WP8

Search Paths (Sorry)

@multiplayio#wpdev

Page 17: WPUG - 3D Multiplayer from iOS and Android to WP8

Bundle a folder

@multiplayio#wpdev

Page 18: WPUG - 3D Multiplayer from iOS and Android to WP8

Bundle a folder

@multiplayio#wpdev

Page 19: WPUG - 3D Multiplayer from iOS and Android to WP8

C# and C++

@multiplayio#wpdev

• XAML required for good OS integration• Use DispatchTimer to stay in the same thread• Messaging C++ and back• Scary ^ % symbols• Converting from WinRT types and back

Page 20: WPUG - 3D Multiplayer from iOS and Android to WP8

Messaging C++

@multiplayio#wpdev

Page 21: WPUG - 3D Multiplayer from iOS and Android to WP8

Messaging C++

@multiplayio#wpdev

Page 22: WPUG - 3D Multiplayer from iOS and Android to WP8

Messaging C++

@multiplayio#wpdev

Page 23: WPUG - 3D Multiplayer from iOS and Android to WP8

Messaging C#

@multiplayio#wpdev

• You can’t officially• Workaround have C# poll C++

Page 24: WPUG - 3D Multiplayer from iOS and Android to WP8

Framework Layer

Engine

App Layer Platform Layer

@multiplayio

Direct3D for OpenGL

Renderer API

App

#wpdev

Controls API

File API

Scenes

Objects

Page 25: WPUG - 3D Multiplayer from iOS and Android to WP8

Renderer

Renderer

D3DRenderer

OGLRenderer

@multiplayio

Supporting Direct3D

#wpdev

SetBlend GLEnable(GL_BLEND)

Direct3D

OpenGL

OMSetBlendState

SetBlend GLEnable(GL_BLEND) glEnable(GL_BLEND)

Page 26: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio

Supporting Direct3D

#wpdev

Page 27: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio

Supporting Direct3D

#wpdev

Page 28: WPUG - 3D Multiplayer from iOS and Android to WP8

Supporting Direct3D

@multiplayio#wpdev

• Beware of Draw Calls• Transpose matrices• No runtime shader compiler• Open source alternative - ProjectAngle• Minimal changes to support Windows 8• No out of the box JPG PNG support

• Use libPNG and libJPEG• Cocus2D Open Source Example

Page 29: WPUG - 3D Multiplayer from iOS and Android to WP8

Direct3DInterop Platform Layer

@multiplayio

Controls

#wpdev

OnPointerPressed touchBegin

Framework Layer

Controls API

Page 30: WPUG - 3D Multiplayer from iOS and Android to WP8

Controls

@multiplayio#wpdev

Page 31: WPUG - 3D Multiplayer from iOS and Android to WP8

Controls

@multiplayio#wpdev

Page 32: WPUG - 3D Multiplayer from iOS and Android to WP8

Controls

@multiplayio#wpdev

Page 33: WPUG - 3D Multiplayer from iOS and Android to WP8

File Access

@multiplayio#wpdev

• Marble Maze• BasicReaderWriter.cpp

Page 34: WPUG - 3D Multiplayer from iOS and Android to WP8

Framework Layer Device Layer

@multiplayio

Opening a File on iOS

#wpdev

OpenFile OpenFile

C++

fopen

App

Objective C

Get iOS User Folder

fread

fclose

Page 35: WPUG - 3D Multiplayer from iOS and Android to WP8

File Path

@multiplayio#wpdev

Page 36: WPUG - 3D Multiplayer from iOS and Android to WP8

Read Data

@multiplayio#wpdev

Page 37: WPUG - 3D Multiplayer from iOS and Android to WP8

Read Data

@multiplayio#wpdev

Page 38: WPUG - 3D Multiplayer from iOS and Android to WP8

Platform::Array<byte>

@multiplayio#wpdev

Page 39: WPUG - 3D Multiplayer from iOS and Android to WP8

Profiling

@multiplayio#wpdev

• Memory not supported for D3D Apps• Do it manually

• On device profiling tricky

Page 40: WPUG - 3D Multiplayer from iOS and Android to WP8

Profiling

@multiplayio#wpdev

• Memory not supported for D3D Apps• Do it manually

• On device profiling tricky

Page 41: WPUG - 3D Multiplayer from iOS and Android to WP8

Publishing

@multiplayio#wpdev

• Change only on fail• ARM• Debug on Native for screenshots• PEGI - https://wp-rating.pegi.eu/Games/Submit

• Markets• In-App Purchasing• WMAppManifest.xml

Page 42: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio

Editor Demo

#wpdev

Page 43: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio

QUESTIONS?

#wpdev

Page 44: WPUG - 3D Multiplayer from iOS and Android to WP8

@multiplayio

THANKS!

“Fast Delivery. Changed my life. Should present again. A+++++”

- iBot5

“I wanted to be a pop star before this, but now I just want to program JavaScript!”

- Zombie Justin B.

#wpdev