Unity Labs: App遊戲開發實作 – 跨平台就這麼簡單 Unity X Windows

報名網站: http://www.accupass.com/go/unitywindowst1

App遊戲開發實作 - 跨平台就這麼簡單 Unity X Windows

Event Information

Unity 4.3 支援Windows Phone 以及Windows 8.1,你是否很想嘗試但礙於沒有環境呢?
這個課程,除了Unity台灣經銷商奇銳科技工程師, 分享如何利用 Unity 移植遊戲到 Windows平台,更提供現場hands-on環境讓各位開發者挑戰!
[時間場地]
1.
時間:2014 / 02 / 22 ()
13:30 ~ 17:30
2.
地點:台北市復興南路一段3903 301資策會

image

[參加條件]
1. 已經有遊戲作品之開發團隊或個人
2. 每一家公司/團隊最多報名兩位.
[註]
1. 主辦單位保留參加資格審核權利
.
2.
活動場地可容納30名學員, 報名系統設定為35名以保留5名候補學員
[提供資源]
1. 台灣微軟提供各組 Windows Store 帳號 Token,可供一年份免費上傳 Windows Store AppsWindows Phone Apps
2. 教室會提供安裝好Unity 4.3試用版及Windows 8.1 Windows Phone 8 SDK之開發環境, 但仍建議團隊帶自已的筆電與開發環境, 所需環境請參考 http://unity3d.com/pages/windows/porting
3.當天除PC外,會準備6 Lumia 720 手機供開發測試用
4.台灣微軟提供各組 Windows Azure 一個月試用帳號。
5.台灣微軟將準備精美小禮物,送給於最終發表時使用 Windows 平板或手機裝置 demo 的組別。
[我還沒有作品]
本梯次課程優先保留給已經有作品之遊戲團隊, 如果您尚無完成之作品, 但仍想學習如何將Unity 遊戲發佈到Windows 8.1Windows Phone平台上, 麻煩您仍然報名,並提供作品介紹。
[參考文件]

1. Unity移轉必讀
2. 如何將遊戲移植到Windows 8.1及Windows Phone 8
3. Windows 8到Windows 8.1


指導單位:經濟部工業局
辦單位: 奇銳科技股份有限公司 台灣微軟財團法人資訊工業策進會數位教育研究所
如果有其他問題,請與執行單位聯絡:
e-mail: twbisv@microsoft.com

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

如以下,在 Unity 中 Switch Platform 至 Windows Store Apps 後 “Build”:

image

出現的錯誤訊息為: “error CS0103: The name ‘File’ does not exist in the current context”。

Unity 上開發的遊戲 porting 至 W8/WP 平台時,第一個也是最常遇到的問題,即是有某些 namespaces 及 classes 在 Mono run-time 中可以編譯,但卻因不存在於 W8/WP 的 run-time 中,而造成 Compile error 的情形。

我們先直接來解決它,之後會有較詳細的說明。

如何解決?

[以下環境以Unity 4.3.3 + Windows 8.1 + Visual Studio 2013 作說明,解法適用於 Windows Store App 及 Windows Phone 8]

步驟1: 請至https://aka.ms/UnityPortingSamples 下載位於 GitHub 中的 UnityPorting (C#) 專案 (Download ZIP),這個專案實作了許多 missing namespaces/classes,只要在 Unity 中的參考加入此專案建制出來的 .dll 檔即可解決這個常見的問題。

1-1. 解壓縮後,雙點位於 UnityPorting-masterUnityPorting-masterPlatformerPlugin 目錄下的 PlatformerPlugin.sln (會以 Visual Studio 2013 開啟)。

1-2. 刪除方案中的 Facebook 資料夾;「只」重新建置 MyPluginUnity 這個專案,因為我們僅需要其 MyPlugin.dll 檔! (建置後會在 UnityPorting-masterUnityPorting-masterPlatformerPluginMyPluginUnitybinDebug 目錄中)

