移植 Cocos2d-x 遊戲至 Windows Store 及 Windows Phone

除了 Unity 之外,Cocos2d-x 是另一個台灣遊戲開發者很常使用的 2D 遊戲引擎,Cocos2d-x 在 Windows 及 Windows Phone APIs 的支援上與 iOS 及 Android 完全相同,也就是要將 Cocos2d-x 所製作的遊戲移植至 Windows 平台並不困難,順利的話一個遊戲約數個小時即可移植成功。

簡單來說是以下 6 個步驟:

  1. Create a Cocos2d-x project using project creator tool.
  2. Create Windows 8 and Windows Phone projects in Visual Studio.
  3. Copy the source code consisting of C++ and header files to the project Classes directory. Add these files to your project in Visual Studio
  4. Copy resources to the project Resources directory.
  5. Modify a couple of project settings necessary for compilation.
  6. For Windows Phone, convert any MP3 files to WAV files. Similarly, for Windows Phone replace fonts that are not supported by Windows Phone or update the code to use fonts available on the platform.

你需要:

1. Windows 8.1 (64 bit) 評估版: http://technet.microsoft.com/zh-tw/evalcenter/hh699156.aspx 

2. Visual Studio Express 2013:http://www.microsoft.com/en-us/download/details.aspx?id=43729

3. 註冊 Windows 市集以上架: http://blogs.msdn.com/b/mengtsai/archive/2014/09/23/windows-2014-09.aspx

以下段落完全轉貼自Porting Cocos2D-x Games to Windows Store and Windows Phone,文章中詳細說明了環境需求、移植步驟、小技巧及故障排除等資訊給各位參考:

source: Porting Cocos2D-x Games to Windows Store and Windows Phone

Setup your Development Environment

Before we begin, let us set up Visual Studio for developing the game. We will use Visual Studio Express editions for porting the game. Visual Studio Express editions are free to download and is a great way to begin developing for Windows 8 and Windows Phone. Visual Studio comparison guide can help if you are considering another edition for your project.

Download Visual Studio Express 2013 for Windows and Visual Studio Express 2012 for Windows Phone from Visual Studio Express site. The pre-requisites for Visual Studio Express 2013 include Windows 8.1. For Windows Phone emulation to work on the PC, you need Windows 8 Pro with a processor with SLAT support. If you are running Windows 8, you can upgrade to Windows 8.1 for free from the Windows Store. The Visual Studio express editions can be installed side by side with other versions of Visual Studio. Look at the pre-requisites carefully before installing these tools.

The installation for Visual Studio is quite simple. When you run Visual Studio for the first time, it will prompt you to obtain a developer license. You need to get a developer license for each machine on which you want to run the app.

Download Cocos2d-x Distribution

You should clone Cocos2d-x distribution on your development machine. Use the following commands to do so:

C:>git clone https://github.com/cocos2d/cocos2d-x.git
C:>cd cocos2d-x
C:cocos2d-x>git checkout master
C:cocos2d-x>git submodule init
C:cocos2d-x>git submodule update

After these commands have completed, you will have a clone of Cocos2d-x master branch on your desktop.

If you using Github application on your Windows machine, visit http://github.com/cocos2d/cocos2d-x. Click Clone in Desktop.

image

Download the Sample Application

Download or clone the sample Cocos2d-x C++ application from https://github.com/iTyran/SK_Parkour. You can use command line git commands or the Github application to do so.

C:temp>git clone https://github.com/itran/sk_parkour

Porting the Application
Create a new Cocos2d-x Project

Before we begin porting the application, we need to create a Cocos2d-x project. Cocos2d-x comes with a project creation tool. You will need Python to run the project creation tool. Install python from http://www.python.org if needed.

C:cocos2d-x>cd toolsproject-creator
C:cocos2d-xtoolsproject-creator>python create_project.py -project parkour -package com.mycompany.parkour -language cpp

proj.ios                : Done!
proj.android            : Done!
proj.win32              : Done!
proj.winrt              : Done!
proj.wp8                : Done!
proj.mac                : Done!
proj.blackberry         : Done!
proj.linux              : Done!
proj.marmalade          : Done!
proj.tizen              : Done!
proj.wp8-xaml           : Done!
New project has been created in this path: C:cocos2d-xtoolsproject-creator/..
/../projects/parkour
Have Fun!

This creates a skeleton project structure that can be used for developing multi-platform applications. The directories for the project are organized as follows:

C:cocos2d-x>cd toolsprojectsparkour
C:cocos2d-xprojectsparkour>dir

Directory of C:cocos2d-xprojectsparkour

