{"id":95,"date":"2014-03-20T19:42:55","date_gmt":"2014-03-21T02:42:55","guid":{"rendered":"http:\/\/c2.studioryu.net\/?p=95"},"modified":"2014-03-22T00:28:26","modified_gmt":"2014-03-22T07:28:26","slug":"dol-part-2-getting-started","status":"publish","type":"post","link":"https:\/\/c2.studioryu.net\/?p=95","title":{"rendered":"DOL &#8211; Part 2 &#8211; Getting started"},"content":{"rendered":"<p>Hey all Constructors. It is time for p2 of the DOL project. In this post I&#8217;m going to go over some of the preliminary elements to DOL and some theoretical target structure.<\/p>\n<p>To start with I am using a personal CAPX &#8220;template&#8221; that I call GameFrameWork. For me this includes features such as<\/p>\n<ul>\n<li>GYFM Font loader<\/li>\n<li>DataTables with active data saving to WebStorage<\/li>\n<li>GUI Panels, Buttons with inspector based functions calls and settings<\/li>\n<li>Timer Object<\/li>\n<li>Camera Object<\/li>\n<li>Loader Screen<\/li>\n<li>Splash Screen<\/li>\n<li>Touch &amp; Mouse Input<\/li>\n<\/ul>\n<p>DOL project isn&#8217;t about covering the basics so we are not going to do that. We are going to the next step and moving into building the game and the networking.<\/p>\n<p>Before starting let&#8217;s consider some structural elements to DOL. DOL structure and play will be similar to Phantasy Star\u00a0On-Line. Players join groups to go adventuring, but player computers also rely on a dedicated server to maintain data authority\u00a0over experience, equipment and such. Right now C2 Multiplayer Plugin only supports a single connection and one channel\/room. So at the moment we have limited capability to start. Since there is no authority server right now we are going to start with open access to Scirra signalling server and in the future use Cla.io as\u00a0our authentication server; unless Scirra changes to multiple connections.<\/p>\n<p>For now we want to start by digging into the tasty new\u00a0multi-player plugin and get the basics of communications started.<\/p>\n<p><strong>Starting Tools<\/strong><\/p>\n<ul>\n<li>Array named as global(don&#8217;t pollute the namespace)<\/li>\n<li>Multi-player plugin&#8230;. yum yum<\/li>\n<li>EventSheet called &#8220;networking&#8221;<\/li>\n<li>TextBox for player alias<\/li>\n<li>Listbox for a ConnectionLog<\/li>\n<li>buttonGFX(GFW)<\/li>\n<li>SpriteFont for a label and a word over the login button<\/li>\n<li>+ GameFrameWork(GFW)<\/li>\n<\/ul>\n<p>First we are going to create a new Event Sheet called &#8220;networking&#8221; with the root Group Name called &#8220;Networking&#8221;. I add the TextBox (playerName), SpriteFont (calibri20), button and a 9Patch panel to break the white monotony all added to the MENU_PAGE layout. Visual polishing is a long way off and with that I make no claims at being a good artist (I&#8217;m not) or very good at aesthetics.<br \/>\n[<em>I work heavily in OOP design for the purpose of cleaner code and general practice. I don&#8217;t like global scope variables and prefer to save those for the objects in the auto-complete.\u00a0I also tend to name all my LAYOUTS IN UPPER-CASE and my event-sheets in lower-case. Just so it is easier for me to determine the difference of a LAYOUT and sheet on the tab list.<\/em> ]<\/p>\n<h2>Client, Peer, Host, Master Host, Authority<\/h2>\n<p>In DOL we need to distinguish five different types of roles in the networking structure.<\/p>\n<p><strong>Client<\/strong> for our definition is any computer connected to centralized server for data. Most computers will be a Client in one form or another.<\/p>\n<p><strong>Peer<\/strong> for our definition is any one player&#8217;s computer that is connected to a server and interacts with the game world or other players. \u00a0Derelict Online Client will act as a Peer program.<\/p>\n<p><strong>Host<\/strong>\u00a0is a Peer that handles the game logic of board play. Very much like a Peer. Derelict Online Client will also act as a Host program.<br \/>\n<strong>Master Host<\/strong>\u00a0is yet another Client and connects like a Peer. The Master Host however does not have an active presence like the other players with an Avatar. The Master Host handles\u00a0the special Room logic\u00a0for interacting with the any one section of the HUB GameWorld. This will be different CAPX programs to cover the different types of activities.<\/p>\n<p><strong>Authority<\/strong> is the server that handles important information such as character storage and generation of items and randomiser for the board play.<\/p>\n<p>As the game develops this definition will be used to keep track of communication and understanding of the current events. Including as to what\u00a0caproj\u00a0(DOL player client) and\u00a0capx\u00a0(Master Host, Authority) are being covered in\u00a0the post\u00a0or section of the post.<\/p>\n<h1>Connecting to the Server(DOL-PC)<\/h1>\n<p>Before we start you should know that Scirra has great tutorials(<a href=\"https:\/\/www.scirra.com\/tutorials\/892\/multiplayer-tutorial-1-concepts\">concept<\/a>, <a href=\"https:\/\/www.scirra.com\/tutorials\/906\/multiplayer-tutorial-2-chat-room\">chat<\/a>, <a href=\"https:\/\/www.scirra.com\/tutorials\/915\/multiplayer-tutorial-3-real-time-game\">realtime<\/a>) on the Multiplayer Plugin. I suggest reading them and examining both the sample templates.<\/p>\n<p>For now we are going to assume that authentication login\/password has passed and players can connect to the game world. So no need for passwords or such items at this time.<\/p>\n<p>In ES-networking we are going to start with Signalling elements. With a standard &#8220;On LayoutStart&#8221;<\/p>\n<p><strong>Supports multiplayer<\/strong><br \/>\nLet&#8217;s make sure we can support multi-player. If we can or can&#8217;t we will log our state in the ConnectionLog.addItem(&#8220;&#8221;). \u00a0If the platform cannot support WebRTC we will also disable the Networking group.<\/p>\n<p><strong>\u00a0On Error<\/strong><br \/>\nIt&#8217;s always best to be ready to handle errors. Last time I used the plugin I received a JS error; which is useless in C2. However it is still a thrown error exception and we should log what there is. Also we should log any unique or required activity that we use of the MP plugin so we know what the error relates to.<\/p>\n<p><strong>Start Connection<\/strong><br \/>\nIn my GFW I use OnTouch reference in my button sprite. I have a variable that stores a a string used for function calls. So when a Touch occurs on the object the Function is called. So I have a Function in my es-mainmenu called &#8220;menu.login&#8221;. \u00a0This is the default scirra server. \u00a0We are going to log this to keep what is happing updated.<\/p>\n<p><strong>\u00a0On Connected<\/strong><br \/>\nThis is the Multi-player plugin call back. This is called when the signalling server returns a successful connection. Either way if this succeeds or fails we will log the result. So we are adding a successful log.<\/p>\n<p>For now we are going to hold our progress here. It&#8217;s a good spot because we need to choose which route in development we want to go. This is because everything above is the most basic design that is easily found in the tutorials.<\/p>\n<ul>\n<li>A. Prototyping. Connecting to other player hosts. \u00a0This will follow the same steps as the current templates and tutorials follow.<\/li>\n<li>B. Progressive. Connecting to a room with a Master Host. This will deviate from the already establish tutorials and start diving into more interesting areas.<\/li>\n<\/ul>\n<p>Regardless the next update is going to take some time. I am going to be super busy for the next few days. Good development Constructors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey all Constructors. It is time for p2 of the DOL project. In this post I&#8217;m going to go over some of the preliminary elements to DOL and some theoretical target structure. To start with I am using a personal CAPX &#8220;template&#8221; that I call GameFrameWork. For me this includes features such as GYFM Font &hellip; <a href=\"https:\/\/c2.studioryu.net\/?p=95\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">DOL &#8211; Part 2 &#8211; Getting started<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95"}],"version-history":[{"count":8,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":103,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions\/103"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/media\/111"}],"wp:attachment":[{"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}