- Removed from solution Mud Engine: - Moved the CommandEngine, CommandResults and ICommand Interface out from the Commands namespace and into GameManagement since they manage the game commands. - Added CommandExit class to provide the ability to exit a game once running. This is fully implemented. - Realms, Zones and Rooms now have an IsInitial property for determining if this is an initial location for the Game. - Renamed GameSetup to Game. - Corrected GameObject being in the incorrect namespace. - Corrected the ScriptEngine not - CommandEngine no longer needs a Name argument. Arguments changed from 5 to 4 due to this change. Mud Game: - Added Example Game used for testing various MUDEngine features and testing constructability of games using the engine. - Currently only contains 1 Realm, 1 Zone and Two Rooms. Only working command is Exit.
78 lines
2.6 KiB
C#
78 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using MUDGame.Environments;
|
|
|
|
namespace MUDGame
|
|
{
|
|
class Program
|
|
{
|
|
//Setup our Fields
|
|
static MudEngine.GameManagement.Game game;
|
|
static MudEngine.GameManagement.CommandEngine commands;
|
|
static MudEngine.GameObjects.Characters.Controlled.PlayerBasic player;
|
|
|
|
static List<MudEngine.GameObjects.Environment.Realm> realmCollection;
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
//Initialize them
|
|
game = new MudEngine.GameManagement.Game();
|
|
commands = new MudEngine.GameManagement.CommandEngine();
|
|
realmCollection = new List<MudEngine.GameObjects.Environment.Realm>();
|
|
|
|
//Setup the game
|
|
game.AutoSave = true;
|
|
game.BaseCurrencyName = "Copper";
|
|
game.BaseCurrencyAmount = 1;
|
|
game.CompanyName = "Mud Designer";
|
|
game.DayLength = 60 * 8;
|
|
game.GameTitle = "Test Mud Project";
|
|
game.HideRoomNames = false;
|
|
game.PreCacheObjects = true;
|
|
game.ProjectPath = MudEngine.FileSystem.FileManager.GetDataPath(MudEngine.FileSystem.SaveDataTypes.Root);
|
|
game.TimeOfDay = MudEngine.GameManagement.Game.TimeOfDayOptions.Transition;
|
|
game.TimeOfDayTransition = 30;
|
|
game.Version = "0.1";
|
|
game.Website = "http://MudDesigner.Codeplex.com";
|
|
|
|
//Create the world
|
|
BuildRealms();
|
|
|
|
//Setup our starting location
|
|
foreach (MudEngine.GameObjects.Environment.Realm realm in realmCollection)
|
|
{
|
|
if (realm.IsInitialRealm)
|
|
{
|
|
game.SetInitialRealm(realm);
|
|
break;
|
|
}
|
|
}
|
|
if (game.InitialRealm == null)
|
|
Console.WriteLine("Critical Error: No Initial Realm defined!");
|
|
|
|
//Start the game.
|
|
MudEngine.GameManagement.CommandEngine.LoadAllCommands();
|
|
game.IsRunning = true;
|
|
|
|
while (game.IsRunning)
|
|
{
|
|
Console.Write("Command: ");
|
|
string command = Console.ReadLine();
|
|
|
|
MudEngine.GameManagement.CommandEngine.ExecuteCommand(command, player, game, null);
|
|
}
|
|
|
|
Console.WriteLine("Press Enter to exit.");
|
|
Console.ReadKey();
|
|
}
|
|
|
|
static private void BuildRealms()
|
|
{
|
|
Zeroth zeroth = new Zeroth();
|
|
realmCollection.Add(zeroth.BuildZeroth());
|
|
}
|
|
}
|
|
}
|