03/24/2014  01:55 PM    <DIR>          .
03/24/2014  01:55 PM    <DIR>          ..
03/24/2014  01:55 PM    <DIR>          Classes
03/24/2014  01:55 PM    <DIR>          proj.android
03/24/2014  01:55 PM    <DIR>          proj.blackberry
03/24/2014  02:47 PM    <DIR>          proj.ios
03/24/2014  01:55 PM    <DIR>          proj.linux
03/24/2014  02:47 PM    <DIR>          proj.mac
03/24/2014  02:47 PM    <DIR>          proj.marmalade
03/24/2014  01:55 PM    <DIR>          proj.tizen
03/24/2014  02:47 PM    <DIR>          proj.win32
03/24/2014  02:47 PM    <DIR>          proj.winrt
03/24/2014  02:47 PM    <DIR>          proj.wp8
03/24/2014  02:47 PM    <DIR>          proj.wp8-xaml
03/24/2014  01:55 PM    <DIR>          Resources

Apart from various platform specific directories, the two directories of interest are Classes and Resources. From their names it is clear that Classes should hold our game classes and resources should hold various game resources such as images, audio files and fonts.

In fact, the project creator tool populates the classes with “Hello World”, a very simple game that we can compile and run as is. Start Visual Studio Express 2013 for Windows and click File -> Open project.. and navigate to c:cocos2d-xprojectsparkourproj.winrt and select parkour_2013.sln Microsoft Visual Studio Solution file.

clip_image004[4]

After Visual Studio has opened the project, click the Local Machine button with the green triangle or Debug > Start Debugging (or Start Without Debugging).

clip_image006[4]

After Visual Studio builds the files that are out of date, you should have the application running in Windows 8 mode.

clip_image008[4]

Modify Target Application

Now that we are able to run simple application on Windows 8, we are ready to port our target application.

Copy project class files to Classes directory

We will copy classes from the directory in which we downloaded SK_Parkour application to the newly created Parkour Classes directory.

C:cocos2d-x>cd toolsprojectsparkour>
C:cocos2d-x>cd toolsprojectsparkour>xcopy tempsk_parkourclasses
C:cocos2d-xprojectsparkour>xcopy C:tempSK_ParkourprojectsParkourCPPClasses Classes /Y /s
C:tempSK_ParkourprojectsParkourCPPClassesAppDelegate.cpp
C:tempSK_ParkourprojectsParkourCPPClassesAppDelegate.h
C:tempSK_ParkourprojectsParkourCPPClassesAppMacros.h”

26 File(s) copied

Copy Resources to Resources Directory

We will copy resources from SK_Parkour Resources subdirectory to the newly created Parkour Resources directory.
C:cocos2d-xprojectsparkour>xcopy C:tempSK_ParkourprojectsParkourCPPResources Resources /Y /s
C:tempSK_ParkourprojectsParkourCPPResourcesbackground.mp3
C:tempSK_ParkourprojectsParkourCPPResourcescrouch.mp3
C:tempSK_ParkourprojectsParkourCPPResourcesjump.mp3

26 File(s) copied

Add Source Code to the Visual Studio Project

We will add newly copied C++ files from Classes directory to the project. In Visual Studio, right click on Classes folder and then click Add > Existing Item..

clip_image010[4]

Select all cpp and h files from c:cocos2d-xprojectsparkourClasses and click Add.

clip_image012[4]

Execute the application by selecting Debug > Run.

clip_image014[4]

Porting the Game to Windows Phone

Now that we have ported the game to Windows 8, let us see what it takes to port the game to Windows Phone.

Start Visual Studio Express 2012 for Windows Phone and open parkour.sln, the Visual Studio solution file contained in c:Cocos2d-xprojectsparkourproj.wp8-xaml. Do not use proj.wp8 project which is being deprecated.

Apart from various library projects such as CocosDenshion, libChipmunk, there are two application related projects, namely, parkour and parkourComponent. The former is a C# project which is used to provide the primary application framework. The latter is a C++ project and includes the application files.

Add all sources to the C++ project. Right click on the Classes folder in the parkourComponent project. Click Add followed by Existing Item. Navigate to c:cocos2d-xprojectsparkourclasses directory, select all CPP and h files and click OK.

We have already copied all resource files to c:cocos2d-xprojectsparkourresources directory. Otherwise, you will need to remember to copy resources from the original application to the resources directory.

Audio file support on Windows Phone

There are two changes needed to make the application run on Windows Phone. Windows Phone only supports WAV audio files and not the MP3 files which are used in this application. We need to add corresponding WAV files for Windows phone project.

You can use a free, open-source software like Audacity to convert the MP3 files to WAV files. A number of online solutions also provide audio format conversion. Convert the original MP3 filea and add the converted WAV files to Resources directory at c:cocos2d-xprojectsparkourresources.

