{"id":280,"date":"2020-11-09T20:47:33","date_gmt":"2020-11-09T20:47:33","guid":{"rendered":"http:\/\/mycours.es\/gamedesign2020\/?page_id=280"},"modified":"2020-12-11T14:00:21","modified_gmt":"2020-12-11T14:00:21","slug":"unity-socket-io","status":"publish","type":"page","link":"http:\/\/mycours.es\/gamedesign2020\/unity-socket-io\/","title":{"rendered":"Unity + Socket.io"},"content":{"rendered":"<h2>Distributed Authority Framework<\/h2>\n<p><a href=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-130.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-287\" src=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-130-1024x560.png\" alt=\"\" width=\"840\" height=\"459\" srcset=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-130-1024x560.png 1024w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-130-300x164.png 300w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-130-768x420.png 768w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-130.png 1103w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p>An example of multiplayer architecture with &#8220;smart&#8221; clients.<br \/>\nThe clients (Unity) do most of the work; the server (node.js) mostly validates and broadcast the changes of state. All the information is included in the README file and in the code itself:<\/p>\n<p><a href=\"https:\/\/github.com\/molleindustria\/distributedAuthorityServer\">Github repository server<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/molleindustria\/distributedAuthorityClient\">Github repository client<\/a><\/p>\n<p><strong>Setup and overview video<\/strong><\/p>\n<p><iframe loading=\"lazy\" title=\"Distributed Authority Framework\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/G1P_dNi1eA0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>.<\/p>\n<p>&nbsp;<\/p>\n<h2>Dumb Clients + Authoritative Server Example<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-282\" src=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-129.png\" alt=\"\" width=\"796\" height=\"492\" srcset=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-129.png 796w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-129-300x185.png 300w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-129-768x475.png 768w\" sizes=\"auto, (max-width: 796px) 85vw, 796px\" \/><\/p>\n<p><a href=\"https:\/\/github.com\/molleindustria\/MMORPS\">MMORPS <\/a>\u00a0&#8211; a real-time massively multiplayer Rock Paper Scissor.<br \/>\nThis is implemented in node.js + p5.<\/p>\n<p>Since most of the logic is on the server side we can keep the server as it is a make an equivalent client in Unity.<\/p>\n<p><a href=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-128.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-283\" src=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-128.png\" alt=\"\" width=\"952\" height=\"533\" srcset=\"http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-128.png 952w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-128-300x168.png 300w, http:\/\/mycours.es\/gamedesign2020\/files\/2020\/11\/Image-128-768x430.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/github.com\/molleindustria\/UnitySocketServer\">Unity MMORPS<\/a> &#8211; This repository is almost identical to the game above on the server side but can render HYPER REALISTIC GRAPHICS thanks to Unity.<\/p>\n<p><a href=\"https:\/\/github.com\/molleindustria\/UnitySocketServer\">The topics are all in the README file<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Alternatives<\/h2>\n<h3>Normcore.io<\/h3>\n<p><a href=\"https:\/\/normcore.io\/\">Normcore<\/a> is a multiplayer networking plugin for Unity. Its emphasis is on social VR but it works well for screen based applications as well.<br \/>\nThe plug-in works in tandem with a cloud service.<\/p>\n<p>Here are some pro and cons:<\/p>\n<p>Pros:<br \/>\n* You don&#8217;t have to care about the server side. Normcore takes care of the synchronization across clients<br \/>\n* It&#8217;s designed specifically for Unity and comes with handy components<br \/>\n* It supports persistent objects from the get-go<br \/>\n* It&#8217;s actively maintained by professionals, with AR\/VR features being added regularly<br \/>\n* The free version is generous and there is a pay-as-you go option that is appropriate for small projects<br \/>\n* Social VR advanced components like Voice chat, avatar mapping<\/p>\n<p>Cons:<br \/>\n* Normcore is subscription-based, if you go over your quota and\/or if you don&#8217;t pay the monthly fee your project stops working<br \/>\n* Like every cloud service, if it goes out of business or it gets acquired and shut down, your project stops working<br \/>\n* While plain socket.io is open source, Normcore is a complex proprietary plugin. If Glitch.com shuts down, you can move your node.js projects elsewhere with minimum effort. If Normcore disappears or changes its rates or terms of service, you have to remake most of your project<br \/>\n* Not having control over the server side means that you may not be able to implement some of the less common features<br \/>\n* Normcore doesn&#8217;t work with WebGL, so you won&#8217;t be able to make **browser** games<br \/>\n* It&#8217;s a new plugin and there is almost ZERO documentation and no community around it<\/p>\n<h3>Photon<\/h3>\n<p><a href=\"https:\/\/www.photonengine.com\/\">Photon\u00a0<\/a> &#8211; it&#8217;s a mature multiplayer suite of services that integrates with all engines. It seems targeted to <a href=\"https:\/\/www.photonengine.com\/en\/pun\/showcase\">casual multiplayer games<\/a> with a small amount of players per room.<\/p>\n<p>The pro and cons are the same as in normcore with the difference that it&#8217;s more difficult to use but presumably more reliable both in terms of infrastructure and engineering, and in the long-term sustainability as a business &#8211; they&#8217;ve been around since 2003.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Distributed Authority Framework An example of multiplayer architecture with &#8220;smart&#8221; clients. The clients (Unity) do most of the work; the server (node.js) mostly validates and broadcast the changes of state. All the information is included in the README file and in the code itself: Github repository server Github repository client Setup and overview video . &hellip; <a href=\"http:\/\/mycours.es\/gamedesign2020\/unity-socket-io\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Unity + Socket.io&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":7,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-280","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/pages\/280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/comments?post=280"}],"version-history":[{"count":4,"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/pages\/280\/revisions"}],"predecessor-version":[{"id":300,"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/pages\/280\/revisions\/300"}],"wp:attachment":[{"href":"http:\/\/mycours.es\/gamedesign2020\/wp-json\/wp\/v2\/media?parent=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}