【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術

1.7K Views

May 08, 17

スライド概要

講演者:河合 宜文(株式会社グラニ)

こんな人におすすめ
・C#大統一理論について興味のある方
・UniRxを使ったことがある/使ってみたい方

受講者が得られる知見
・C#で統一したプロジェクトの作り方
・UniRxの活用法、メリットとデメリット

講演動画:https://youtu.be/Lvbs22iZFPk

profile-image

リアルタイム3Dコンテンツを制作・運用するための世界的にリードするプラットフォームである「Unity」の日本国内における販売、サポート、コミュニティ活動、研究開発、教育支援を行っています。ゲーム開発者からアーティスト、建築家、自動車デザイナー、映画製作者など、さまざまなクリエイターがUnityを使い想像力を発揮しています。

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
2.

C# UniRx /

3.

Yoshifumi Kawai CTO Grani, Inc.

4.

About speaker • • • • • • • • •

5.

About this session • •

6.

About this session • •

8.

• • • • • • •

9.

• • • • • • • • •

10.

• • • • • • • •

11.

• • • • • • •

12.

• • • • • • • •

13.

• 4 • 4 • • AI • NPC vs 4 C#

14.

• UniRx • LINQ to GameObject • MessagePack for C# • MagicOnion • MasterMemory • ReMotion • by Yoshifumi Kawai • etc...

16.

using

17.

Why C#? Why Unity? • • • • • • • • •

18.

C# • • • • • • • • •

19.

How to • • • •

20.

) • • •

21.

• IDL(Interface Definiton Language) • IDL = JSON proto • • IDL • C# • IDL IDL / ……

22.

IDL • Visual Studio • • Unity • Git • • C# • C# • • ……

23.

Visual Studio

24.

C# C# • C# C# • C# 6.0(Visual Studio 2015) • • [MessagePackObject] => ***MessagePackFormatter • /

27.

• • • / • • • • •

28.

• • • / • • • • •

29.

• / • • / • • • •

30.

• / • • / • • • •

31.

C# • C# • • • / • / • • • IDL

33.

• • C# • • • • • • • ……

35.

gRPC • Web API + Streaming • Google HTTP/2 • HTTP/2 HTTP/1 • gRPC • Web API • (Unity ) • (Unity Web API google RPC )

36.

gRPC • Web API + Streaming • Google HTTP/2 • HTTP/2 HTTP/1 • gRPC • Web API • (Unity ) • (Unity Web API google RPC )

37.

Unity gRPC • C# gRPC Unity • .NET 4.5 • • gRPC Client Unity • .NET 3.5 + IL2CPP • (C Core) iOS/Android • / • gRPC IDL Protocol Buffers / Unity • HTTP/2 gRPC

38.

Unity gRPC • C# gRPC Unity • .NET 4.5 • • gRPC Client Unity • .NET 3.5 + IL2CPP • (C Core) iOS/Android • / • gRPC IDL Protocol Buffers / Unity • HTTP/2 gRPC

40.

• • • • • • • • • ……

41.

• • • • • • • • • ……

42.

UNET • Unity • • • • • • UNET • C# • • C# Web API ,

44.

Web API • • • • • • • • •

45.

Web API • • • • • • • • •

47.

• Web API

48.

Streaming Service(gRPC Battle Engine)

49.

F for AI • AI • F# • Excel • (DSL) .NET Framework F# C# gRPC BattleEngine AI F#

50.

Streaming Server • • • • • • • • • •

52.

We’re using UniRx • • • • • • •

53.

We’re using UniRx • • • • • • •

54.

UniRx • • • • • • • •

55.

• • • • • • • : 3845 : 1186

56.

• • • • • • • • • •

57.

Rx • • • • •

58.
[beta]
Rx

3

