ParadoxのLiveScripting事情

Slides:



Advertisements
Similar presentations
マイクロソフトがホスティングする拡張性に優れたサービス ベース アプリケーション プラットフォーム.
Advertisements

Microsoft VDI 事例とクラウド化. あらためて MS VDI と RDP の進化 3 Windows Server 2012 R2 の標準機能 1 platform 1 experience 4 deployment choices サーバーベースの リモートデスクトップ 旧ターミナル.
この部分こそが必 要とされている ! Runtime 自身と Expression が カバーする!
Windows Azure ハンズオン トレーニング Windows Azure Web サイト入門.
Oscar Koenders Principal Group Program Manager Microsoft Corporation
第28回codeseek勉強会 WPF で簡単ビデオ再生 2008年5月27日(火)
D2-301 現時点の本資料は 完成版のスライドではありません。
MSON-B2 .NET Framework Web アプリケーション開発
Microsoft Consumer Channels and Central Marketing Group
Windows Summit /1/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Windows Summit /1/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Windows Summit /1/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
C# Programming .NET / C# Group 検索ワードでみる C#の困り事とその対策
3/2/2017 9:01 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows Phone アプリケーションでの データ視覚化
3/3/2017 8:49 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
3/4/ :37 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Expression Blend 3で始めるSilverlight 3アプリケーション開発
3/11/2017 1:52 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Using connected devices in Metro style apps Metro スタイル アプリで デバイスを使用する
3/11/2017 7:02 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
WindowsストアアプリをC++/CXで作る
Windows Summit /13/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
クラウド開発の高速道路 ~Visual Studio 2010 による Windows Azure アプリケーション開発~
MIX 09 3/14/2017 9:51 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Microsoft Consumer Channels and Central Marketing Group
3/17/2017 1:49 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
データはお客様に属し、かつ、コントロール可能
HP ProLiant DL980 G7 SQL Server 2008 R2 NUMA 環境 ベンチマークテスト結果報告書
ビジネスにおける オープンソースの利用価値
XAML の勉強不要! WPF アプリケーションは作れます
大学におけるクラウド活用の 最新動向と先進ソリューションの 事例
3/21/2017 3:39 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Using tiles and notifications タイルと通知の使用
[コース: A1] .NET Framework の基礎
Windows Summit /6/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Windows Summit /8/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Windows Azure - 今やるWindows ストアLOB アプリ開発のための設計手法
Windows Summit /9/2017 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Microsoft Consumer Channels and Central Marketing Group
9/17/ :05 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
9/17/ :17 PM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Microsoft Partner Network Office 365 社内使用ライセンスの有効化
Microsoft Consumer Channels and Central Marketing Group
11/9/2018 3:35 AM Windows Azure Platform ハンズオン トレーニング Windows Azure アプリケーション開発概要 ~ Windows Azure 入門編 ~ © 2007 Microsoft Corporation. All rights reserved.
11/16/ :27 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows Summit /22/2018 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may.
Windows Summit /24/2018 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may.
Expression Blend 3で始めるSilverlight 3アプリケーション開発
Chad Siefert Senior Test Lead Microsoft Corporation
Windows Azure 通知ハブ.
12/9/ :14 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows Summit /31/2018 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may.
suppose to be expected to be should be
Microsoft Visual Studio 2005 Tools for
Windows Summit /21/2019 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Windows Summit /22/2019 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
MIX 09 2/23/2019 1:22 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Max Morris Principal Program Manager Microsoft Corporation
Windows Summit /24/2019 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
主要関係者の特定用テンプレート Windows 10 and Office 365 導入ステップ 2/24/2019
Yochay Kiriaty Senior Technical Evangelist Microsoft® Corporation
~ 第5回 認証のためのプロキシー Web Application Proxy
Windows Summit /4/10 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
Craig Rowland Senior Program Manager Microsoft Corporation
Microsoft Consumer Channels and Central Marketing Group
Windows Summit 2010 © 2010 Microsoft Corporation.All rights reserved.Microsoft、Windows、Windows Vista およびその他の製品名は、米国 Microsoft Corporation の米国およびその他の国における登録商標または商標です。
Windows Summit /22/2019 © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be.
MIX 09 8/2/2019 8:06 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Windows Azure メディアサービス
Presentation transcript:

ParadoxのLiveScripting事情 Microsoft Consumer Channels and Central Marketing Group 3/8/2017 ParadoxのLiveScripting事情 Metro.cs #1 -メタプログラミング & Roslyn 事例集- Microsoft MVP for Windows Platform Development[Jan,2015-Dec,2015] @hr_sao 遥佐保(はるかさお) © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