Cocos2d-x for Windows Phone is designed to not load .MP3 files but instead load corresponding .WAV files. For example, if it encounters a command to load or play “jump.mp3”, it will look for “jump.wav” file and load it instead. This will allow you to port the application without making any changes.

Alternately, you can modify the code so that it uses WAV files on Windows Phone app. For example, in MainScene.cpp, use the following code so that it uses WAV files on Windows Phone whereas MP3 files on other platforms.

#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8

audioEngine->preloadBackgroundMusic("background.wav");

audioEngine->preloadEffect("jump.wav");

audioEngine->preloadEffect("crouch.wav");

audioEngine->preloadEffect("pickup_coin.wav");

#else

audioEngine->preloadBackgroundMusic("background.mp3");

audioEngine->preloadEffect("jump.mp3");

audioEngine->preloadEffect("crouch.mp3");

audioEngine->preloadEffect("pickup_coin.mp3");

#endif

Similarly, modify the code in runner.cpp, playscene.cpp files to use WAV files.

#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8

audioEngine->playBackgroundMusic("jump.wav", true);

#else

audioEngine->playBackgroundMusic("jump.mp3", true);

#endif

Font support on Windows Phone

The application uses Helvetica true type font. However, Helvetica is not among the fonts supported on Windows Phone. A font that is not available on the system must be included in the assembly as a resource. As a result, you can add necessary font, as a ttf file, to Resourcesfonts directory or use a different font available on Windows Phone. For this project, we will use Arial font for our Windows Phone project.

Modify the code in the following way to use Arial font on Windows Phone 8 whereas Helvetica on other platforms. Make similar changes in StatusLayer.cpp, CCLabelTTF.cpp, and CCControlButton.cpp.

#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8

    this->labelCoin = CCLabelTTF::create("Coins:0", "Arial", 25);

#else

    this->labelCoin = CCLabelTTF::create("Coins:0", "Helvetica", 25);

#endif

Once you have completed these code changes, click Debug > Run without Debugging to run the application in the Windows Phone emulator.

clip_image016[4]

Tips, Tricks and Troubleshooting
  1. Where do I add my game logic in the Windows Phone project? (or How is the Windows Phone solution organized? )
    The Windows Phone Cocos2d-x solution created by the project creator tool includes two different projects – a C# project and a C++ project. For a project called ‘mygame’, the Windows Phone creates two different projects in the Visual Studio solution named ‘mygame’. It includes a C# project called ‘mygame’ and a C++ project called ‘mygameComponent’. The C# project provides the basic application framework whereas the game logic is part of the C++ project. In most situation, you will not need to modify the C# project. Make sure that you include your C++ code in ‘mygameComponent’.
  2. How do I include custom/third party DLLs used in my game?
    Windows Phone applications are built for both the development environment (Win32/x86) as well as the real physical devices running on ARM. As such, custom/third party DLLs are needed for both Win32/x86 and ARM environments. Additionally, they need to be available in both Debug and Release environments. Four different version of custom/ third party DLLs need to be included with the application. These DLLs should be marked as ‘Content’ so that they are bundled in the application package.
    What is the exact way to accomplish this? Do you include 4 different versions?
  3. Are there any limits on the size of the app on Windows Phone? (or How to reduce the size of Windows Phone app?)
    Windows Phone imposes a default memory limit on an app based on the type of app and the memory size of the device. Be aware that on low memory devices, the default memory limit for the app is 150 MB and as such, Windows Phone app should minimize its memory usage where possible. Since .wav audio files are bigger than their corresponding MP3 files, be judicious of the sampling rate and stereo/mono when converting MP3 files to WAV files.You can also manage the amount of texture memory used by the application. Debug build of Windows Phone shows the amount of texture memory being used. You can use this information to tweak the memory usage of your application.You can selectively turn off of features of your app for lower memory devices or you can choose to opt out of availability for lower memory devices.
  4. Developing on Mac using Fusion/Parallel/Bootcamp.
    Look at
    http://blogs.msdn.com/b/interoperability/archive/2012/12/21/how-to-develop-for-windows-phone-8-on-your-mac.aspx on how to develop Windows Phone apps on Mac for details
  5. Developing Windows Phone application using Visual Studio 2013 or Visual Studio 2013 Express. While Visual Studio 2012 Express for Windows Phone includes the Windows Phone SDK, you can install Windows Phone 8 SDK separately and use Visual Studio 2013. See https://dev.windowsphone.com/en-us/downloadsdk for instructions.
  6. I have installed Visual Studio but I am not able to open the Windows Phone project.
    If you are seeing an error opening Visual Studio solution file in WP8-xaml directory make sure that you have installed Windows Phone SDK. Windows Phone 8 SDK can be installed from
    https://dev.windowsphone.com/en-us/downloadsdk.Alternately, install and use Visual Studio 2012 Express for Windows Phone for developing Windows Phone game.
  7. I have set breakpoints in my C++ code but the app never stops at those breakpoints during while debugging.
    Cocos2d-x Windows Phone solution consists of a C# project and C++ project of which the C# project is the startup project. In order to debug the C++ code, you will need to enable debugging native code. To enable debugging C++ code, right click the C# project and select properties. In Debug tab, select ‘Native only’ in ‘UI Task’ drop down for Debugger Type.
  8. I believe I have some issues with platform specific parts of my app. The game works alright on iOS and Android but not only Windows Phone.
    If you have any platform specific code in your game, make sure that you handle Windows Phone and Windows 8 properly. Platform specific code is often enclosed using #ifdef that checks for iOS and Android. You will need to enclose Windows Phone and Windows 8 platform specific code using #ifCC_TARGET_PLATFORM == CC_PLATFORM_WP8 for WP8 and #ifCC_TARGET_PLATFORM == CC_PLATFORM_WINRTfor Windows 8.
  9. How do I add my resources if my project structure is non-standard? Visual Studio uses MSBuild for building the application. The MSBuild task included with the Windows Phone project looks for resources in the global resources directory and recursively copies them in the .xap file, i.e. the application package. If your game resources are kept in a different directory or organized differently, you will need to modify the MSBuild task. From Visual Studio, unload the C# project, edit .vcproj file to modify the following MSBuild task.

    <ItemGroup>

    <ContentInclude="……Resources***">

    <Link>AssetsResources%(RecursiveDir)%(FileName)%(Extension)</Link>

    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

    </Content>

    </ItemGroup>

  10. My app does not use TTF fonts. What can I do?
    Windows Phone only supports TTF fonts. Consider using TTF fonts for Windows using platform specific code for WP8 and WinRT.
  11. How do I test my app on Windows Phone device?
    You should deploy and test your app on a real phone before you submit the app to the Windows Phone store.
    To deploy the app on a real phone, you must be a registered developer. See
    Windows Phone developer registration.
    Once you have tested your app in the emulator, it is time to deploy the application on a real phone. Before you deploy your application to a real phone, you need to register your phone for development. Please follow instructions specified on
    this web page.The next step is to deploy the app to a Windows Phone device. Follow instructions on this web page.
  12. My application runs in the emulator but not on a real Windows Phone device.
    1. Missing V11 folder. Uninstall everything and install the recommended config.
    2. Follow troubleshooter specified on this web page.
