C# /
UniRx
Yoshifumi Kawai
CTOGrani, Inc.
About speaker
•
•
•
•
•
•
•
•
•
About this session
•
•
About this session
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
• 4 NPC
• 4 vs 4
• C#
• AI
•
• UniRx
• LINQ to GameObject
• MessagePack for C#
• MagicOnion
• MasterMemory
• ReMotion
• by Yoshifumi Kawai
• etc...
using
Why C#?
Why Unity?
•
•
•
•
•
•
•
•
•
C#
•
•
•
•
•
•
•
•
•
How to
•
•
•
•
)
•
•
•
• IDL(Interface Definiton Language)
• IDL = JSON proto /
• IDL ……
• IDL
• C#
• IDL
IDL
• Visual Studio
•
• Unity
• Git
• ……
• C#
• C#
•
•
Visual Studio
C# C#
• C# C#
• C# 6.0(Visual Studio 2015)
•
• [MessagePackObject] => ***MessagePackFormatter
• /
•
•
•
• /
•
•
•
•
•
•
•
• /
•
•
•
•
•
• /
•
• /
•
•
•
•
• /
•
• /
•
•
•
C#
• C# /
•
•
•
•
• /
•
IDL
•
•
• C#
• ……
•
•
•
•
•
•
3
gRPC
• Web API + Streaming
• Google HTTP/2 RPC
• HTTP/2 HTTP/1
• gRPC
• Web API
• (Unity )
• (Unity Web API )
google
gRPC
• Web API + Streaming
• Google HTTP/2 RPC
• HTTP/2 HTTP/1
• gRPC
• Web API
• (Unity )
• (Unity Web API )
google
Unity gRPC
• C# gRPC Unity
• .NET 4.5
•
• gRPC Client Unity
• .NET 3.5 + IL2CPP
• (C Core) iOS/Android
• /
• gRPC IDL Prot...
Unity gRPC
• C# gRPC Unity
• .NET 4.5
•
• gRPC Client Unity
• .NET 3.5 + IL2CPP
• (C Core) iOS/Android
• /
• gRPC IDL Prot...
•
•
•
•
•
•
•
•
• ……
•
•
•
•
•
•
•
•
• ……
UNET
• Unity
•
•
•
• C#
•
• UNET
• C#
•
• Web API ,
Web API
•
•
•
•
•
•
•
•
•
Web API
•
•
•
•
•
•
•
•
•
• Web API
Streaming Service(gRPC Battle Engine)
F for AI
• AI (DSL) F#
• F# .NET Framework
• Excel F#
C# gRPC BattleEngine
• AI
Streaming Server
•
•
•
•
•
•
•
•
•
•
We’re using UniRx
•
•
•
•
•
•
•
We’re using UniRx
•
•
•
•
•
•
•
UniRx
•
•
•
•
•
•
•
•
•
• : 3845 : 1186
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Rx
•
•
•
•
•
Rx 3
// これで例外を共通ハンドリング
IObservable<TResponse> HnadleCommonError<TRequest, TResponse>(IObservable<TResponse> source
{
retur...
Pitfall of Empty
•
•
IObservable<Unit> Test()
{
return Observable.FromCoroutine(() => TestCore());
}
IEnumerator TestCore(...
Pitfall of Empty
•
•
IObservable<Unit> Test()
{
return Observable.FromCoroutine(() => TestCore());
}
IEnumerator TestCore(...
UI Framework Rx
•
•
•
•
•
•
•
•
Chaotic Rx
•
•
•
•
•
Ivory.Unity.Core.Scene.<OnAfterNavigate>c__AnonStorey76A:<>m__2DC7(Unit)
UniRx.Operators.Do:OnNext(Un...
Model-View-(Reacitve)Presenter
View
Reactive
Presenter
Model
Model-View-(Reacitve)Presenter
View
Reactive
Presenter
Model
Chaotic-Reacitve-Model
Reactive
Presenter
Model
Chaotic-Reacitve-Model
Reactive
Presenter
Model
Rx Simplicity
•
•
•
•
•
•
•
•
•
•
Rx
•
•
•
•
•
•
•
•
•
•
• Before gRPC
•
•
•
•
•
• After gRPC
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
ZeroFormatter
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MessagePack for C#
C#
•
•
•
•
•
•
•
•
•
C#
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
DB
•
•
•
•
Architecture of MasterMemory
Header LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack
Memory<T>
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
The Future Has Come
•
• C#
•
•
•
•
•
•
We're Hiring
Unity Engineer/Technical Artist
http://recruit.grani.jp/
Thank you!
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
【Unite 2017 Tokyo】「黒騎士と白の魔王」にみるC#で統一したサーバー/クライアント開発と現実的なUniRx使いこなし術
Upcoming SlideShare
Loading in …5
×

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

630 views

Published on

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

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

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

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
630
On SlideShare
0
From Embeds
0
Number of Embeds
99
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

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

  1. 1. C# / UniRx
  2. 2. Yoshifumi Kawai CTOGrani, Inc.
  3. 3. About speaker • • • • • • • • •
  4. 4. About this session • •
  5. 5. About this session • •
  6. 6. • • • • • • •
  7. 7. • • • • • • • • •
  8. 8. • • • • • • • •
  9. 9. • • • • • • •
  10. 10. • • • • • • • •
  11. 11. • 4 NPC • 4 vs 4 • C# • AI •
  12. 12. • UniRx • LINQ to GameObject • MessagePack for C# • MagicOnion • MasterMemory • ReMotion • by Yoshifumi Kawai • etc...
  13. 13. using
  14. 14. Why C#? Why Unity? • • • • • • • • •
  15. 15. C# • • • • • • • • •
  16. 16. How to • • • •
  17. 17. ) • • •
  18. 18. • IDL(Interface Definiton Language) • IDL = JSON proto / • IDL …… • IDL • C# • IDL
  19. 19. IDL • Visual Studio • • Unity • Git • …… • C# • C# • •
  20. 20. Visual Studio
  21. 21. C# C# • C# C# • C# 6.0(Visual Studio 2015) • • [MessagePackObject] => ***MessagePackFormatter • /
  22. 22. • • • • / • • • •
  23. 23. • • • • / • • • •
  24. 24. • • / • • / • • •
  25. 25. • • / • • / • • •
  26. 26. C# • C# / • • • • • / • IDL •
  27. 27. • • C# • …… • • • • • •
  28. 28. 3
  29. 29. gRPC • Web API + Streaming • Google HTTP/2 RPC • HTTP/2 HTTP/1 • gRPC • Web API • (Unity ) • (Unity Web API ) google
  30. 30. gRPC • Web API + Streaming • Google HTTP/2 RPC • HTTP/2 HTTP/1 • gRPC • Web API • (Unity ) • (Unity Web API ) google
  31. 31. 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
  32. 32. 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
  33. 33. • • • • • • • • • ……
  34. 34. • • • • • • • • • ……
  35. 35. UNET • Unity • • • • C# • • UNET • C# • • Web API ,
  36. 36. Web API • • • • • • • • •
  37. 37. Web API • • • • • • • • •
  38. 38. • Web API
  39. 39. Streaming Service(gRPC Battle Engine)
  40. 40. F for AI • AI (DSL) F# • F# .NET Framework • Excel F# C# gRPC BattleEngine • AI
  41. 41. Streaming Server • • • • • • • • • •
  42. 42. We’re using UniRx • • • • • • •
  43. 43. We’re using UniRx • • • • • • •
  44. 44. UniRx • • • • • • • •
  45. 45. • • : 3845 : 1186 • • • • •
  46. 46. • • • • • • • • • •
  47. 47. Rx • • • • •
  48. 48. 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>(); }); }
  49. 49. Pitfall of Empty • • IObservable<Unit> Test() { return Observable.FromCoroutine(() => TestCore()); } IEnumerator TestCore() { yield return Observable.Empty<int>().ToYieldInstruction(); Debug.Log(“この行には到達する"); }
  50. 50. Pitfall of Empty • • IObservable<Unit> Test() { return Observable.FromCoroutine(() => TestCore()); } IEnumerator TestCore() { yield return Observable.Empty<int>().ToYieldInstruction(); Debug.Log("come here"); }
  51. 51. UI Framework Rx • • • • • • • •
  52. 52. 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)
  53. 53. Model-View-(Reacitve)Presenter View Reactive Presenter Model
  54. 54. Model-View-(Reacitve)Presenter View Reactive Presenter Model
  55. 55. Chaotic-Reacitve-Model Reactive Presenter Model
  56. 56. Chaotic-Reacitve-Model Reactive Presenter Model
  57. 57. Rx Simplicity • • • • • • • • • •
  58. 58. Rx • • • • • • • • • •
  59. 59. • Before gRPC • • • • • • After gRPC • •
  60. 60. • • • • • • • • •
  61. 61. • • • • • • • • •
  62. 62. ZeroFormatter
  63. 63. • • • • •
  64. 64. • • • • • • • • •
  65. 65. MessagePack for C#
  66. 66. C# • • • • • • • • •
  67. 67. C# • • • • • • • • •
  68. 68. • • • • • • • •
  69. 69. • • • • • • • • •
  70. 70. • • • • • • • • •
  71. 71. DB • • • •
  72. 72. Architecture of MasterMemory Header LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack Memory<T>
  73. 73. • • • • • • • • • •
  74. 74. • • • • • • • • • •
  75. 75. The Future Has Come • • C# • • • • • •
  76. 76. We're Hiring Unity Engineer/Technical Artist http://recruit.grani.jp/
  77. 77. Thank you!

×