Building Your World

This documentation covers how to construct a Realm, place a Zone within it and populate the Zone with linked Rooms.

The Mud Designer Engine makes creating Environments fairly simple, and linking them together really easy. The most important thing for you to remember however, is the hierarchy of the environments. Realms contain Zones. Zones contain Rooms. Players only traverse through Rooms, however Zones allow you to segregate Rooms from each other in a categorized manor. Realms provide an even deeper form of breaking environments up.

When I construct my Environments I typically use them in a literal sense, meaning that each Realm literally contains all the environments for that Realm. What your definition of a Realm is will be up to you, however I try to use a Continent (or if it's a large Continent, I will break them up by province.). For Zones, I use to store my actual Locations such as a Kingdom or a Village. You can then place each Village and Kingdom (Zones) inside your Continent (Realms) and they will all be contained together.

Rooms are how players move about the world, it's how they see the world and interact with it. A Room is exactly that, a Room that the player is currently in. However, a Room does not have to be interior only. You create your Rooms and place them into your Zones (which can be a village, or kingdom remember?). Your village can have a Bedroom, and your kingdom can have a bedroom, each will be segregated from each other. You can even break things down even more by creating each street in a kingdom as a Zone, and using the Kingdom as a Realm.
It is recommended that you draw out the world you want on paper prior to creating it, so that you can better figure out what you want your Realms to contain, and what each Zone will represent.

Now, lets create our first Realm. This will be placed inside a new Method that we will create inside the MyGame class created in the Preparing Your Game document. We will begin by adding onto the existing by instancing our Realm.
public class MyGame : Game
{
    public MyGame()
        : base()
 {
     GameTitle = "My very own MUD!";
     IsMultiplayer = true;

     CompanyName = "My Company!";
     Website = "Http://MudDesigner.Codeplex.com";
     Version = "1.0";
     MaximumPlayers = 5000;

     //Instance our Realm
     Realm myRealm = new Realm(this);
     myRealm.Name = "New York";
     myRealm.Description = "The city of New York is always hustling and bustling.";
     myRealm.IsInitialRealm = true;

     //Add the Realm to the Games RealmCollection
     World.AddRealm(myRealm);
 }
}


Now we have a Realm and it's been added to the game manager. We made sure to set the IsInitialRealm property to true so that the engine will know that MyGame contains a starting Realm. The starting Realm is used to look for a starting Zone and starting Room during server startup.
Now we have our Realm, lets create a Zone to put in it!
     Zone myZone = new Zone(this);
     myZone.Name = "San Diego";
     myZone.Description = "San Diego has many attractions, including Sea World!";
     myZone.IsInitialZone = true;
     
     //Add the Zone to the Realm
     myRealm.AddZone(myZone);

Once again we made sure to set the myZone.IsInitialZone to true so that the Server will know this is a starting Zone during startup. The rest of it is pretty much the same as the Realm isn't it? The only difference is we don't add the zone using the AddRealm method, but rather, we use the myRealm.AddZone(). The Realm handles adding the Zone to itself and making sure everything is ok.
Now we are just lacking Rooms.
     //Create our HotelRoom
     Room myRoom = new Room(this);
     myRoom.Name = "Hotel Room B33";
     myRoom.IsInitialRoom = true;
     myRoom.DetailedDescription.Add("Your Hotel Room is pretty clean, it is small but not to far off from the beach so you can't complain.");
     myRoom.DetailedDescription.Add("You can exit your Hotel Room by walking West");
     //Add the Hotel Room to the Zones Room Collection
     myZone.AddRoom(myRoom);

     Room myHallway = new Room(this);
     myHallway.Name = "Hotel Hallway";
     myHallway.DetailedDescription.Add("The Hotel Hallway is fairly narrow, but there is plenty of room for people to traverse through it.");
     myHallway.DetailedDescription.Add("Your Hotel Room B33 is to the East.");
     //Add the Hallway to the Zones Room Collection
     myZone.AddRoom(myHallway);


Here we do something a little different, and that is the DetailedDescription property. While Rooms have the same Description property that Zones and Realms do, we choose to use DetailedDescription for each Room so that we can easily create a multi-line description. Each DetailedDescription that you add, it will be printed to the player in a new line. Use this approach to ensure multi-line messages are displayed to the player correctly.
note All objects contain a DetailedDescription property. We just did not use it for our Zones and Realm in this example as we only needed a single line description.

Next you'll notice that we set myRoom.IsInitialRoom to true, and added both Rooms to the zone via myZone.AddRoom(). Now to test it! Run the Server and see what happens, you should see the initial environment information displayed once the server is finished starting.

Now, since the player was previously saved in the Abyss (if you entered a player name in any of the previous Server startups) then you will be required to delete the player. It is best to just delete the players folder and let the Server re-create it. You can re-enter your player name and you should now be presented with a description of your Hotel Room!
Now, type Walk West to exit the Room. See what happened? It said you couldn't travel in that direction! What gives? We haven't linked the two Rooms yet. So go ahead and close the Server and re-open your MyGame.cs

At the very end you will need to add the following line.
     myZone.LinkRooms(AvailableTravelDirections.West, myHallway, myRoom);


What we just did was tell the Zone that we want to travel West to the Hallway from the bedroom. Now if you start the Server and connect via telnet, you can walk west and east, in and out of your hotel room! Adding additional Rooms is pretty simple.
Room nextRoom = new Room(this);
     nextRoom.Name = "Hotel Room B34";
     nextRoom.DetailedDescription.Add("This Hotel Room is pretty dirty, they must not have cleaned it yet.");
     nextRoom.DetailedDescription.Add("You can exit this room by walking East");
     myZone.AddRoom(nextRoom);
     //Link
     myZone.LinkRooms(AvailableTravelDirections.East, myHallway, nextRoom);


What we did was created a Room that was on the east side of the hallway. Since our Room is on the west side of the hall, that means the new room B34 is directly in front of our room B33. You will need to edit the myHallway.DetailedDescription to let users know that there is another Room in the hall. Revise your DetailedDescription like such:
myHallway.DetailedDescription.Add("The Hotel Hallway is fairly narrow, but there is plenty of room for people to traverse through it.");
     myHallway.DetailedDescription.Add("Your Hotel Room B33 is to the East.");
     myHallway.DetailedDescription.Add("Hotel Room B34 is to your West.");


Now you have three rooms all connected together that you can traverse through!
note Alpha 1.1 does not support moving from zone to zone or realm to realm, this will be addressed shortly.

Now for the complete MyGame script!

public class MyGame : Game
{
    public MyGame()
        : base()
 {
     GameTitle = "My very own MUD!";
     IsMultiplayer = true;

     CompanyName = "My Company!";
     Website = "Http://MudDesigner.Codeplex.com";
     Version = "1.0";
     MaximumPlayers = 5000;

     //Instance our Realm
     Realm myRealm = new Realm(this);
     myRealm.Name = "California";
     myRealm.Description = "The Beaches of California are relaxing and fun to be at.";
     myRealm.IsInitialRealm = true;

     //Add the Realm to the Games RealmCollection
     World.AddRealm(myRealm);

     Zone myZone = new Zone(this);
     myZone.Name = "San Diego";
     myZone.Description = "San Diego has many attractions, including Sea World!";
     myZone.IsInitialZone = true;

     //Add the Zone to the Realm
     myRealm.AddZone(myZone);

     //Create our HotelRoom
     Room myRoom = new Room(this);
     myRoom.Name = "Hotel Room B33";
     myRoom.IsInitialRoom = true;
     myRoom.DetailedDescription.Add("Your Hotel Room is pretty clean, it is small but not to far off from the beach so you can't complain.");
     myRoom.DetailedDescription.Add("You can exit your Hotel Room by walking West");
     //Add the Hotel Room to the Zones Room Collection
     myZone.AddRoom(myRoom);

     Room myHallway = new Room(this);
     myHallway.Name = "Hotel Hallway";
     myHallway.DetailedDescription.Add("The Hotel Hallway is fairly narrow, but there is plenty of room for people to traverse through it.");
     myHallway.DetailedDescription.Add("Your Hotel Room B33 is to the East.");
     myHallway.DetailedDescription.Add("Hotel Room B34 is to your West.");
     //Add the Hallway to the Zones Room Collection
     myZone.AddRoom(myHallway);
     
     myZone.LinkRooms(AvailableTravelDirections.West, myHallway, myRoom);
     
     Room nextRoom = new Room(this);
     nextRoom.Name = "Hotel Room B34";
     nextRoom.DetailedDescription.Add("This Hotel Room is pretty dirty, they must not have cleaned it yet.");
     nextRoom.DetailedDescription.Add("You can exit this room by walking East");
     myZone.AddRoom(nextRoom);
     //Link
     myZone.LinkRooms(AvailableTravelDirections.East, myHallway, nextRoom);
 }
}


You are now ready to begin building your world!

Last edited Aug 15, 2010 at 7:56 PM by Scionwest, version 3

Comments

No comments yet.