Sviluppare giochi per il nuovo windows phone
-
Upload
dan-ardelean -
Category
Documents
-
view
311 -
download
1
description
Transcript of Sviluppare giochi per il nuovo windows phone
Sviluppare giochi per il nuovo Windows Phone
Dan Ardelean, [email protected]@danardelean
a.k.a. Windows Phone 8
Applicazioni Windows Phone 8
Windows Phone 8 API Set
Graphics Audio Media
File System
Networking Input
Commerce Base Types Sensors
Common.NET FX
CoreCLR
Games
Direct3D AppC++
XAML AppC# / VB / HTML
Giochi per Windows Phone 8
1. HTML5
2. XNA
3. XAML C#
4. C# e C++/Direct3D
5. Solo C++/Direct 3D
HTML5Demo
HTML5 e hardware-accelerated IE10CSS 2D Transforms
CSS 3D Transforms
CSS Animations
CSS Backgrounds & Borders
CSS Color
CSS Device Adaptation*
CSS Flexbox*
CSS Fonts
CSS Grid*
CSS Image Values (Gradients)
CSS Media Queries
CSS Multi-Column Layout*
CSS Namespaces
CSS OM Views
CSS Regions And Exclusions*
CSS Selectors
CSS Transitions
CSS Values And Units
Data URI
DOM Element Traversal
DOM HTML
DOM Level 3 Core
DOM Level 3 Events
DOM Style
DOM Traversal And Range
DOMParser And XMLSerializer
ECMAScript 5
Formdata
HTML5 Application Cache
HTML5 Async Scripts
HTML5 BlobBuilder
HTML5 Canvas
HTML5 Drag And Drop
HTML5 Forms And Validation
HTML5 Geolocation
HTML5 History API
HTML5 Parser
HTML5 Sandbox
HTML5 Selection
HTML5 Semantic Elements
HTML5 Video And Audio
JavaScript Typed Array
ICC Color Profiles
IndexedDB
Page Visibility
Pointer (Mouse, Pen, And Touch) Events*
RequestAnimationFrame
Navigation Timing
Selectors API Level 2
SVG Filter Effects
SVG, Standalone And In HTML
Web Messaging
Web Sockets
Web Workers
XHTML/XML
XHR (Level 2)
XHR CORS
CSS32D & 3D Transforms
Transitions
Animations
Shadows
Gradients
Custom Fonts
Costruiamo una applicazione HTML
• Visual Studio 2012
• Windows Phone 8 SDK
HTML5Demo
• Accelerazione Hardware
• VELOCE
• Costruito per ambienti «touch»
• Pronto per applicazioni offline
Internet Explorer 10
Applicazioni HtmlEventi Touch• Usano il modello MSPointer• Supporta multi-touch
Gestures• Catturare gesti su singolo o multipli elementi del DOM• Gesti multipli nello stesso tempo• Riconosce pan e pinch con inerzia
Communicazione• WebBrowser.InvokeScript: App -> Html• ScriptNotify: Html -> App
HTML5Demo Multitouch
Middleware HTML5
CreateJS (Atari Games) http://createjs.com
GameSalad http://gamesalad.com/
ImpactJS http://impactjs.com
Construct 2 from Scirra https://www.scirra.com
PhoneGAP http://www.phonegap.com
XNA
Si può continuare sviluppare con target phone OS
7.1• I giochi funzionano sia su WP 7.x che su WP 8
• Su WP8 accesso alle api di in-app purchase
Si può sviluppare usando MonoGame con target
OS 8.0• Accesso a tutte le nuove API di Windows Phone 8
XNA usando MonoGame
SharpDX https://github.com/sharpdx
MonoGame https://github.com/mono/MonoGame
Direct3D/ C++
XAML AppC# / VB / HTML
SharpDX
MonoGame
MonoGame AggiungeVideo Playback
Native asset loading • png/jpeg/gif/tiff/pdf• wav/mpeg
Lidgren• libreria per networking TCP e UDP• solo rete locale
XNA MonoGameDemo
XAML e C++Riutilizzare codice C++• Librerie C++• Usare Windows Runtime Components per chiamate COM / Win32
Accesso completo alla shared Api con Windows 8• Windows Phone Runtime APIs, COM eWin32 APIs
Direct3D Composition• Render oggetti C++/Direct3D dentro una finestra/elemento XAML
Direct3D 11.1Hardware
Feature level 9.3
DirectXTexhttp://codeplex.com/directxtexWindows Imaging Component (WIC)Direct2D or DWrite
DirectX Tool Kithttp://codeplex.com/directxtkGDID3DX
Gli shader devono essere precompilati (VS 2012)
Elementi rendering XAML C++/Direct3DDrawingSurface• Si comporta come un oggetto XAML• Usa Direct3D swap chain• Composited in automatico insieme agli
oggetti XAML
DrawingSurfaceBackgroundGrid• elemento root con rendering in background• Rendering oggeti XAML sopra la superfice
C++• Non usa Direct3D swap chain• performance migliori
<StackPanel> <Button Content="Start"/> <DrawingSurface Height="200“ Width="200"/></StackPanel>
<DrawingSurfaceBackgroundGrid> <StackPanel VerticalAlignment="Center"> <Button Content="Start"/> </StackPanel></DrawingSurfaceBackgroundGrid>
XAML e C++/Direct3DDemo
Pure C++/Direct3DMassimo delle performancePortabilità codice C++
Statically linked or dll
Supporto MiddlewareHavok, Unity, FMOD, Scaleform, Wwise, Marmalade
Compatibilità con Windows 8Direct3D 11 Level 9.3API condiviso tra le due piattaforme
C++/Direct3DApp lifecycle• CoreApplication, CoreWindow, CoreDispatcher
Accesso alle nuove api di Windows Phone 8• Windows Runtime APIs, COM and Win32 style APIs
Windows.Device.SensorsLaunchers and choosers• Usando URI schemes Launcher::LaunchUriAsync(ref new Uri("http:[URL]"));
– WebBrowserTask, ConnectionSettingsTask, EmailComposeTask, MarketplaceDetailTask,MarketplaceSearchTask,MarketplaceReviewTask
• Sharing social networks ShowShareUI()• Photo PickSingleFileAsync() PickerViewMode::Thumbnail
C++ Direct3DDemo
Supporto Audio
XAudio2Sound effects
Looping, 3D positioning, DSP effects, etc Many at onceIn-memory PCM or ADPCM data
IMFMediaEngineBackground music
One at a timeCompressed (MP3, WMA)Asynchronously streamed Uri or IMFByteStreamControl Playback: Play, Pause, Stop, Loop, Seek
WASAPIRaw PCM Stream
Render & capture Low level API
Architettura XAudio2
Source Voice
Source Voice
Source Voice
Source Voice
Memory Buffer(s)
Memory Buffer(s)
Memory Buffer(s)
Memory Buffer(s)
Mastering Voice
Submix Voice
WASAPI Output
EffectChain
EffectChain
EffectChain
EffectChain
Supporto Audio
XAudio2Sound effects
Looping, 3D positioning, DSP effects, etc Many at onceIn-memory PCM or ADPCM data
IMFMediaEngineBackground music
One at a timeCompressed (MP3, WMA)Asynchronously streamed Uri or IMFByteStreamControl Playback: Play, Pause, Stop, Loop, Seek
WASAPIRaw PCM Stream
Render & capture Low level API
NetworkingWinRT – Windows.Networking.Sockets• TCP – StreamSocket with SSL support• UDP – DatagramSocket• codice cross-platform Win8/WP8
Managed Sockets – System.Net.Sockets• TCP & UDP- Socket, Multicast, Listen
WinSock - winsock2.h, ws2tcpip.h, ….• Winsock API Family; SOCK_STREAM, SOCK_DGRAM
IXMLHTTPRequest2• C++ HTTP Support
PeerFinderBluetooth• raggio 0-100m• Implementazione RFCOMM• usa StreamSocket WinRT (~2.1 Mbit/s)• communicazione App->App e App->Dispositivo
Near Field Communication (NFC)• raggio 2-4cm, low bandwidth (~424 kbit/s)• usa StreamSocket (WinRT) per scambiare pochi dati• Communicazione App->App e App->Dispositivo
File SystemWindows Runtime
StorageFile, StorageFolder, ApplicationDataSupporto per “ms-appx” & “ms-appdata” URI
Win32CopyFile2, CreateDirectoryW, CreateFile2, DeleteFileW, FindClose, FindFirstFileExW, FindNextFileW, FlushFileBuffers, GetDiskFreeSpaceExW, GetFileAttributesExW, GetFileInformationByHandleEx, GetOverlappedResultEx, LockFileEx, MoveFileExW, ReadFile, RemoveDirectoryW, SetEndOfFile, SetFileAttributesW, SetFileInformationByHandle, SetFilePointerEx, UnlockFileEx, WriteFile
In-App PurchaseSimile a Windows 8• stesso namespace and Interface Definition Language IDL
Supporto per «consumable» e «durables»Disponibile in 191 paesi e 50 lingueIntegrazione con il Wallet:• Pagamenti con Carta di credito, Paypal, gift card, mobile operator
protetti da PIN
Funziona per giochi XNA sviluppati per OS 7.1 che girano su WP 8
Resolution ScalingNome Resolution Ratio Scale Scaled
WVGA 480 × 800 15:9 100 480 × 800
WXGA 768 ×1280 15:9 160 480 × 800
720p 720 × 1280 16:9 150 480 × 853
Resolution ScalingResolution-dependent backgrounds and assets1. App.Current.Host.Content.ScaleFactor + Helper Class2. Tutti gli assest in WXGA ScaleDown invece di ScaleUp
Tile and app icons• WXGA
SplashscreenSplashScreenImage.Screen-WVGA.jpg SplashScreenImage.Screen--WXGA.jpgSplashScreenImage.Screen-720p.jpg
DOMANDE