imageimage

步驟2: 將 MyPlugin.dll 檔加入 Unity 的參考 (references) 中:

[2014/2/24更新] 用滑鼠把 MyPlugin.dll 檔拖拉至 Plugins 資料夾中即可:

image

回到 Unity ,點擊錯誤訊息,於發生錯誤的 .cs 檔案加入以下 Using directives,同時並記得將既有的 Using System.IO 移除。

#if UNITY_METRO_8_1 && !UNITY_EDITOR
using LegacySystem.IO;
#else
using System.IO;
#endif

image

請各位以所缺少的 classes 所在的 namespace 作相對應的修改;以上是以 System.IO 中所缺少的 classes 為例,以下則是缺少 System.Net 中的 Sockets 之例:

“error CS0234: The type or namespace name ‘Sockets’ does not exist in the namespace ‘System.Net’ (are you missing an assembly reference?)”

image

存檔後回到 Unity 重新 Build 即可發現錯誤已解決;若無其他錯誤的話即會發現在所選資料夾中已成功編譯出一個 Windows Store App 方案,點擊其 .sln 檔即可以 Visual Studio 開啟編譯。

原因及說明:

此問題發生的原因其實很簡單,Mono .NET 及 W8/WP .NET 這兩個 run-time 雖然都是屬於整體 .NET run-time 的子集合,但是兩個子集合圈圈之中,會有 namespaces/classes 不在交集內的情形 (藍色半月型區域):

image

MyPlugin.dll 這個檔案即是我們在以上步驟中的重點,在其中已實作了許多出現在 Mono run-time ,但卻未出現在 W8/WP run-time 的 namespaces/classes。 因此 Unity 開發者只要直接 Using 進來,即可在不更動既有的 classes 名稱下,編譯出相容於 W8/WP run-time 的遊戲;而又由於所有的 classes 名稱都沒被更動,因此不會影響遊戲在其他平台 (iOS/Android 等) 的相容性。

詳細來說,於步驟1所建置出來的 MyPlugin.dll 之中,至少實作了以下的 namespaces/classes:

– System.Collections 之中的: Hashtable, ArrayList, OrderedDictionary, SortedList, Queue, Stack and a few others.

– System.IO.File, System.IO.StreamReader, System.IO.Directory, etc.

– System.Net.TCPClient using Windows.Networking.Sockets WinRT namespace:

– System.Threading.Tread

– (optional) Facebook plugin

亦即若您的 Compile error 是因為找不到以上的 classes,那以上步驟都可以解決您的問題。

以上步驟的詳細說明請見這份 Unity3D/Microsoft 的官方文件Porting tips for Windows Store (813 KB) 中的第4 ~ 6 頁。

另,線上課程 (英文) Porting Unity games to Windows 8.1 & Windows Phone 中的 Module 3 就特別討論到 Duel Runtime environment ,建議一聽。

更完整 porting 至 W8/WP 平台的文件可見: http://unity3d.com/pages/windows/porting 

遊戲 App 於 Windows 平台下載量 10 倍於 iOS 之經驗分享

本篇是分享某個獨立遊戲開發者的遊戲 App,在 Windows Phone Marketplace 下載量 10 倍於在 iOS App Store 的經驗,是來自於在 「2013 台北遊戲論壇」的演講。

image

這個遊戲叫 QONQR (發音同 conquer,即”征服”之意),於2012年三月同時於 Windows Phone 及 iOS 市集中發佈,長期在 Windows Phone 市集的日下載量皆大於 iOS 市集,在某些週的下載量甚至遠超過10倍。

image

QONQR 是來自一個七人團隊,已在 Windows Phone 市集累計數十萬的下載,並運行在四個 Windows Azure 的 Virtual Machines上。QONQR 故名思義是一個佔有城市,並攻打別人城市的遊戲;遊戲進行中可以獲取 “credits” 以作武器或裝備上的升級。

