{"id":121,"date":"2014-03-27T18:15:31","date_gmt":"2014-03-28T01:15:31","guid":{"rendered":"http:\/\/c2.studioryu.net\/?p=121"},"modified":"2014-03-27T19:51:39","modified_gmt":"2014-03-28T02:51:39","slug":"dol-part-3-master-hub","status":"publish","type":"post","link":"https:\/\/c2.studioryu.net\/?p=121","title":{"rendered":"DOL Part 3 &#8211; Master Hub"},"content":{"rendered":"<p>Time to move on to the Master Hub. In DOL the players need a place to talk and handle their activities in an immersion style of play. Of course we can do this without any kind of world play environment, but this is a good opportunity to get players immersed. So we need a stable environment for players to gather. Having players who connect and disconnect constantly isn&#8217;t stable nor can players reliably conduct there character activities in such an unstable environment. So we are going to make a Master Hub.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" alt=\"\" src=\"http:\/\/studioryu.net\/images\/MasterHub_00.png\" width=\"591\" height=\"332\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The Master Hub is a single Scirra Room Host. Our MH will also handle players moving from location to location and open chat messages. This is kind of a pain; where more channels\/rooms would have been helpful. However the investment for this structure is worth it. If the MH is overloaded with 200+ players then we can just open another MH and provide interconnection. So yay we get to do our simplified internal signalling service.<\/p>\n<p>When considering our structure for MH let&#8217;s think.<br \/>\nMaster HUB does not need graphics(no canvas render)<br \/>\nMaster HUB should have logs(Text objects, no canvas render)<br \/>\nMaster HUB needs to manage all players connected to it.<br \/>\nMaster HUB needs to be it&#8217;s own CAPX(no assets)<br \/>\nMaster HUB instance manager to mange more version of self<\/p>\n<p>So what tools do we need<br \/>\nMultiplayer Plugin<br \/>\nArrays to each location&#8217;s player list<br \/>\nFunction because you should always structure around Funtions<br \/>\nSome images for locations&#8230; uh oh. I suck at graphics \ud83d\ude41<\/p>\n<p>Building the foundation of Master Hub<br \/>\nFor starters there is only one layout. And when the layout starts we connect to the server. Upon connection to the server we see if a DOL HUB [x] is created. Failing that the Hub will create a room. This is incremental and will automatically have minimal scaling.<\/p>\n<p>As a note spending more time with MP Plugin. I am finding that there are Instances of games. This could be very valuable. However there seems to be no Instance based functions. If it becomes possible to maintain room or player management through the Instance this could save time. However we will proceed with our current design of Master HUB.<\/p>\n<p>Ok so what I have now is the MasterHub creating an instance for 100 players. I&#8217;ve stubbed the population instancing for now until more information comes out on instances. \u00a0The MH now keeps logs of all activities. \u00a0MH now acts as a stable game world. All pretty easy stuff really. On to the more fun stuff.<\/p>\n<p>Area Enter<br \/>\nWe could jump to having other players connect, but that would be the standard stuff. What makes DOL MH matter is the area management. So I&#8217;ve set up the the MH to create arrays for each area in the DOL HUB world.<\/p>\n<p>For starters when a player connects nothing happens to the player. The MH has to place the player into an area and then the MH will inform the player the area he is in and a spawn point. At this time we will assume the player always joins the game world at the same location and stuff like that; why because we have no persistent data yet.<\/p>\n<p>So what do we do. The MH will add the PeedID to the array and then tell the player where he is spawning. This is done my custom message. \u00a0Before we start that we are going to create an Object to act as our tag list. that way we will reduce mistaken custom message tags. We want a layout object so that we can copy\/paste the object between projects, but we don&#8217;t want anything to effect the Canvas. So we will use a DOM object. A text area called &#8220;Msg&#8221;. That way when we need to ID the tag we can just refer to Msg.mEnterArea. I am adding the prefix so when I need a quick tag reference for the aut-complete pressing &#8216;m&#8217; will jump right there. Our message will just be the name of an object spawn sprite. That way we can move the sprite and the player will spawn where. To forward think the situation &amp;refers to name, #xycoords.\u00a0So we are going to go &#8220;lounge,&amp;spawn&#8221;.<\/p>\n<p>So here are first messages<br \/>\nMsg.mEnterArea \u00a0: &#8220;[associate_layout_name],#&amp;location&#8221;<br \/>\nmessage to client to enter an area<\/p>\n<p>Msg.mGotoArea: &#8220;[area going to], [spot left at]&#8221;<br \/>\nmessage from client that they are leaving<\/p>\n<p>Msg.mEnteredArea: &#8220;[peerId], [area], #&amp;location&#8221;<br \/>\nmessage to client that some one entered the room<\/p>\n<p>Msg.mLeftArea&#8221; [peerid], [spot left at] &#8221;<br \/>\nmessage to clients in the area that some one left the room<\/p>\n<p>Msg.mMoveTo: &#8220;[peerid], X,Y&#8221;<br \/>\nmessage to where pathfinder should move the player to<\/p>\n<p>Msg.mChat<br \/>\nmessage of chat information<\/p>\n<p>I also created a Function called Area.RelayMessage. This acts as the Multiplayer.Broadcast. However since we don&#8217;t want to send messages such as &#8220;EnteredArea&#8221; to everyone. We are using the arrays and such for lists to send messages to. Not as nice as would having a Multi Room listening or major game instance listener, but we work with what we have.<\/p>\n<p><em>To cover how the next step works in DOLClient. The message will be parsed as a LAYOUT and Object\/XY position. The full version will be more complex as needed&#8230; and probably more encoded.<\/em><\/p>\n<p>There is a lot more to do. This is just the start of the MasterHub, but we want to get the ball rolling with interactivity. So we are moving on. This now covers Part 3. In Part 4 we will be working back on the Client. Last we left off was with joining the server, but not yet entered the room.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Time to move on to the Master Hub. In DOL the players need a place to talk and handle their activities in an immersion style of play. Of course we can do this without any kind of world play environment, but this is a good opportunity to get players immersed. So we need a stable &hellip; <a href=\"https:\/\/c2.studioryu.net\/?p=121\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">DOL Part 3 &#8211; Master Hub<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts\/121","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=121"}],"version-history":[{"count":5,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":126,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions\/126"}],"wp:attachment":[{"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c2.studioryu.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}