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’t stable nor can players reliably conduct there character activities in such an unstable environment. So we are going to make a Master Hub.
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.
When considering our structure for MH let’s think.
Master HUB does not need graphics(no canvas render)
Master HUB should have logs(Text objects, no canvas render)
Master HUB needs to manage all players connected to it.
Master HUB needs to be it’s own CAPX(no assets)
Master HUB instance manager to mange more version of self
So what tools do we need
Arrays to each location’s player list
Function because you should always structure around Funtions
Some images for locations… uh oh. I suck at graphics 🙁
Building the foundation of Master Hub
For 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.
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.
Ok so what I have now is the MasterHub creating an instance for 100 players. I’ve stubbed the population instancing for now until more information comes out on instances. The MH now keeps logs of all activities. MH now acts as a stable game world. All pretty easy stuff really. On to the more fun stuff.
We 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’ve set up the the MH to create arrays for each area in the DOL HUB world.
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.
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. Before 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’t want anything to effect the Canvas. So we will use a DOM object. A text area called “Msg”. 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 ‘m’ 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 &refers to name, #xycoords. So we are going to go “lounge,&spawn”.
So here are first messages
Msg.mEnterArea : “[associate_layout_name],#&location”
message to client to enter an area
Msg.mGotoArea: “[area going to], [spot left at]”
message from client that they are leaving
Msg.mEnteredArea: “[peerId], [area], #&location”
message to client that some one entered the room
Msg.mLeftArea” [peerid], [spot left at] ”
message to clients in the area that some one left the room
Msg.mMoveTo: “[peerid], X,Y”
message to where pathfinder should move the player to
message of chat information
I also created a Function called Area.RelayMessage. This acts as the Multiplayer.Broadcast. However since we don’t want to send messages such as “EnteredArea” 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.
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… and probably more encoded.
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.