Looking for feedback on Warcraft 2 clone multiplayer server

xuanbao · · 507 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>My friend and I are re-implimenting the multiplayer server for a Warcraft 2 clone we are doing for a class project. We&#39;ve only just started working on it, but I&#39;d love to get some feedback as I&#39;m sure w&#39;ve already done plenty wrong :) </p> <p><a href="http://github.com/aaparella/Gocraft">http://github.com/aaparella/Gocraft</a></p> <p>Any comments would be welcome! I&#39;ve been writing Go for a little while, but nothing very significant, so this is essentially my first actual project, and it is for my friend as well.</p> <p>Thanks for your time and help! :) </p> <hr/>**评论:**<br/><br/>lubosz: <pre><p>When this is a reimplementation, where is the first one? Where is the client?</p></pre>Midnightblues: <pre><p>Unfortunately they&#39;re hosted privately. They&#39;re also a work in progress, as well. </p></pre>upboatact: <pre><p>some non-go naming of things (underscores in names, I&#39;m guessing to make it look like some other language? what for?), weird comments, otherwise it&#39;s fine</p> <p>pro tip: gometalinter will point these out</p> <p>edit: oh, noticed that you are re-marshalling to json for every single player when broadcasting, which is sub-optimal</p></pre>Midnightblues: <pre><p>Thanks! We were just thinking that it would make some things a bit easier if we kept functions that handle messages received distinctly. </p> <p>Thanks for the marshalling note, overlooked that by mistake.</p></pre>drwiggly: <pre><p>Your room class isn&#39;t thread/goroutine safe. The players list need to be guarded by a mutex. Probably RWMutex, take read on broadcast, take write when removing or adding. Also having Players exported probably isn&#39;t safe, should probably hide it then provide an accessor if you need it that takes the Read lock and calls a func with each item.</p></pre>

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

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