DataPaths now have values for the games Root directory and Script directory.
DataPath class is now completed and includes a new SetExtension() method for setting game object file extensions. Scripting support fully implemented. StandardGame now contains a Initialize() method for compiling scripts and searching for sub-classes of StandardGame Server app will now use a Scripted game class instead of the default StandardGame if one is present. StandardGame.Start() is now virtual so child classes can override it. Sample Game script created to show how to create a custom game script, including how to setup the game and create Rooms pragamatically. ScriptFactory has a new method for searching all scripts and scripts that inherit from a specified class. Renamed all of the Command scripts. They no longer start with 'Command'. Example: "CommandSay" has now become "Say". There is no need to preceed the command name with the word "Command" anymore.
This commit is contained in:
parent
c40d32e7ae
commit
8639403255
14 changed files with 323 additions and 69 deletions
56
MudEngine/WinPC_Engine/GameScripts/SampleGame.cs
Normal file
56
MudEngine/WinPC_Engine/GameScripts/SampleGame.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using MudEngine.Game;
|
||||
using MudEngine.DAL;
|
||||
using MudEngine.Game.Environment;
|
||||
using MudEngine.Game;
|
||||
|
||||
namespace MudEngine.GameScripts
|
||||
{
|
||||
public class SampleGame : StandardGame
|
||||
{
|
||||
public SampleGame(String name)
|
||||
: base(name)
|
||||
{
|
||||
this.Name = "Sample Mud Game";
|
||||
this.Debugging = true;
|
||||
this.Description = "A sample MUD game created using the Mud Designer engine.";
|
||||
this.Website = "http://muddesigner.codeplex.com";
|
||||
}
|
||||
|
||||
public override Boolean Start(Int32 maxPlayers, Int32 maxQueueSize)
|
||||
{
|
||||
this.Server.ServerOwner = "Admin";
|
||||
|
||||
//Quick demonstration on how to create the initial starting room for new players.
|
||||
this.World.CreateRealm("Azeroth", "Starting Realm for beginning players");
|
||||
Zone z = this.World.GetRealm("Azeroth").CreateZone("Bedlam", "Initial Zone for new players.");
|
||||
Room bedroom = z.CreateRoom("Bedroom", "This is your bedroom.");
|
||||
Room hallway = z.CreateRoom("Hallway", "This is the hallway.");
|
||||
|
||||
//Save if the result of the Linkage.
|
||||
Boolean linked = bedroom.LinkRooms(AvailableTravelDirections.West, hallway);
|
||||
|
||||
//Call our parent Start() method which will start the world and server
|
||||
//along with compile all of our commands and scripts.
|
||||
Boolean startOK = base.Start(maxPlayers, maxQueueSize);
|
||||
|
||||
//If the parent started ok and our rooms were linked together
|
||||
//Set the starting location as our new room
|
||||
if (startOK && linked)
|
||||
{
|
||||
this.World.StartLocation = bedroom;
|
||||
return true;
|
||||
}
|
||||
//Otherwise return false and prevent the game from running.
|
||||
else
|
||||
{
|
||||
this.Enabled = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue