diff --git a/MUDGame/Environments/Zeroth.cs b/MUDGame/Environments/Zeroth.cs
new file mode 100644
index 0000000..529d354
--- /dev/null
+++ b/MUDGame/Environments/Zeroth.cs
@@ -0,0 +1,71 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using MudEngine.GameManagement;
+using MudEngine.GameObjects.Environment;
+
+namespace MUDGame.Environments
+{
+ class Zeroth
+ {
+ internal Realm BuildZeroth()
+ {
+ Realm realm = new Realm();
+ realm.Name = "Zeroth";
+ realm.Description = "The land of " + realm.Name + " is fully of large forests and dangerous creatures.";
+ realm.IsInitialRealm = true;
+
+ //Build Zones
+ Zone zone = new Zone();
+ zone.Name = "Home";
+ zone.Description = "Your home is small and does not contain many items, but it's still your home and someplace you can relax after your battles.";
+ zone.IsSafe = true;
+ zone.StatDrain = false;
+ zone.IsStartingZone = true;
+
+ //Build Rooms.
+ BuildHome(zone, realm);
+
+ zone.Realm = realm.Name;
+ //TODO: Remove this, as Zones and Rooms contain .IsStarting properties now.
+ zone.EntranceRoom = "Bedroom";
+ realm.Zones.Add(zone);
+
+ return realm;
+ }
+
+ private void BuildHome(Zone zone, Realm realm)
+ {
+ Room bedroom = new Room();
+ bedroom.Name = "Bedroom";
+ bedroom.Description = "This is your bedroom, it's small but comfortable. You have a bed, a book shelf and a rug on the floor.";
+ bedroom.Zone = zone.Name;
+ bedroom.Realm = realm.Name;
+ bedroom.IsStartingRoom = true;
+
+ Room closet = new Room();
+ closet.Name = "Closet";
+ closet.Description = "Your closet contains clothing and some shoes.";
+ closet.Zone = zone.Name;
+ closet.Realm = realm.Name;
+
+ Door door = new Door();
+ door.TravelDirection = MudEngine.GameObjects.AvailableTravelDirections.West;
+ door.ConnectedRoom = "Closet";
+ door.Description = "To the West is your Closet.";
+ bedroom.Doorways.Add(door);
+
+ door = new Door();
+ door.TravelDirection = MudEngine.GameObjects.AvailableTravelDirections.East;
+ door.ConnectedRoom = "Bedroom";
+ door.Description = "To the East is your Bedroom.";
+ closet.Doorways.Add(door);
+
+ //Todo: Should work once MUDEngine supports Types
+ zone.Rooms.Add(bedroom);
+ zone.Rooms.Add(closet);
+ }
+ }
+}
diff --git a/MUDGame/MUDGame.csproj b/MUDGame/MUDGame.csproj
new file mode 100644
index 0000000..7790e3a
--- /dev/null
+++ b/MUDGame/MUDGame.csproj
@@ -0,0 +1,66 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {048E755C-DD05-47EC-930E-F45146B66F7C}
+ Exe
+ Properties
+ MUDGame
+ MUDGame
+ v3.5
+ 512
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+
+
+ {498943A8-DF5A-4DB0-B506-0BFF44788657}
+ MudEngine
+
+
+
+
+
\ No newline at end of file
diff --git a/MUDGame/Program.cs b/MUDGame/Program.cs
new file mode 100644
index 0000000..7f5210b
--- /dev/null
+++ b/MUDGame/Program.cs
@@ -0,0 +1,78 @@
+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 realmCollection;
+
+ static void Main(string[] args)
+ {
+ //Initialize them
+ game = new MudEngine.GameManagement.Game();
+ commands = new MudEngine.GameManagement.CommandEngine();
+ realmCollection = new List();
+
+ //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());
+ }
+ }
+}
diff --git a/MUDGame/Properties/AssemblyInfo.cs b/MUDGame/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..69f3f9a
--- /dev/null
+++ b/MUDGame/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MUDGame")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MUDGame")]
+[assembly: AssemblyCopyright("Copyright © 2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("f8209c47-d989-49af-8264-be5064784104")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MudDesigner.sln b/MudDesigner.sln
index f268b25..83d9490 100644
--- a/MudDesigner.sln
+++ b/MudDesigner.sln
@@ -1,24 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C# Express 2008
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mud Designer", "Mud Designer\Mud Designer.csproj", "{F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MudEngine", "MudEngine\MudEngine.csproj", "{498943A8-DF5A-4DB0-B506-0BFF44788657}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MUDGame", "MUDGame\MUDGame.csproj", "{048E755C-DD05-47EC-930E-F45146B66F7C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F0C50EA1-80F7-4CE6-93A3-A4E9F34F0434}.Release|Any CPU.Build.0 = Release|Any CPU
{498943A8-DF5A-4DB0-B506-0BFF44788657}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{498943A8-DF5A-4DB0-B506-0BFF44788657}.Debug|Any CPU.Build.0 = Debug|Any CPU
{498943A8-DF5A-4DB0-B506-0BFF44788657}.Release|Any CPU.ActiveCfg = Release|Any CPU
{498943A8-DF5A-4DB0-B506-0BFF44788657}.Release|Any CPU.Build.0 = Release|Any CPU
+ {048E755C-DD05-47EC-930E-F45146B66F7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {048E755C-DD05-47EC-930E-F45146B66F7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {048E755C-DD05-47EC-930E-F45146B66F7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {048E755C-DD05-47EC-930E-F45146B66F7C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/MudEngine/Commands/CommandExit.cs b/MudEngine/Commands/CommandExit.cs
new file mode 100644
index 0000000..6087056
--- /dev/null
+++ b/MudEngine/Commands/CommandExit.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using MudEngine.GameObjects.Characters;
+using MudEngine.GameManagement;
+using MudEngine.Commands;
+using MudEngine.GameObjects.Environment;
+
+namespace MudEngine.Commands
+{
+ public class CommandExit : IGameCommand
+ {
+ public bool Override { get; set; }
+ public string Name { get; set; }
+
+ public CommandResults Execute(string command, BaseCharacter player, Game game, Room room)
+ {
+ game.IsRunning = false;
+
+ return new CommandResults();
+ }
+ }
+}
diff --git a/MudEngine/Commands/CommandEngine.cs b/MudEngine/GameManagement/CommandEngine.cs
similarity index 88%
rename from MudEngine/Commands/CommandEngine.cs
rename to MudEngine/GameManagement/CommandEngine.cs
index 01613e9..1540eb5 100644
--- a/MudEngine/Commands/CommandEngine.cs
+++ b/MudEngine/GameManagement/CommandEngine.cs
@@ -10,7 +10,7 @@ using MudEngine.GameObjects.Characters;
using MudEngine.GameObjects.Environment;
using MudEngine.GameManagement;
-namespace MudEngine.Commands
+namespace MudEngine.GameManagement
{
public class CommandEngine
{
@@ -46,14 +46,14 @@ namespace MudEngine.Commands
///
///
///
- public static CommandResults ExecuteCommand(string Name, BaseCharacter player, GameSetup project, Room room, string command)
+ public static CommandResults ExecuteCommand(string command, BaseCharacter player, Game project, Room room)
{
- Name = Name.Insert(0, "Command");
+ string commandKey = command.Insert(0, "Command");
foreach (string key in Commands.Keys)
{
- if (Name.ToLower().Contains(key.ToLower()))
+ if (commandKey.ToLower().Contains(key.ToLower()))
{
- return Commands[key.ToLower()].Execute(player, project, room, command);
+ return Commands[key.ToLower()].Execute(command, player, project, room);
}
}
diff --git a/MudEngine/Commands/CommandResults.cs b/MudEngine/GameManagement/CommandResults.cs
similarity index 89%
rename from MudEngine/Commands/CommandResults.cs
rename to MudEngine/GameManagement/CommandResults.cs
index 737f28f..27548bf 100644
--- a/MudEngine/Commands/CommandResults.cs
+++ b/MudEngine/GameManagement/CommandResults.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
-namespace MudEngine.Commands
+namespace MudEngine.GameManagement
{
public class CommandResults
{
diff --git a/MudEngine/GameManagement/GameSetup.cs b/MudEngine/GameManagement/Game.cs
similarity index 77%
rename from MudEngine/GameManagement/GameSetup.cs
rename to MudEngine/GameManagement/Game.cs
index b780eac..4fcd2f6 100644
--- a/MudEngine/GameManagement/GameSetup.cs
+++ b/MudEngine/GameManagement/Game.cs
@@ -20,7 +20,7 @@ namespace MudEngine.GameManagement
///
[XmlInclude(typeof(StartingLocation))]
[XmlInclude(typeof(Currency))]
- public class GameSetup
+ public class Game
{
public enum TimeOfDayOptions
{
@@ -29,6 +29,13 @@ namespace MudEngine.GameManagement
Transition,
}
+ [Browsable(false)]
+ public bool IsRunning
+ {
+ get;
+ set;
+ }
+
[Category("Company Settings")]
[Description("The name of the Company or Author building the game.")]
///
@@ -61,6 +68,9 @@ namespace MudEngine.GameManagement
///
public bool HideRoomNames { get; set; }
+ ///
+ /// Gets or Sets what time of day the world is currently in.
+ ///
[Category("Day Management")]
[Description("Set what time of day the world will take place in.")]
public TimeOfDayOptions TimeOfDay
@@ -69,6 +79,9 @@ namespace MudEngine.GameManagement
set;
}
+ ///
+ /// Gets or Sets how long in minutes it takes to transition from day to night.
+ ///
[Category("Day Management")]
[Description("Set how long in minutes it takes to transition from day to night.")]
public int TimeOfDayTransition
@@ -77,6 +90,9 @@ namespace MudEngine.GameManagement
set;
}
+ ///
+ /// Gets or Sets how long in minutes a day lasts in the game world.
+ ///
[Category("Day Management")]
[Description("Sets how long in minutes a day lasts in the game world.")]
public int DayLength
@@ -85,6 +101,9 @@ namespace MudEngine.GameManagement
set;
}
+ ///
+ /// Gets or Sets the current working version of the game.
+ ///
[Category("Project Settings")]
[Description("The current working version of the game.")]
public string Version { get; set; }
@@ -99,9 +118,11 @@ namespace MudEngine.GameManagement
[DefaultValue("Copper")]
public string BaseCurrencyName { get; set; }
-
-
//TODO: Add Party support.
+
+ ///
+ /// Gets or Sets if all objects will be laoded during server startup. Enabling this results in a slower server start time, but faster object access.
+ ///
[Category("Project Settings")]
[Description("If enabled, all objects will be loaded during server startup resulting in a slower server start time, but faster load time during gameplay")]
public bool PreCacheObjects { get; set; }
@@ -109,12 +130,19 @@ namespace MudEngine.GameManagement
[Browsable(false)]
public List CurrencyList { get; set; }
+ ///
+ /// Gets or Sets the path to the current project
+ ///
[Browsable(false)]
public string ProjectPath { get; set; }
[Category("Environment Settings")]
[ReadOnly(true)]
- public StartingLocation InitialLocation { get; set; }
+ public Realm InitialRealm
+ {
+ get;
+ private set;
+ }
[Browsable(false)]
public string Story
@@ -133,14 +161,13 @@ namespace MudEngine.GameManagement
}
private string _Filename;
- public GameSetup()
+ public Game()
{
CurrencyList = new List();
GameTitle = "New Game";
_Filename = "Game.xml";
BaseCurrencyAmount = 1;
BaseCurrencyName = "Copper";
- InitialLocation = new StartingLocation();
}
public void Save(string filename)
@@ -160,8 +187,13 @@ namespace MudEngine.GameManagement
{
return null;
}
-
+
return FileManager.Load(fileName, this);
}
+
+ public void SetInitialRealm(Realm realm)
+ {
+ InitialRealm = realm;
+ }
}
}
diff --git a/MudEngine/Commands/ICommand.cs b/MudEngine/GameManagement/ICommand.cs
similarity index 76%
rename from MudEngine/Commands/ICommand.cs
rename to MudEngine/GameManagement/ICommand.cs
index c834e22..c27f88f 100644
--- a/MudEngine/Commands/ICommand.cs
+++ b/MudEngine/GameManagement/ICommand.cs
@@ -10,7 +10,7 @@ using MudEngine.GameObjects.Characters;
using MudEngine.GameManagement;
using MudEngine.GameObjects.Environment;
-namespace MudEngine.Commands
+namespace MudEngine.GameManagement
{
public interface IGameCommand
{
@@ -19,6 +19,6 @@ namespace MudEngine.Commands
//Used to override commands with the same name
bool Override { get; set; }
//Executes the command.
- CommandResults Execute(BaseCharacter player, GameSetup project, Room room, string command);
+ CommandResults Execute(string command, BaseCharacter player, Game project, Room room);
}
}
diff --git a/MudEngine/GameObjects/Environment/Realm.cs b/MudEngine/GameObjects/Environment/Realm.cs
index a66caeb..de77473 100644
--- a/MudEngine/GameObjects/Environment/Realm.cs
+++ b/MudEngine/GameObjects/Environment/Realm.cs
@@ -18,11 +18,13 @@ namespace MudEngine.GameObjects.Environment
[Category("Environment Information")]
[Description("A collection of Zones that are contained within this Realm. Players can traverse the world be traveling through Rooms that are contained within Zones. Note that it is not required to place a Zone into a Realm.")]
//[EditorAttribute(typeof(UIRealmEditor), typeof(System.Drawing.Design.UITypeEditor))]
- public List Zones { get; set; }
+ public List Zones { get; set; }
+
+ public bool IsInitialRealm { get; set; }
public Realm()
{
- Zones = new List();
+ Zones = new List();
}
///
@@ -34,12 +36,12 @@ namespace MudEngine.GameObjects.Environment
{
var filterQuery =
from zone in Zones
- where zone == filename
+ where zone.Filename == filename
select zone;
Zone z = new Zone();
foreach (var zone in filterQuery)
- return (Zone)z.Load(zone);
+ return (Zone)z.Load(zone.Filename);
return null;
}
diff --git a/MudEngine/GameObjects/Environment/Room.cs b/MudEngine/GameObjects/Environment/Room.cs
index 609e8f2..5a1c84b 100644
--- a/MudEngine/GameObjects/Environment/Room.cs
+++ b/MudEngine/GameObjects/Environment/Room.cs
@@ -98,6 +98,17 @@ namespace MudEngine.GameObjects.Environment
}
}
+ ///
+ /// Gets or Sets if this is the starting room for the Zone that contains it.
+ ///
+ [Browsable(true)]
+ [Description("Sets if this is the starting room for the Zone that contains it.")]
+ public bool IsStartingRoom
+ {
+ get;
+ set;
+ }
+
public Room()
{
Doorways = new List();
diff --git a/MudEngine/GameObjects/Environment/Zone.cs b/MudEngine/GameObjects/Environment/Zone.cs
index abe7b47..c630d1a 100644
--- a/MudEngine/GameObjects/Environment/Zone.cs
+++ b/MudEngine/GameObjects/Environment/Zone.cs
@@ -52,17 +52,29 @@ namespace MudEngine.GameObjects.Environment
set;
}
+ ///
+ /// Gets or Sets the ability for this Zone to be the initial starting Zone for the game.
+ ///
+ [Category("Environment Information")]
+ [Description("Sets that this Zone is a starting Zone for the game.")]
+ [DefaultValue(false)]
+ public bool IsStartingZone
+ {
+ get;
+ set;
+ }
+
[Category("Environment Information")]
//[EditorAttribute(typeof(UIRoomEditor), typeof(UITypeEditor))]
[Description("Collection of Rooms that have been created. Editing the Rooms Collection lets you manage the Zones rooms.")]
- public List Rooms { get; set; }
+ public List Rooms { get; set; }
[Category("Environment Information")]
public string EntranceRoom { get; set; }
public Zone()
{
- Rooms = new List();
+ Rooms = new List();
IsSafe = false;
Realm = "No Realm Associated.";
}
@@ -76,13 +88,13 @@ namespace MudEngine.GameObjects.Environment
{
var filterQuery =
from room in Rooms
- where room == name
+ where room.Name == name
select room;
- foreach (string room in filterQuery)
+ foreach (Room room in filterQuery)
{
Room r = new Room();
- return (Room)r.Load(room, this.Name);
+ return (Room)r.Load(room.Name, this.Name);
}
return null;
}
@@ -94,7 +106,7 @@ namespace MudEngine.GameObjects.Environment
///
public void RebuildRoomCollection()
{
- Rooms = new List();
+ Rooms = new List();
//Create our collection of Rooms.
string realmPath = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Realms), this.Realm);
string zonePath = Path.Combine(realmPath, this.Name);
@@ -114,7 +126,7 @@ namespace MudEngine.GameObjects.Environment
Room r = new Room();
r = (Room)r.Load(Path.GetFileNameWithoutExtension(file));
//r = (Room)FileManager.Load(file, r);
- this.Rooms.Add(r.Name);
+ this.Rooms.Add(r);
}
//Save the re-built Room collection
diff --git a/MudEngine/MudEngine.csproj b/MudEngine/MudEngine.csproj
index 784b64c..7eb79e0 100644
--- a/MudEngine/MudEngine.csproj
+++ b/MudEngine/MudEngine.csproj
@@ -45,13 +45,14 @@
-
-
-
+
+
+
+
-
+
diff --git a/MudEngine/Scripting/GameObject.cs b/MudEngine/Scripting/GameObject.cs
index 0f6e704..51fbfdb 100644
--- a/MudEngine/Scripting/GameObject.cs
+++ b/MudEngine/Scripting/GameObject.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
-using BlitScript;
+using MudEngine.Scripting;
namespace MudEngine.Scripting
{
@@ -47,12 +47,12 @@ namespace MudEngine.Scripting
}
}
}
-
+ /* Dynamic Type Instancing isn't supported in .NET 3.5
public dynamic SetProperty()
{
return Instance;
}
-
+ */
public object GetProperty(string propertyName)
{
string[] tokens = propertyName.Split('.');
diff --git a/MudEngine/Scripting/ScriptEngine.cs b/MudEngine/Scripting/ScriptEngine.cs
index 6453cf8..bc04621 100644
--- a/MudEngine/Scripting/ScriptEngine.cs
+++ b/MudEngine/Scripting/ScriptEngine.cs
@@ -130,7 +130,7 @@ namespace MudEngine.Scripting
/// Initializes the script engine, loading the compiled scripts into memory
///
///
- public override void Initialize()
+ public void Initialize()
{
if (_ScriptTypes == ScriptTypes.Assembly)
{