xiaonanln / goworld

Scalable Distributed Game Server Engine with Hot Swapping in Golang
Apache License 2.0
2.53k stars 450 forks source link

需要 Unity Echo 的 KCP 範例 #93

Closed fnaith closed 3 years ago

fnaith commented 4 years ago

按照教學寫完Echo範例後,試圖用kcp-csharp改寫 GameClient.cs 以及 PacketReceiver.cs 後,就收不到Server的響應了。

Unity 2019.3.7f1 on MacOS

echo.zip

fnaith commented 4 years ago

補上設定檔

goworld.ini.zip

fnaith commented 4 years ago

最近為了做 MMO FPS 遊戲,需要 UDP通信方案。由於實現整套兼容 Entity 生命週期以及 TCPServer 的 UDPServer 感覺很困難,想請教以下的折衷方案在 GoWorld 架構上有沒有什麼明顯缺點。

Server 與 Client 主要還是用 TCP 溝通,但是Client還可以在 GameClient.cs 連接 TCP Client後,將其 Client Id 包入 UDP 封包中發送,用於傳送可容許丟包的信息,UDPServer.go 收到後拆分出 Client IdPacketGateService.go 再把解包的訊息傳給 GameProxy ,就如同從 TCP 收到的訊息來處理。Server 回覆給 Client 依然使用 TCP。

兩個附檔一個是主要的修改,另一個是完整的 echo server 與 client 端專案。 modified.zip goworld_echo_test.zip