Summary

In this article, we saw how incredibly easy it is to port a Cocos2d-x app written in C++ to Windows 8 and Windows Phone. MSOpenTech, a Microsoft subsidiary focused on interoperability with Open Source software, has done most of the heavy lifting. The Cocos2d-x on Windows 8 and Windows phone provide identical APIs making it easy to port the applications.

The steps involved

  1. Create a Cocos2d-x project using project creator tool.
  2. Create Windows 8 and Windows Phone projects in Visual Studio.
  3. Copy the source code consisting of C++ and header files to the project Classes directory. Add these files to your project in Visual Studio
  4. Copy resources to the project Resources directory.
  5. Modify a couple of project settings necessary for compilation.
  6. For Windows Phone, convert any MP3 files to WAV files. Similarly, for Windows Phone replace fonts that are not supported by Windows Phone or update the code to use fonts available on the platform.
    If you have already written a multi-platform game, you are likely to haven completed a few of these steps already. If you are planning to develop a multi-platform game, you can take care of some of these steps in the beginning to open up a huge new market of Windows 8 devices and Windows Phones with very little extra effort.

【推薦序】Windows 8.x App市集應用程式開發-使用C#/章立民

作者: 章立民

出版社:碁峰

出版日期:2014/05/09

博客來: http://www.books.com.tw/products/0010634550 

Windows 8.x App市集應用程式開發-使用C#

2014年四月初,就在我正要啟程前往美國舊金山,參加微軟一年一度的開發者大會BUILD之前,欣聞章立民老師(我們私下敬稱為「章公」)即將發表這本新書,時機正巧,同時也別具意義。

 

這次的BUILD大會中不但宣佈了微軟將擁抱各類型裝置的決定,同時更朝Open SourceCross-Platform (跨平台)的方向邁進一大步。而針對 Windows Apps 的開發者而言,有幾點特別值得介紹:

1.     對台灣開發者最有感的,大概是取消了註冊 Windows Store 開發者中心時的「信用卡」驗證吧。不但馬上嘉惠了全台9成以上沒有信用卡的學生族群,也簡化了註冊流程,讓開發者能更容易將App上架,同時也增加了以 PayPal 付款的機制。

