make a a game server in go , worth it ?

agolangf · · 742 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I have a simple 3d game and I want players play 1 vs 1 , will golang be good and easy for making a udp game server . I am using unity by the way . Thank you</p> <hr/>**评论:**<br/><br/>mixiegen: <pre><p>Surely, with cross-platform and built-in standard network packages, Go is good for developing game servers.</p> <p>I heard of some game companies using Go to develop their game servers and the results are great.</p></pre>PaluMacil: <pre><p>Hmmm, for the server portion, Go might be a nice option. There aren&#39;t as many examples covering UDP as TCP (which is the case in any language), but it isn&#39;t very complicated. See here for a syntax comparison. <a href="http://www.minaandrawos.com/2016/05/14/udp-vs-tcp-in-golang/" rel="nofollow">http://www.minaandrawos.com/2016/05/14/udp-vs-tcp-in-golang/</a></p></pre>jackmott2: <pre><p>it will be easier to use C# since you are using unity for the client. serialization will be simple with C# at both ends, and you can share code.</p></pre>Creshal: <pre><p>Take note that native object serialization is one of the easiest ways to get your server exploited. </p> <p>While C# isn&#39;t nearly as bad at it as Java is, <a href="https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/security-considerations-for-data" rel="nofollow">it pays to read Microsoft&#39;s guidelines</a> on <a href="https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/serialization-and-deserialization" rel="nofollow">how to safely work with untrusted serialized data</a>.</p></pre>jackmott2: <pre><p>Protobuf.net is really nice: <a href="https://github.com/mgravell/protobuf-net" rel="nofollow">https://github.com/mgravell/protobuf-net</a></p></pre>Creshal: <pre><p>…but when you&#39;re using protobuf anyway, it doesn&#39;t matter what languages you exchange data between.</p></pre>jackmott2: <pre><p>well, it matters a bit less. I think go makes a great language for game servers but it is really nice not to have to duplicate all your structs and write physics code twice (which has to be exactly the same) and not have to flip between languages all the time. </p> <p>C# is similar enough on performance and relevant features the only compelling case I can come up with for using Go in this scenario would be &#34;I want to learn some Go&#34;</p></pre>Thaxll: <pre><p>This is the main issue, and re-implementing all the classes in Go will be time consuming.</p></pre>sOundsoFpErsistence: <pre><p>For more complex needs where you&#39;re trying to maintain a constant X tick rate I would argue that Go could turn out to be troublesome. You&#39;d have to program carefully to avoid allocation and unexpected GC pause lengths. If you follow zero allocation patterns Go can probably be good enough, though personally Go loses a lot of it&#39;s appear when having to be so careful about the GC. I&#39;d likely choose Rust, fwiw.</p> <p>Now for simpler servers where you&#39;re less concerned about the tick rate, Go is a great option. Easy prototyping, overall very fast.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

742 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传