Preparing your Game

This documentation outlines the requirements to setup a custom game and get your MUD game running with a little customization done to it

If you read through the first document regarding setting up the server, you should now be ready to begin building your own Game using the Mud Designer Engine. We will be spending our time inside the Scripts folder found in the save directory that your MudServer.exe is installed in. Go inside the scripts directory and create a new Text file, named MyGame.cs
Once it's created you can open the file and place the following code inside of it.
public class MyGame : Game
{
 public MyGame() : base()
 {
     GameTitle = "My very own MUD!";
 }
}


Now that you have finished with that, you can start your server. If everything went right and you have no errors, go ahead and open a Telnet client and attempt to enter the game. You should see your "My Very Own MUD!" printed in the client along with the prompt to enter your name. If you enter your name then the game will place you into the Abyss room due to no Environments being created yet.

Quick Run-down

The first thing you do in a script is give the class that your script file contains, a name.
public class MyGame() : base()

In this case we called it MyGame and used a colon to tell the script that we want to inherit from the internal engine class called Game. What's that do? It allows you to write a modified version of the existing game manager, or add onto it in what ever way you want. Your MyGame will contain all of the properties and methods that the parent class Game contains, along with your own content.
Important: In order for your MyGame to be used in place of the default engine Game manager, you MUST inherit from Game. If you do not inherit from Game then the engine will skip over your script, assuming that it's an object to be used within the game by another script at a later date.
If you're a .NET developer, you'll notice that this script does not reside within a namespace; that's because the engine automatically assigns a namespace to the class. The engine manages the scripts and assigns it to a default internal namespace that was choose for the scripts. If you attempt to place your class within a namespace manually, the compiling of the script will fail.

Next we have to build our Constructor which is always called every-time the script is instanced. It is here that we will modify the properties that the Game Type contains and allows us to make the game our own custom MUD.
public MyGame() : base()
{
    GameTitle = "My very own MUD!";

GameTitle is not the only property available within the Game Type that you can use, and I will break that down for you in a moment. The GameTitle sets the name of your MUD and will be displayed through-out your MUD game whenever the engine needs to display the title of the MUD.

Property breakdown

Below is a breakdown of all available properties that you can change within your constructor in order to make the game yours

Game Manager Setup
                  if (IsRunning)
                  {
                         DoSomething();
                   }
               

Game Information Settings
      foreach (Realm r in RealmCollection)
      {
          if (r.Name == "MyRealm")
          {
               DoSomething();
               break;
          }
      }
  

Methods

Putting it all together

You can write your MyGame script to look like this and have a customized game at your fingertips!
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;

     Realm myRealm = new Realm(this);

     World.AddRealm(myRealm);
 }
}


Just because we only showed how to modify the Game properties does not mean that you can't add your own! You can add your own properties and or methods to do what ever it is that you need done during the life of your game.

Note that creating Realms and other environments will be covered in a different document

That concludes this tutorial. Subscribe to it so that you can be informed of new additions to the property and method list as well as more information on building the Game class at a later date!