2.     付費App多了兩種價格可以設定: $0.99 (NT$30) $1.29(NT$40)。這項改變是來自於在 Windows Phone 市場上的學習這兩種價格即涵蓋了一半以上 (55%) 的付費交易量。

3.     而最重要的,應該是微軟在 WinRT (Windows Runtime) 上的持續投資及未來方向。BUILD上宣佈了 Universal Apps 這個新模版,開發者將可以一次開發出 Windows Phone Windows Store App;而這背後的意義,即在於WinRT 亦成為開發Windows Phone App的核心機制了;不僅如此,WinRT 也將成為未來不同裝置,如 Xbox One Apps等的重要基礎。

image

目前在台灣 Windows 市集中有許多廣為人知、下載量名列前茅的 App 皆出自章老師的直接參與。章老師以其豐富的教學經驗及諸多專案的實務經驗,在本書中由淺入深,以實例帶領開發者學習各項 Windows Store 開發及 WinRT 知識,而本人尤其喜愛第七章資料繫結、第十三章使用Azure服務及第十五章JSON的整合運用,期待各位在學習基礎知識之後能發揮創意,將您的 App 拓展到世界各地!

延伸閱讀:  //BUILD/ 開發者大會- Windows Apps 課程 10 大重點

 

 

 

 

微軟 Hackathon 熱血黑客松又來了啊! //publish/

歡迎跟我們一起參加由微軟所舉辦的 //publish/ 活動。在這個充滿開發趣味的免費跨夜活動中,您可以帶著您的 app 或遊戲專案與世界上其它地方的開發人員一起撰寫程式!活動中,您除了可以找其它夥伴一起合作完成,也可與現場的技術專家討論 app 的設計、如何提升品質、或是任何關於移植專案的想法 (如: Unity 專案),讓你們能在這密集的 32 小時活動中,順利將你的作品移植到 Windows Phone、平板或是 PC 平台上!

活動現場有來自微軟以及社群中的專家,他們將能協助參加者解決開發 app 上的一切困難。在您完成專案後,現場也提供測試環境、測試機器等,讓您確保您的 app 有最好的品質,向全世界展現您自豪的作品!

這個活動提供了 Surface及Windows Phone來獎勵現場展示的優秀作品,也會獎勵活動後完成 app 上架的作品。更重要的是 – 若您的作品是在 2014 年 6 月 1 日前完成上架的 Windows 市集應用程式(包含 Windows Phone 應用程式),將可以角逐更大的獎項!


Register Now!

請上 //publish/ Developer Contest 網站瞭解更多訊息!

Taipei, Taiwan 
Overnight Event: May 16 – 17 

華山1914文化創意產業園區

台北市八德路一段1號

Taipei,

 

100

 

Taiwan

第一天

10:00 AM – 11:-00 AM 報到及開場
11:00 AM – 12:-30 PM 專心寫程式 與 專家交流
12:30 PM – 1:30 PM 午餐/Webcast
1:30 PM – 6:00 PM 專心寫程式 與 專家交流
6:00 PM – 7:00 PM 晚餐/Webcast
7:00 PM – 11:00 PM 專心寫程式 與 專家交流
11:00 PM – 12:00 AM 宵夜

第二天

12:00 AM – 9:00 AM 熬夜寫程式 與 專家交流
9:00 AM – 10:00 AM 早餐/Webcast
10:00 AM – 1:00 PM 專心寫程式 與 專家交流
1:00 PM- 2:00 PM 午餐/Webcast
2:00 PM – 5:00 PM 專心寫程式 與 專家交流
5:00 PM – 6:00 PM App 展示/評分及頒獎

Register Now!

您可至 http://dev.windows.com/http://dev.windowsphone.com/ 取得開發工具。

更多訊息: 從 //build/ -> //learn/ 到 //publish/

報名若有任何問題,請聯絡 dpetwaa@microsoft.com

//BUILD/ 開發者大會- Windows Apps 課程 10 大重點

微軟在此三天的研討會中密集進行了近 200 堂的課程,以下整理出 10 個 Windows Apps (Windows Store App 或 Windows Phone App) 相關課程的重點資訊給各位參考: 

1. 取消了註冊 Windows Store 開發者中心時的「信用卡」驗證!

也就是全台9成以上沒有信用卡的學生族群,不但能透過 DreamSpark 取得一年免費上架的帳號,現在起無需信用卡即能建立自己的市集帳號,並上傳自己的 App 。同時也增加了以 PayPal 付款的機制。

image

2. 付費 Windows Store App 多了兩種價格(包含IAP)可以設定: $0.99 (NT$30) 及 $1.29(NT$40)

這項改變是來自於在 Windows Phone 市場上的學習–這兩種價格即涵蓋了7成的付費交易量! 同時,Windows Phone App 也新增了 $500 以上的價格可供選擇。

