changeset 30:d901013d7b57

update
author riono <e165729@ie.u-ryukyu.ac.jp>
date Thu, 06 May 2021 22:46:54 +0900
parents f4fcb85e94ad
children 575b1e144749
files Paper/fig/AntiCheat.graffle Paper/fig/AntiCheat.pdf Paper/riono-sigos.pdf Paper/riono-sigos.tex Paper/src/UnityHelloWorld.cs Paper/src/UnityStartHelloWorld.cs
diffstat 6 files changed, 45 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
Binary file Paper/fig/AntiCheat.graffle has changed
Binary file Paper/fig/AntiCheat.pdf has changed
Binary file Paper/riono-sigos.pdf has changed
--- a/Paper/riono-sigos.tex	Thu May 06 20:20:32 2021 +0900
+++ b/Paper/riono-sigos.tex	Thu May 06 22:46:54 2021 +0900
@@ -217,12 +217,24 @@
 
 
 \section{Unity}
+Unity はUnity Technologies が開発を行っている、ゲームエンジンである。世界で最も使用されているゲームエンジンであり、ゲーム制作に必要な機能が揃っており、個人でもゲーム開発が可能になっている。
+主な特徴としては、様々なプラットフォームに対応可能であり、PC、iOS、Androidやその他コンシューマも開発可能である。また非常に軽いことも特徴であり、スペックが低いノートPC でも十分ゲーム開発が可能である。
+
+プログラミング言語はC\# が使用でき、C\# 既存のAPI やUnity 用に拡張されたAPI なども使用可能である。
+拡張性も高く、開発に必要な機能を作成しUnityのメニューから実行することも可能である。
 
 
 \section{Unityでの動作}
+Code \ref{code:unityHW}、 Code \ref{code:unitySHW}はCode \ref{code:csSHW}、Code \ref{code:csHWC}、Code \ref{code:csFHW}をUnity 上で動作させるための実装である。
 
+\lstinputlisting[caption=Unity HelloWorld実行クラス, label=code:unityHW]{src/UnityHelloWorld.cs}
+\lstinputlisting[caption=Unity StartHelloWorld, label=code:unitySHW]{src/UnityStartHelloWorld.cs}
 
+Unity ではMain 関数が実行されないため、MonoBehaviour を継承してStart 関数を呼び出す必要がある。
+2行目のStart はゲーム開始時に1度だけ呼ばれる関数である。
 
+2行目でCGM を生成し、3行目でCode \ref{code:unitySHW} のインスタンスを生成、引数にCGM を渡している。
+実行される関数 RunCodeGear はCode \ref{code:csSHW} のMain 関数とほぼ同等の処理である。
 
 \section{Take annotation の実装}
 java 版ではDataGear を取得する際に、annotation という java の機能を用いて行った。C\#には annotation はなく、代わりにattribute を利用して DataGear の取得を行っている。
@@ -272,6 +284,17 @@
 実装の優先度が低かったため、今回はCodeGear のpriority による実行順変更については実装を行わなかった。
 
 \section{Unity で使用されている通信ライブラリとの比較}
+Unityで主に使用されている通信ライブラリにPhoton Unity Networking 2 (以下PUN2)と、公式サポートされたMLAPI の2つとChristie \# の比較を行う。
+
+PUN2 はUnity でオンラインゲームを作成する際に最もよく使用される通信ライブラリの1つである。Photon Cloud というサービスがあり、自前でサーバを用意せずともサーバを使うことが可能である。サーバクライアント方式であり、TCPで通信を行っている。ネームサーバ、マスターサーバ、ゲームサーバの3つのサーバがあり、Photon Cloud に接続するとネームサーバに入り、接続している地域からマスターサーバが自動で選択される。マスターサーバではマッチメイキングが行われ、完了するとルームが作成されているゲームサーバに転送される。
+Unity の実行は各クライアントで行われ、サーバには同期に必要なデータが送信される。また送受信できるデータはUnity 用に適応されており、コードを書かなくても座標であるTransform や物理演算のRigidBody などは同期が可能になっている。
+
+
+MLAPI はUnity 公式サポートされた通信ライブラリである。こちらもサーバクライアント方式であり、サーバはPUN2 とは異なり自ら立てる必要がある。同期可能なデータはUnityの Transform やAnimation やVector、Ray、QuaternionなどUnity のプリミティブな型である。またRPC が提供されており、attribute をつけるだけでRPC に対応可能である。サーバやクライアントなどの接続先の指定にはIPアドレスなどが必要である。
+
+
+Christie では送信データをobject 型に変換した上で圧縮、送信を行っている。そのためプリミティブ型、およびユーザーが定義したクラスのインスタンスごとデータを送信することが可能である。
+PUN2 やMLAPI などでは開発を行いやすいようにInspector 拡張などが行われており、Christie では未対応な部分があるが、通信の信頼性、特にノードの接続先が直接記述されていない点が優れている。
 
 
 \section{チート対策について}
@@ -285,15 +308,17 @@
 
 \begin{figure}[h] %PDF
 \begin{center}
-\includegraphics[width=10cm]{fig/AntiCheat.pdf}
-\caption{Topology Mangerを介したデータ通信}
+\includegraphics[width=9cm]{fig/AntiCheat.pdf}
+\caption{label を使用したデータ通信}
 \label{fig:anticheat}
 \end{center}
 \end{figure}
 
 
 \section{実装の現状}
+今回、Local DGM を使用してUnity 上でデータ通信を行うことができた。
 
+Socket とMessagePack を用いた通信に関しては、書き換え途中であり、Topology Manager を使用した通信に関しても今後書き換えを行なっていく予定である。
 
 \nocite{*}
 \bibliographystyle{ipsjunsrt}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Paper/src/UnityHelloWorld.cs	Thu May 06 22:46:54 2021 +0900
@@ -0,0 +1,7 @@
+public class HelloWorld : MonoBehaviour {
+    void Start() {
+        CodeGearManager cgm = StartCodeGear.CreateCgm(10000);
+        var helloWorld = new StartHelloWorld(cgm);
+        helloWorld.RunCodeGear(cgm);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Paper/src/UnityStartHelloWorld.cs	Thu May 06 22:46:54 2021 +0900
@@ -0,0 +1,11 @@
+public class StartHelloWorld : StartCodeGear {
+    
+    public StartHelloWorld(CodeGearManager cgm) : base(cgm) { }
+
+    public  void RunCodeGear(CodeGearManager cgm) {
+        cgm.Setup(new HelloWorldCodeGear());
+        cgm.Setup(new FinishHelloWorld());
+        cgm.GetLocalDGM().Put("helloWorld", "hello");
+        cgm.GetLocalDGM().Put("helloWorld", "world");        
+    }
+}