// これで例外を共通ハンドリング
IObservable<TResponse> HnadleCommonError<TRequest, TResponse>(IObservable<TResponse> source
{
return source
.Catch((Exception ex) =>
{
// Exception使って共通エラーポップアップを出したりするとする
NavigationService.ShowMessagePopUpAsync("error", "errorMessage").Subscribe();
// 呼び元に真の意味で何も返さない
return Observable.Never<TResponse>();
});
}

59.
[beta]
Pitfall of Empty
•
•
IObservable<Unit> Test()
{
return Observable.FromCoroutine(() => TestCore());
}
IEnumerator TestCore()
{
yield return Observable.Empty<int>().ToYieldInstruction();
Debug.Log(“この行には到達する");
}

60.
[beta]
Pitfall of Empty
•
•
IObservable<Unit> Test()
{
return Observable.FromCoroutine(() => TestCore());
}
IEnumerator TestCore()
{
yield return Observable.Empty<int>().ToYieldInstruction();
Debug.Log("come here");
}

61.

UI Framework Rx • • • • • • • •

62.

Chaotic Rx • • • • • Ivory.Unity.Core.Scene.<OnAfterNavigate>c__AnonStorey76A:<>m__2DC7(Unit) UniRx.Operators.Do:OnNext(Unit) UniRx.Operators.ImmutableReturnUnitObservable:Subscribe(IObserver`1) UniRx.Operators.Do:Run() UniRx.Operators.DoObservable`1:SubscribeCore(IObserver`1, IDisposable) UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1) UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1) UniRx.Operators.SelectManyOuterObserver:OnNext(Unit) UniRx.Operators.SelectMany:OnNext(Unit) UniRx.Operators.SelectMany:OnNext(Unit) UniRx.Operators.SelectMany:OnNext(Unit) UniRx.Operators.Do:OnNext(Unit) UniRx.Operators.SelectMany:OnNext(Unit) UniRx.Operators.SelectManyOuterObserver:OnNext(Unit) UniRx.Operators.Do:OnNext(Unit) UniRx.Operators.ImmutableReturnUnitObservable:Subscribe(IObserver`1) UniRx.Operators.Do:Run() UniRx.Operators.DoObservable`1:SubscribeCore(IObserver`1, IDisposable) UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1) UniRx.Operators.SelectManyOuterObserver:Run() UniRx.Operators.SelectManyObservable`2:SubscribeCore(IObserver`1, IDisposable) UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1) UniRx.Operators.Do:Run() UniRx.Operators.DoObservable`1:SubscribeCore(IObserver`1, IDisposable) UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1) UniRx.Operators.SelectManyOuterObserver:OnNext(Unit) UniRx.Operators.SelectMany:OnNext(Unit) UniRx.Operators.WhenAll_:OnNext(Unit) UniRx.Operators.WhenAllCollectionObserver:OnCompleted() UniRx.Operators.AsUnitObservable:OnCompleted() UniRx.Operators.WhenAll:OnCompleted() UniRx.Operators.WhenAllCollectionObserver:OnCompleted() UniRx.Operators.ImmutableReturnUnitObservable:Subscribe(IObserver`1)

63.

Model-View-(Reacitve)Presenter View Reactive Presenter Model

64.

Model-View-(Reacitve)Presenter View Reactive Presenter Model

65.

Chaotic-Reacitve-Model Reactive Presenter Model

66.

Chaotic-Reacitve-Model Reactive Presenter Model

67.

Rx • • • • • • • • • • Simplicity

68.

Rx • • • • • • • • • •

70.

• Before gRPC • • • • • • After gRPC • •

71.

• • • • • • • • •

72.

• • • • • • • • •

73.

ZeroFormatter

74.

• • • • •

75.

• • • • • • • • •

76.

MessagePack for C#

77.

C# • • • • • • • • •

78.

C# • • • • • • • • •

79.

• • • • • • • •

80.

• • • • • • • • •

81.

• • • • • • • • •

83.

Architecture of MasterMemory Header LZ4+MsgPack Memory<T> LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack

84.

• • • • • • • • • •

85.

• • • • • • • • • •

87.

The Future Has Come • • C# • • • • • •

88.

We're Hiring Unity Engineer/Technical Artist http://recruit.grani.jp/

89.

Thank you!