image

團隊的 CEO 接受採訪時被問到原因時,令人驚訝的並非提到此遊戲有多創新等,而是提到在此殘酷的 App 商場上的鐵則: 能見度! App Visibility!

image

密訣一:透過 Windows Phone 的「精選」,至少能提高大於平時三倍以上的下載量。相較於 iOS App Store 而言,indie game developer 能與當地微軟/Nokia辦公室合作,進而被提名為「精選」的機會很大 (比如在台灣可以直接與台灣微軟連絡)。

image

同時,若能搭配 App 本身進行的活動 (如:IAP折扣),下載量會更大幅度的增加。

image

密訣二:同時發佈 Windows 8 App。提供使用者在平版上以不同方式來玩此遊戲,同時,也藉著 Windows 8/8.1 已賣出 1 億台以上的出貨量,在 Windows Store 上進一步增加 App 的能見度。

image

密訣三:積極的在社群中經營,在基本的Blogs、論壇、Twitter、Facebook之外,同時建立與使用者的討論區以增加互動性。

image

In-App-Purchase (IAP)的秘訣: 活用「多層次貨幣系統」(如有些特殊功能只能使用 “cubes” 購買,不能用打勝仗賺來的 “credits”購買),以誘發使用者的購買慾;當然在 40 Secrets to Making Money with In-App Purchases 文章中的基本策略也要確實的考量。

image

最後是以這張 Business Canvas 收尾,提醒大家: App 的成功除了機遇外,有許多除了創意、熱情之外更需要的商業考量,勉勵大家在這嚴酷的 App 戰場中精益求精,增加您的 App 成功的機會。

image

本 QONQR 的案例是來自以下文章: Windows Phone outperforms iPhone for Indie Game Developer

以下是此演講的錄影:

2013 台北遊戲論壇

完整投影片:

20131122 台北遊戲開發者論壇 from Meng-Ru Tsai

我常看哪些部落格?–Windows Store App 相關網路資源分享

首先,Windows Store App 在 Facebook 有中文討論社團喔! 這裡提供了互相討論的自由空間,同時也能即時獲得免費課程、最新技術變化等資訊,歡迎已在開發或有興趣接觸的夥伴加入: https://www.facebook.com/groups/331827086897287/ 

image

   

中文部落格:

.Net 海角點部落– 人稱 Bill 淑,MVP,也是 Windows Store App 獲利模式探討的主講人,同時亦專精於 Windows Phone App 開發。

開發者之魂– 人稱上官神人,在 Windows Azure, Windows Store App 及 Windows Phone App 皆有專精,如精通 Windows Store App / Windows Phone App 的 ListView / ListBox 控制項

Blogs of Han– 作者目前任職於中國微軟,已集結許多較具深度的文章,如Windows 8.1下ListView和GridView的数据分步显示 & 在MVVM架构下实现将基于ListViewBase控件的显示项滚动到可视范围内(Windows 8.1)

Windows Store apps development support– 作者亦任職於中國微軟,好文如 如何正确使用Background Task的几点建议 & How to use new controls in Windows 8.1

Mr.BIG– 曾擔任微軟學生大使,同時在 「2012 Windows 開發嘉年華」比賽中勇奪冠軍的優秀學生,如果想快速了解 Windows 8.1 的新功能,他的兩篇文章可以作為快速的入門: 初探WINDOWS RUNTIME FOR WINDOWS 8.1 & XAML FOR WINDOWS 8.1的求新求變

Frank– 還是個學生喔! 但已成功發佈許多 Windows Store Apps 在市集上了,文章教學性高,同時也非常勤於分享,代表文章如: [Windows 8 App]上架流程全紀錄

科技來自於人性– 同樣還是個學生! 已有許多 Windows Store 相關文章,著重在開發上的小技巧及發現,如 Windows 8.1 拍照與攝影—CameraCaptureUI 類別