image

3. 開發者即將能夠直接回應使用者的回應了! (要等 Dev Center 更新)

image

(以上 1.~3. 點來源: Maximizing Revenue for Phone, Tablet and PC Apps in the Windows Store)

4. 上架審核時間大幅縮短! Windows Phone App 由原本的 2~5天縮短至只要數個小時

這點有許多台灣的開發者已體驗到了,甚至有在一天之內完成 App 上架並完成多次 update 的經驗;至於 Windows Store App 的審核時間也即將有相同的加速。

image

5. Universal Apps 的宣佈是本次 BUILD 的重點之一,這個 Visual Studio 2013 的新模板讓開發者能一次開發出 Windows Store 及 Windows Phone 的 App

除了是因為 Windows Phone 底層開發架構 (Application Model) 轉為與 Windows Store App 一致 (使用 WinRT- Windows RunTime),以及開發工具的支援之外,在二個市集也作了以下整合:

    • 可指定一個橫跨 Windows Store 及 Windows Phone 市集的 App 名稱
    • 付費 App 只需購買一次 (Buy once, get on both Stores)
    • 統一的應用程式內購買 (適用於 ‘durables’)
    • 資料漫遊 (適用 8.1 Apps)
    • 單一的通知機制,使用WNS (適用 8.1 Apps)

image

6. 針對 Windows Phone App 而言,由於使用者可能使用 7.X/8.0/8.1 的作業系統,將會有單一 App擁有多個 packages 的情形:

    • 所有既有的 7.1/8.0 的 Apps 可相容於 WP8.1 的機器
    • 針對既有的 7.1/8.0 的 Apps,開發者可新增一個 8.1 的 package
    • 使用者升級至 8.1 時即可取得此新增的 8.1 package 更新
    • 開發者可各別更新不同版本的 packages

image

(以上4.~6.來源: Windows Phone and Windows: Dev Center and App Submission Deep Dive)

7. 使用者是如何使用您的 App 的? 利用 Application Insights 可進行深入了解

自己實測了一下,通過 Visual Studio Online 的免費服務,設定上很簡單,約5~10分鐘後就能看到報表了。如:

每天的活躍使用者數: (也許 Apps 下載量很高但沒人在用?)

image

回鍋使用者 vs. 全新使用者比例: (可搭配上圖來分析,發現 App 使用者的黏著度)

image

(以上第 7. 點來源: Make Data-Driven, High-Impact Improvements to an Application with Application Insights)

8.  「Windows Store App 如何和桌面應用程式溝通?」「可以在 Windows Store App 裡呼叫以前寫的程式嗎?」

在 Windows 8.1 或之前的版本,第一個問題的解答是: 通過 Contract 分享,或是透過”剪貼簿”的方式,但兩者都是透過間接方式來作溝通;而第二個問題的解答就是:「很難,大部份要重寫…><」

Windows 8.1 Update 1推出之後這兩個問題都有較好的解答,首先是針對 side-loaded (側載) 的 Windows Store Apps,將能透過 Network Loopback 的方式「直接」與其他應用程式溝通;同時,已可以透過 Brokered Windows Runtime Components (類似 proxy/stub),讓 Windows Store App 可以呼叫以前的程式。

image

以下是 Network Loopback 及 Brokered WinRT 兩種方式的比較:

image

(以上第 8. 點來源: Respecting Your Investments: How to Leverage Your Existing Code In a New Windows Runtime LOB App)

9. 到底是 Web 好還是 App 好?

Strategies for Developing Cross-Device Applications with Visual Studio 2013 這堂課作了非常好的討論,並給予了開發者一些準則及實務作法:

首先提到開發者們都在尋找一個同時能最佳化使用者經驗 (UX)、又能減少開發難度的「聖杯」(Holy Grail)

image

如果客戶已經有 Web Applications 了,如何因應不同種類的裝置提昇使用者經驗? 四種方式:

image

如果要在各平台使用不同的語言、不同的工具開發 Native App 以達到滿意的使用者經驗,客戶能負擔開發及維護成本嗎?

image

