- Rooms can now be linked automatically via the new Zone.LinkRooms method. Room linking can no longer be done manually as the Doorways property is now read-only. - Door.Description has been removed. Doorway description will need to be included in Room.Description or Room.DetailedDescription properties. - Added DetailedDescription to make creating multi-line descriptions easier. Not supported by the Look command yet. - Game.IsRunning is now read-only. The Game will manage this property on its own. - BaseCharacter.ExecuteCommand now will always return a string. Simplifying the game loop for users as they no longer need to check what Type was returned by the command. - Doors now contain a DepartureRoom and a ArrivalRoom property allowing for easy access to Rooms that are linked together. - Fixed a bug where Game, Realms and Zones always assigned IsInitial to Realms, Zones and Rooms when added to the collections. Collection would contain multiple IsInitial objects. - Removed Room.InstalledDoorways property as that was used only by the old Designer - Removed Room.Load() as that implementation of it is obsolete. MudGame: - Revised Zeroth to build it's Zone and Rooms using the new Zone.LinkRooms function. - Greatly revised Program.cs and the Game loop to take advantage of many of the automations provided by the Engine now.
91 lines
3 KiB
C#
91 lines
3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
|
|
using MUDGame.Environments;
|
|
using MudEngine.GameManagement;
|
|
using MudEngine.GameObjects;
|
|
using MudEngine.GameObjects.Characters;
|
|
using MudEngine.GameObjects.Environment;
|
|
using MudEngine.FileSystem;
|
|
|
|
namespace MUDGame
|
|
{
|
|
class Program
|
|
{
|
|
//Setup our Fields
|
|
static Game game;
|
|
static BaseCharacter player;
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
//Initialize them
|
|
game = new Game();
|
|
|
|
//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 = FileManager.GetDataPath(SaveDataTypes.Root);
|
|
game.TimeOfDay = Game.TimeOfDayOptions.Transition;
|
|
game.TimeOfDayTransition = 30;
|
|
game.Version = "0.1";
|
|
game.Website = "http://MudDesigner.Codeplex.com";
|
|
game.ServerType = ProtocolType.Tcp;
|
|
game.ServerPort = 555;
|
|
game.MaximumPlayers = 1000;
|
|
|
|
//Create the world
|
|
BuildRealms();
|
|
|
|
//Player must be instanced AFTER BuildRealms as it needs Game.InitialRealm.InitialZone.InitialRoom
|
|
//property so that it can set it's starting room correctly.
|
|
player = new BaseCharacter(game);
|
|
|
|
// Start the game & server.
|
|
game.Start();
|
|
|
|
if (!game.IsRunning)
|
|
Console.WriteLine("Error starting game!\nReview Log file for details.");
|
|
|
|
game.PlayerCollection.Add(player);
|
|
|
|
//Send game info to player
|
|
Console.WriteLine(game.GameTitle);
|
|
Console.WriteLine(game.Version);
|
|
Console.WriteLine(game.Website);
|
|
Console.WriteLine(game.Story);
|
|
Console.WriteLine();
|
|
|
|
//Simple Help info
|
|
Console.WriteLine("Available Commands are\n Look\n Exit\n Walk 'direction' where direction = north/south/east/west/up/down\n");
|
|
|
|
//Invoke the Look command so the player knows whats around him/her
|
|
Console.WriteLine(player.ExecuteCommand("Look"));
|
|
|
|
while (game.IsRunning)
|
|
{
|
|
Console.Write("Command: ");
|
|
Console.WriteLine(player.ExecuteCommand(Console.ReadLine()));
|
|
}
|
|
|
|
// - Exit command handles this now - game.Shutdown();
|
|
Console.WriteLine("Press Enter to exit.");
|
|
Console.ReadKey();
|
|
}
|
|
|
|
static private void BuildRealms()
|
|
{
|
|
Zeroth zeroth = new Zeroth(game);
|
|
zeroth.BuildZeroth();
|
|
}
|
|
}
|
|
}
|