自己紹介 @hr_sao SiliconStudio - Software Engineer and Evangelist 3/8/2017 自己紹介 @hr_sao SiliconStudio - Software Engineer and Evangelist Microsoft MVP for Windows Platform Development めとべや東京&大阪 →東京の次回は11月予定 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Paradox Game Engine C#で開発できるゲームエンジンhttp://paradox3d.net 3/8/2017 Paradox Game Engine C#で開発できるゲームエンジンhttp://paradox3d.net Android, iPhone, Windows (Desktop,WP,Stor,UAP) まだベータ版  - なのでバグも多く、機能も足りていない 恵比寿で作っています  - フランス, ドイツ, イタリアの人と共に オープンソースhttps://github.com/SiliconStudio/paradox © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Live Scripting

Demo

Live Scripting: synchronization with code and exe 3/8/2017 Live Scripting: synchronization with code and exe Paradox Game Studio Visual Studio 2. Watch Project 3. Change Project PE : Portable Execute フォーマット PDB : program database(シンボルファイル) 4. Recompile 1. Compile & Start Game 6. Swap Script Component From Game Studio 5. Send Assebmly Roslyn利用 Running EXE © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Game Studioに ゲーム実行用の ボタンが2つある…

1. Start Game

1. Start Game - Initialize 1. Compile & Start Game WCF pipe Roslyn/MSBuild Project Part0-csproj Player.dll Player.cs Player.pdb Part1-csproj Enemy.dll Enemy.cs Enemy.pdb ↑こんなsln構成だと思いますが ……… 後々DLLの差分更新をしたい!

Roslynを使ったコンパイル準備

Game用のプロジェクトを新規作成 using Microsoft.CodeAnalysis 3/8/2017 1. Start Game - compile Game用のプロジェクトを新規作成 using Microsoft.CodeAnalysis MSBuildWorkspaceを作成 private async Task<Project> OpenProject(string projectPath) { var csharpWorkspaceAssemblies = new[]{ System.Reflection.Assembly.Load("Microsoft.CodeAnalysis.Workspaces"), System.Reflection.Assembly.Load("Microsoft.CodeAnalysis.CSharp.Workspaces"), System.Reflection.Assembly.Load("Microsoft.CodeAnalysis.Workspaces.Desktop") }; var msWorkspace = MSBuildWorkspace.Create( ImmutableDictionary<string, string>.Empty, MefHostServices.Create(csharpWorkspaceAssemblies)); return await msWorkspace.OpenProjectAsync(projectPath); } でふぉで入るVBは削除 © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

1. Start Game – Roslyn compile 3/8/2017 1. Start Game – Roslyn compile Game用プロジェクトを新規に作成する 元Projectと”同じ様な”構造、だが1ファイルづつ Solution.AddProject, AddDocumentでCSファイルなど追加 var newproject = solution.AddProject(assemblyName, assemblyName, LanguageNames.CSharp) .WithMetadataReferences(motoProject.MetadataReferences) .WithProjectReferences(motoProject.AllProjectReferences) .WithCompilationOptions( new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)); // ソースコードの追加 Newproject = newproject.AddDocument(syntaxTree.FilePath, syntaxTree.GetText()).Project; // 他のソースコードの参照があれば追加(※しれっと……???) project = newproject.AddProjectReference( new ProjectReference(dependencySourceGroup.Target.Project.Id)); © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

QuickGraph.AdjacencyGraph 他のソースコードの参照があれば? QuickGraph.AdjacencyGraph QuickGraph, Graph Data Structures And Algorithms for .NET http://quickgraph.codeplex.com/ グラフライブラリを利用して、ファイルの依存関係を取得している QuickGraph.AdjacencyGraph<SyntaxTree, SEdge<SyntaxTree>>

1. Start Game – Roslyn compile 3/8/2017 1. Start Game – Roslyn compile Roslynでコンパイル、1ファイルづつ GetCompilationAsync でコンパイル(オンメモリ) ファイルの数の分だけ、コンパイル var compilation = await newproject.GetCompilationAsync(); © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

MSBuildでコンパイル実施