可以使用一種工具 (Visual Studio + Xamarin),使用一種程式語言 (C#),就是「聖杯」了! 微笑

image

10. Xbox One 的 OS 架構中,請注意你可以找到三個 OS:

底層的 OS 是類似 Hyper-V 的 hosting OS,其上左邊的 OS core 即為 Windows 8.1,處理 Xbox One 的選擇介面,提供如 Streaming, Storage 等系統服務之外,當然也可以跑 Apps! 右邊的即是用來跑遊戲用的 OS (講師的話中提到 Windows 9…)。

image

各位可以在 https://channel9.msdn.com/Events/Build/2014 觀看或下載所有的課程錄影及投影片,內容包含 Windows 8.1, Windows Phone 8.1, Xbox One, ASP.NET, .NET/C# 的未來等。

針對 Windows Phone 8.1 的重點整理可見我同事 Herman Wu 的分享: http://blogs.msdn.com/b/hermanwu/archive/2014/04/07/build-2014-windows-phone-8-1-session.aspx

至於 BUILD 的 Keynote 精華,則可見我另一同事上官神人的整理:

//Build/ 2014 第一天 Keynote 重點整理 (上)

//Build/ 2014 第一天 Keynote 重點整理 (下)

//Build/ 2014 第二天 Keynote 重點整理 (上)

//Build/ 2014 第二天 Keynote 重點整理 (下)

免費電子書下載: 「Location Intelligence for Windows Store apps」

Table of Contents

· Chapter 1: Getting Started

· Chapter 2: The Sensor and Location Platform

· Chapter 3: Bing Maps JavaScript API

· Chapter 4: Bing Maps Native API

· Chapter 5: Bing Maps REST Services

· Chapter 6: Bing Spatial Data Services

· Chapter 7: Working with Spatial Data

· Chapter 8: Drawing on the Map

· Chapter 9: Creating an Augmented Reality App

· Chapter 10: Creating a Templatable Compass Control

· Chapter 11: Cross Platform Development

image

下載點: http://rbrundritt.files.wordpress.com/2014/02/location_intelligence_for_windows_store_apps.pdf

本書範例程式碼: http://code.msdn.microsoft.com/Location-Intelligence-for-1c691d0e

 

Unity X Windows 實作營成果

2014 年首次,由資策會、奇銳科技及台灣微軟共同舉辦的 Unity X Windows 實作營已於 2月22日 (六) 順利完成,總計有 13 個團隊帶著他們的 Unity 專案前來參加,其中 9 成以上都是已上架至 iOS 或 Android 平台的 Apps。

當天奇銳科技技術主任 Angus Ko 的簡報:

我的簡報:

實作營當天的環境為 Unity 4.3.4 Pro + Windows 8.1 + Visual Studio 2013 Ultimate,移轉的結果如以下:

image

未能當場移轉成功的4組中: 全是因為於 Unity Editor 中 Build 之後出現 “Missing namespaces/classes/methods” 的錯誤訊息。這類錯誤在不更動既有程式下的最佳解決方法描述在: [Unity Game to Windows Store] Compile error- missing namespaces/classes 文章中;然而,例如 “Timer”, “Encoding” 等 classes 因為尚未實作在 MyPlugin.dll,故無法移植成功;有2組表示會回去作相對應的修改以相容於 Windows 平台。

另外,有3組團隊提到 Facebook plugin 尚未支援 Windows Apps,這部份還待 plugin 廠商下一個版本的支援。

現場展示

當天最吸引我的 App,是個解謎遊戲,故事完整且背景音樂太好聽了,當天雖然是展示 Windows Phone 8 版本,但之前即已成功移轉為 Windows Store App,期待它的上架! 微笑

WP_20140222_17_47_03_Pro

業界著名的 Unity 3D 老師展示的是現場惟二非遊戲類的 App,讓業務捨棄傳統的紙本說明,客戶能以 3D 方式檢視並了解大型機具的功能:

WP_20140222_17_30_10_ProWP_20140222_17_30_18_Pro

2014 Global Game Jam 參加成員,展示成果 Anna:

WP_20140222_17_20_54_Pro__highres

也是 Global Game Jam 參加者,一口氣展示了5~6款已移植到 Windows Phone 上的 Unity 遊戲!

WP_20140222_17_38_01_ProWP_20140222_17_38_22_ProWP_20140222_17_38_34_Pro

已上架 Google Play 平台,並成功移植至 Windows Phone 的學習日文小工具:

WP_20140222_17_23_40_Pro

類「勇者鬥惡龍」的 3D 冒險 RPG 遊戲:

WP_20140222_17_35_45_ProWP_20140222_17_35_59_Pro

驚險刺激的上下捲軸式射擊遊戲:

WP_20140222_17_44_09_Pro

 

相關連結:

你參加 App 怪獸爭霸戰了嗎?

我的第一個 Unity3D Windows Store App

[Unity] 開發 Windows Store App 相關資源整理

[Unity Game to Windows Store] Compile error- missing namespaces/classes

Windows Store與Unity入門

2014 Global Gram Jam 成果

 

 

 

 

 

 

 

 

 

 

 

 

 

 

WAT- 將既有網站快速轉為 Windows 8.1 App 或 Windows Phone App 的免費工具

詳細說明請見: http://blogs.msdn.com/b/johnshews_blog/archive/2014/01/28/websites-to-apps-the-web-app-template-simplifies-windows-app-development.aspx

這個工具 (Web App Template- WAT) 為微軟 RD 所開發,目的是要善用現有網站上的豐富資訊,同時提供簡單的 config 方式快速實作如: Live Tiles, Notifications by Azure, App Bar, Search 等 Windows App 上的獨有功能。

WAT-ill.png

個人認為 WAT 與 App Studio (for WP App)及 Project Sienna (for W8) 類似,不但能成為非程式開發者及網頁開發人員建制 Windows Apps 的入口,同時也能讓程式開發人員快速實作雛型 (prototyping) App。

這工具是 Visaul Studio 2013 的 擴充功能 (extension),可免費在codeplex (http://wat.codeplex.com/)下載。

安裝完成後,在 Visual Studio 2013 中「新增專案->範本 (Template) –> JavaScript」, 即可發現多了一個 “Web-App-Template” 的範本。

image

以此範本建立一個專案後,只要更動 config.json 檔案中的幾項設定,就能很快將您的網頁轉為 App 了。 (config.json 檔修改攻略: http://wat-docs.azurewebsites.net/Json)

開始實作吧!

以下以 Bill Gates 的網站為例,其網址為: http://www.thegatesnotes.com/,我們打開 config.json 檔並將 homeURL 改成此網址:

image

之後直接執行就可以了! (XD 會不會太簡單…)

image

當然,你可以開始進行進一步的整合跟修改,例如:

1. 整合網站的搜尋功能: 我們發現此網站的 Search URL 為 http://www.thegatesnotes.com/Search?search=,那就直接在 config.json 中修改 SearchURL 參數即可:

image

2. 實作 App 的 Navigation Bar: 我們以該網站下方的 Books, Education 及 Energy 等連結為例,在 config.json 檔案中的 navBar 區塊中作設定即可,如以下:

image

以下是執行後 Navigation Bar 滑出後的畫面:

image

3. 實作 Live Tiles 及 Notifications: 在 config.Jason 檔中修改 feed URL, secret 等參數:

image

4. 修改 CSS 檔以改變在 App 中的版型: 可修改 injected-styles.css, wrapper-styles.css 等檔案以套用你喜歡的版型。

image

以上僅是些許範例。所有的實作方法及說明文件請見: http://wat-docs.azurewebsites.net/

以 WAT 工具為出發點,對熟悉 HTML5/JavsScript 的開發者將其進一步修改為更有品質的 App 會是較簡單的。如以下兩個以 WAT 為啟始點所製作出來的 Apps 皆取得很高的下載數及評分!

英國的房屋買賣租賃 App: Zoopla Property

image

美國的居家工具零售商: Low’s

image 

2014 Global Gram Jam 成果 (以及Unity –> Windows Apps 實測)

如同在巴哈姆特的新聞稿中所提到,微軟為了更加豐富在 Windows Store 及 Windows Phone 市集上的遊戲 App,自去年宣佈與 Unity 及奇銳科技合作之後,更在農曆年前的1/24 (五)~26(日)周末期間,共同主辦了全球總計有近二萬人同時參加的 Global Game Jam (GGJ)。

TeckALook 採訪此連續 48 小時的馬拉松活動,並剪成 2 分鐘影片介紹:

2014 Global Game Jam

微軟對台灣遊戲開發者持續支援,將在 2014/2/22 (六) 下午於資策會舉辦一場將 Unity 遊戲移植為 Windows Apps 的免費 workshop。(細節及報名網站: http://www.accupass.com/go/unitywindowst1)

回到 GGJ 的活動,本次的經驗裡最令我驚訝的是,在台灣所有四個舉辦場地中最後上傳的22個遊戲之中,竟然有16個(或以上)是以 Unity 開發的,顯示這項遊戲設計工具在台灣現有遊戲開發者之間的普及程度。而在此同時,也提供了作為主辦單位的我們一個很好的機會,能實際測試各組以 Unity 製作的遊戲直接轉換為 Windows Store/Windows Phone Apps 的過程。 微笑

以台灣微軟場為例,上傳的7個遊戲之中有5組是以 Unity 製作,而這5組皆能直接在現場成功於 Unity 4.3.3 + Visual Studio 2013 on Windows 8.1的環境下,轉為 Windows Store/Windows Phone Apps 並順利執行。

以下列出這5組遊戲以 Windows Store App 的執行畫面。各位若對 Unity –> Windows Apps 有興趣的話,也可以直接到本次 GGJ 的遊戲上傳網頁中,下載各個遊戲的 source code,再在自己的環境之下作測試。

III SeeBrick WallsANNAJust runningWhat do you seePNG

相關連結:

Windows Store與Unity入門

我的第一個 Unity3D Windows Store App

[Unity Game to Windows Store] Compile error- missing namespaces/classes