亂亂寫 Blog– 文章著重在開發工具 (Visual Studio)、開發流程控管及企業導入,文章 Native Web App 的登入三兩事…討論在 WebView 中確保登入狀態的方法,是企業實作 App 時很常見的情況。

小朱® 的技術隨手寫– Windows Azure 大師,可深入了解在 Windows Store App 中使用微軟雲端運算。

黃忠成– 微軟專業講師及 MVP,Tech Days 2013 – Azure Mobile ServicesMSDN – Windows 8 非同步開發

No.18 – HTML5 & JavaScript程式開發實戰」的共同作者,JavaScript/WebAPI 高手,文章如: HTML5 & JavaScript New Feature In Windows 8.1

Bruce Chen– 於台灣微軟擔任企業技術支援,有如何使用 Live SDK 的文章。

 

英文部落格:

Windows App Builder Blog: 微軟官方部落格,主要在重要訊息的發佈,如 BUILD 2014 將於 2014/4/2~4/4 舉行。

Project Siena– Siena 是微軟官方開發出來的 App,可以讓非開發人員拖拖拉拉即作出自己的 Windows Store App: Project Siena: 非開發者也能打造 Windows 8.1 App

Ibrahim KIVANC – DPE Technical Evangelist: 有 Windows 8.1 App 開發的一系列教學文。

Jerry Nixon– 常常會出現許多有趣的範例及文章,如讓你的 XAML 下雪 Make it snow with XAML 及處理平版轉向的兩個方法: The two ways to handle orientation in your Windows 8.1 app

Windows Store Developer Solutions– 是個共筆 blog, 集結了許多微軟內部技術人員的文章,比如 Ten Things You Need to Know About WebView (雖然Windows 8.1 在 WebView 上已作了許多改變) 及 Accessibility Gotchas 1: Xaml ListView speaks in tongues

Jeremy Likness’ Blog– 有許多 AngularJs 及 Windows Store App 等相關文章。

中文教學影片:

Channel9 Taiwan 第九頻道– 包含開發工具、Web Design、Windows Azure、Windows Phone 及 Windows Store App 等中文影片。

Unity3D 轉成 Windows Phone App 或 Windows Store App:

– 在 Untiy 的官網中有4份 PDF 文件 (http://unity3d.com/pages/windows/porting),若您要 porting Unity Games 至 Windows 平台的話的必讀! 

– 另,MVA 中也有課程 (英文): Porting Unity games to Windows 8.1 & Windows Phone

Project Siena: 非開發者也能打造 Windows 8.1 App

[本文完全不涉及程式開發,請慎入]
微軟最近上架了一個 “Project Siena” 的 Windows Store App,讓沒有開發經驗的人也能快速發揮自己的創意,透過類似操作 PowerPoint 或 Excel 的方式,輕鬆打造出一個 Windows 8.1 App。有點類似之前針對 Windows Phone App 之 AppStudio 的做法,提供了更簡易入門的 App 製作方式。讓使用者能更專注於創意及內容的展現,開發出專屬自己、並且能支援平板觸控使用的 Windows Store App。
微軟官方表示 Project Siena 的目的,即是要讓製作 App 像編輯文件一樣容易,僅需透過簡單地操作、連上合適的資料內容,即可輕鬆完成。支援的內容格式上,包含了 SharePoint 表單、Excel、Azure Mobile Services 表格、RSS 及 RESTful 服務等。
製作完成後,不但可將 App 直接安裝至本機或其他機器,同時會產生出一個完整的 Html/JavsScript專案,也就是能夠進一步以 Visual Studio 2013 進行程式修改,就如同編修其他 Windows Store App 專案一樣,在編譯後上架 Windows Store。簡易的操作加上彈性的應用方式,即便是一般的開發者應該也可以考慮將其善加利用,比如在進入程式開發前的設計階段,Siena 即可視為一個好用的雛型(prototyping) 及 UX 規劃的設計工具
Project Siena 目前釋出的雖是 Beta 版本,但個人把玩的經驗,在穩定性、內容連結、使用者經驗上都已達到相當高的水平。可期待的是未來在: 動態組成 RESTful service URI (如查詢某產品資訊)、支援 HTTP Post (如更新購物車內的項目) 等功能上會有更多的加強。
– Siena 下載: https://aka.ms/GetProjectSiena
官網: http://www.microsoft.com/en-us/projectsiena/default.aspx (建議點入 “Help Topics” 直接進入教學;另還提供 Sample Apps 供參考)

Smooth Streaming on Windows 8.1 App

Smooth Streaming 的技術,可以讓使用者在觀看影音內容時,能依據使用者當時的連線狀況,給予不同的解析度來播放,以達到觀看時的流暢性;比如使用者以 3G 上網或在網咖以極速連線時,Smooth Streaming 可以即時偵測網路頻寬,立即調整以較小或較大的 bit rate 來播放,減少出現 buffering 的等待機會。

若您已經採用了 Smooth Streaming 技術,要在 Windows 8.1 App 中播放是很容易的事,而且可以直接使用 MediaElement 物件來播放。

各位可下載以下程式碼作為連結 Smooth Streaming 的參考: http://sdrv.ms/1enKc40

您會需要: Microsoft PlayReady Client SDK for Windows 8.1 Store Apps, Microsoft Smooth Streaming Client SDK for Windows 8.1

有個公開的 Smooth Streaming 資料源可以讓大家作測試: Microsoft PlayReady (TM) Test Server

以下是幾個執行畫面:

image

全螢幕播放:

image

邀請使用者對你的 Windows Store App 評分 (App review & rating)

打開 App.xaml.cs 檔,先宣告以下兩個變數:

private DispatcherTimer m_DispatcherTime;
StorageFolder folder = ApplicationData.Current.LocalFolder; 

在 App() 中呼叫 loadInfo() 方法如以下:

public App()
{
      this.InitializeComponent();
      this.Suspending += OnSuspending;
      loadInfo();
}

最後實作 loadInfo(), m_DispatcherTime_Tick() 及 CommandInvokedHandler() 方法如以下:

private async void loadInfo()
{
    bool isExist = true;
    try
    {
        StorageFile isExistfile = await folder.GetFileAsync("isExist.dat");
    }
    catch (FileNotFoundException ex)
    {
        isExist = false;
    }
    if (!isExist)
    {
        m_DispatcherTime = new DispatcherTimer();
        m_DispatcherTime.Interval = new TimeSpan(0, 0, 0, 5);
        m_DispatcherTime.Tick += m_DispatcherTime_Tick;
        m_DispatcherTime.Start();
    }
}

#region rating timer

private async void m_DispatcherTime_Tick(object sender, object e)
{
    var dialog = new MessageDialog("請至市集給我們評份及建議。", "評分及建議");
    dialog.Commands.Add(new UICommand("Cancle", CommandInvokedHandler, 0));
    dialog.Commands.Add(new UICommand("Go", CommandInvokedHandler, 1));
    dialog.DefaultCommandIndex = 1;
    await dialog.ShowAsync(); m_DispatcherTime.Stop();
}

/// <summary>
/// Callback function for the invocation of the dialog commands.
/// </summary>
/// <param name="command">The command that was invoked.</param>
private async void CommandInvokedHandler(IUICommand command)
{
//Windows.System.Launcher.LaunchUriAsync(new Uri
//("ms-windows-store:REVIEW?PFN=Your package family name from the manifest"));
    if (command.Id.Equals(1))
    {
        StorageFile file = 
        await folder.CreateFileAsync("isExist.dat", 
        CreationCollisionOption.ReplaceExisting);
        Windows.System.Launcher.LaunchUriAsync
             (new Uri("ms-windows-store:REVIEW?PFN=
                9034Meng-RuTsai.OsakaMetroMapOffline_bygkn6mn9zr2y"));
    }
}
#endregion

黃色部份是 Windows Store App 的 family name (套件家族名稱), 可以在 manifest 檔中取得:

image

其實,邀請使用者至市集評分頁的關鍵之處,是使用 Windows 作業系統預設的 Protocol Activation。各位可以將以下直接貼在瀏覽器中作試驗。

ms-windows-store:REVIEW?PFN=9034Meng-RuTsai.OsakaMetroMapOffline_bygkn6mn9zr2y

最後,以上程式是以利用一個暫存檔 (isExist.dat) 來判斷是否要提醒使用者,此檔建立在使用者目錄下的 AppData 資料夾中,如:

C:Users[user name]AppDataLocalPackages972A5D21.43908557F4F45_tkaddggce39qpLocalState

如果想重覆測試,删掉 isExist.dat 檔即可。此檔記錄使用者是否有點擊 Go 的選項。

以下是執行畫面供參考:

image

使用者點擊 Go 的話:

image

[新聞] 現在要上架 Apps 到 Windows Store 上變得更便宜了!

自即日起,申請上架 Windows Store 的「個人帳戶」年費已由原來的台幣 NT$1,420元 ($49 美元) 降價至台幣 NT$568元 ($19 美元) 了! 「公司帳戶」則仍維持台幣 NT$2,840 ($99 美金)。

其實這篇新聞的最大重點,是 Windows Phone 及 Windows Store 兩個市集的註冊程序已經合併了,也就是只要註冊一次,開發者即可以選擇將您的 Apps 上架至 Windows Phone 或 Windows Store 市集。簡略說明重點如下:

  • 已註冊的 Windows Phone 開發者: 現在可以使用既有的 Microsoft Account,免費提交 Apps 到 Windows Store 市集。

  • 已註冊的 Windows Store 開發者:現在可以使用既有的 Microsoft Account,免費提交 Apps 到 Windows Phone 市集。

  • 新的開發者、或是既有的開發者:可以使用同一個 Microsoft Account 註冊或續訂。開發人員只要提交一次註冊資訊,選擇支付 「個人帳戶」$19美元或「公司帳戶」 $99 美元的年費,即能同時發佈 Apps 於 Windows 和 Windows Phone 的市集中。

  • 已使用相同的 Microsoft Account 同時在 Windows Store 和 Windows Phone 註冊的開發人員: 本月將收到一組代碼,免費獲得延長一年的續簽優惠。

  • 學生身份開發者可持續獲得 DreamSpark 計畫的註冊優惠。

現在就將您的 Apps 發佈至 Windows Phone 及 Windows Store 平台,獲得大獎機會!

App 怪獸爭霸戰第二回合即將在 2013/11/15 展開,Apps 愈多得獎機會愈大喔!

https://aka.ms/appbattle

image

2013/11月 Windows 相關免費講座、研討會一覽

時間

地點

講題

報名方式

2013/11/06 (三)下午15:30~17:00

世新大學「大文山App園區」

新北市新店區復興路45號7樓

「Windows 8.1 App、Windows Phone App開發及Windows Azure簡介 」

直接來現場即可

2013/11/9 (六)9:30 ~ 17:30

台北市復興南路一段390號3樓 301 (資策會)

App遊戲開發實作 – 跨平台就這麼簡單 Unity x Windows

有參加條件,詳情請見: http://www.accupass.com/go/unitywp

2013/11/14 (四)14:00 ~ 17:00

台灣微軟 7B 會議室 (台北市信義區松仁路 7 號 7 樓)

Windows 8.1 新 API 介紹 + 透過 Windows Store App 獲利!實作及分享

報名網站:

http://msdn.microsoft.com/zh-tw/windows/dn458957.aspx