1. Start Game – MSBuild compile 3/8/2017 1. Start Game – MSBuild compile MSBuildで改めて実際にコンパイル 実際のDLLが1個づつ作成される (Roslyn for Scriting があれば良いんだけど、まだない) Task<BuildResult> BuildTask { get; private set; } Microsoft.Build.Evaluation.Project project; var projectInstance = new ProjectInstance( project.Xml, project.ProjectCollection.GlobalProperties, null, project.ProjectCollection); BuildTask = Task.Run(() =>{ … new BuildParameters BuildParameters(project.ProjectCollection) … } © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

1. Start Game – MSBuild compile 3/8/2017 1. Start Game – MSBuild compile できたDLLをメモリに保存 差分更新をするために、DLLをバイナリで保持する // sourceGroupとは独自で作ったクラス // - PE(dllファイル) // - PDB // - Microsoft.CodeAnalysis.Project // - Mono.Cecil.AssemblyDefinition (ParadoxではScriptのシリアライズに利用している) sourceGroup.PE = File.ReadAllBytes(peFileName); sourceGroup.PDB = File.ReadAllBytes(pdbFileName); © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

WCF通信

1. Start Game–WCF pipe WCF pipe通信 // gameDebuggerHostとは独自で作ったクラス // 今から起動させるアプリケーションのこと ServiceHost = new System.ServiceModel.ServiceHost(gameDebuggerHost); ServiceHost.AddServiceEndpoint( typeof(IGameDebuggerHost), new NetNamedPipeBinding(NetNamedPipeSecurityMode.None) { MaxReceivedMessageSize = int.MaxValue }, address); ServiceHost.Open(); var startInfo = new ProcessStartInfo{ FileName = gameHostAssembly, Arguments = "—-host=net.pipe://localhost/xxx", WorkingDirectory = workingDirectory, CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, }; var process = new System.Diabnostics.Process { StartInfo = startInfo }; process.Start(); WCF pipe通信

2. Watch Project 3. Change Project

2. / 3. Watch Directory FileSystemWatcher 3/8/2017 2. / 3. Watch Directory Paradox Game Studio 2. Watch Project 3. Change Project FileSystemWatcher ディレクトリの変更検知を行っている VisualStudioは単なるスクリプトエディタ メモ帳で更新しても検知される © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2. / 3. Watch Directory FileSystemWatcher public Watcher(string path) 3/8/2017 2. / 3. Watch Directory FileSystemWatcher public Watcher(string path) { watcher = new FileSystemWatcher(){ Path = path, NotifyFilter = ( NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName), IncludeSubdirectories = true, Filter = "" }; watcher.BeginInit(); watcher.Changed += OnModified; watcher.Created += OnModified; watcher.Deleted += OnModified; watcher.Renamed += OnModified; watcher.EndInit(); } © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

4. Recompile

4. Recompile – 差分コードの確認 初回ビルド時のソースコードと 2回目にビルドしたソースコードの差分をチェックする Roslyn/MSBuild Project Part0-csproj Player.dll Player.cs Player.pdb 4. Recompile Part1-csproj Enemy.dll Enemy.cs Enemy.pdb ……… 初回ビルド時のソースコードと 2回目にビルドしたソースコードの差分をチェックする

5. Send Assembly

5. Send Assembly– 差分DLLの送信 DLL Hot Swap .NETだから可能な技術 // Target(Running EXE)に送って実行させる(DLLのSwap) // Game Studioは何もしていない debugTarget.AssemblyLoadRaw( loadedProject.PE, loadedProject.PDB); Paradox Game Studio // 実際にSwapを実行しているのは、Running EXE側 public Assembly AssemblyLoadRaw(byte[] peData, byte[] pdbData) { return Assembly.Load(peData, pdbData); } https://github.com/SiliconStudio/paradox/blob/master/sources/engine/SiliconStudio.Paradox.Debugger/Debugger/GameDebuggerTarget.cs Running EXE

6. Swap Script Compornent from Game Studio

6. Swap Script Component DLLを読み込んだだけでは更新されない →その処理は通っていない 既に読み込んであるAssetデータには何もしない ParadoxのScriptCompornentのみリロードする ※ Script細かいルールを独自に決めている BMGなどはリロードしたくない →ユーザがAttributeで指定 シリアライズ対象はpublicのみ…などなど Running EXE https://github.com/SiliconStudio/paradox/blob/master/sources/engine/SiliconStudio.Paradox.Debugger/Debugger/LiveAssemblyReloader.cs

Live Scripting 2. Watch Project 3. Change Project 4. Recompile 3/8/2017 Live Scripting Paradox Game Studio Visual Studio 2. Watch Project 3. Change Project PE : Portable Execute フォーマット PDB : program database(シンボルファイル) 4. Recompile 1. Compile & Start Game 6. Swap Script Component From Game Studio 5. Send Assebmly Roslyn利用 Running EXE © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

まとめ コードとEXEのシンクロは既存の技術でも可能 MSBuild, FileSystemWatcher, WCF, Assembly Roslynがあるときめ細やかなプロジェクト管理 ができる DLL Hot Swap は.NETの特徴を上手く利用して いる

おまけ

Paradox オンラインアンケート実施中 https://www.surveymonkey.com/r/YGD8VYH

9/19 Friendlyハンズオン at SHIFT様 3名様に9/20発売のSeleniumデザパタ本をプレゼント! Windowsアプリ操作系最強! 友達だから何でもできる! Is a magical library! It break through the walls of processes. めとべや公式ライブラリもあり! NuGetで「めとべや」で検索! ひらがなで引っかかるのはこれだけ!?