MudEngine:
- All Objects now dynamically create their Filenames after the BaseObject.Name has been set. You can re-specify a custom filename, but do so after setting BaseObject.Name's value. - Added GameWorld.cs. This will manage the game world itself. - Moved Realm Initialization from Game.Start() into GameWorld.Start() - Moved Environment saving from Game.Save() to GameWorld.Save(). However, GameWorld.Save gets invoked from Game.Save() - GameWorld is now responsible for adding Realms to the Game. - Fixed ScriptEngine not using Both Scripts and Assemblies at the same time. - Added BaseAI which inherits from baseCharacter. All AI objects will inherit from this object. MudGame: - Modified MyGame.cs script for demonstrating the new way to create environments with the implementation of GameWorld. - Updated Program.cs to compile both Scripts and Assemblies at once.
This commit is contained in:
parent
7a4c9211d4
commit
717034f9ed
9 changed files with 259 additions and 153 deletions
|
@ -109,14 +109,9 @@ namespace MudEngine.GameManagement
|
||||||
public Realm InitialRealm
|
public Realm InitialRealm
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
private set;
|
internal set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the collection of Realms currently stored in the Game.
|
|
||||||
/// </summary>
|
|
||||||
public List<Realm> RealmCollection { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Story that is displayed on initial player entry into the game
|
/// The Story that is displayed on initial player entry into the game
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -153,6 +148,8 @@ namespace MudEngine.GameManagement
|
||||||
public string BaseCurrencyName { get; set; }
|
public string BaseCurrencyName { get; set; }
|
||||||
|
|
||||||
public GameTime WorldTime { get; set; }
|
public GameTime WorldTime { get; set; }
|
||||||
|
|
||||||
|
public GameWorld World { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Networking
|
#region Networking
|
||||||
|
@ -190,8 +187,7 @@ namespace MudEngine.GameManagement
|
||||||
//Instance all of the Games Objects.
|
//Instance all of the Games Objects.
|
||||||
CurrencyList = new List<Currency>();
|
CurrencyList = new List<Currency>();
|
||||||
scriptEngine = new Scripting.ScriptEngine(this);
|
scriptEngine = new Scripting.ScriptEngine(this);
|
||||||
RealmCollection = new List<Realm>();
|
World = new GameWorld(this);
|
||||||
WorldObjects = new List<BaseObject>();
|
|
||||||
WorldTime = new GameTime(this);
|
WorldTime = new GameTime(this);
|
||||||
|
|
||||||
//Prepare the Save Paths for all of our Game objects.
|
//Prepare the Save Paths for all of our Game objects.
|
||||||
|
@ -266,27 +262,7 @@ namespace MudEngine.GameManagement
|
||||||
Log.Write("Command Loaded: " + command);
|
Log.Write("Command Loaded: " + command);
|
||||||
}
|
}
|
||||||
|
|
||||||
//See if we have an Initial Realm set
|
World.Start();
|
||||||
//TODO: Check for saved Realm files and load
|
|
||||||
Log.Write("Initializing World...");
|
|
||||||
foreach (Realm r in RealmCollection)
|
|
||||||
{
|
|
||||||
if (r.IsInitialRealm)
|
|
||||||
{
|
|
||||||
InitialRealm = r;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check if any the initial room exists or not.
|
|
||||||
if ((InitialRealm == null) || (InitialRealm.InitialZone == null) || (InitialRealm.InitialZone.InitialRoom == null))
|
|
||||||
{
|
|
||||||
Log.Write("ERROR: No initial location defined. Game startup failed!");
|
|
||||||
Log.Write("Players will start in the Abyss. Each player will contain their own instance of this room.");
|
|
||||||
//return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Log.Write("Initial Location loaded-> " + InitialRealm.Name + "." + InitialRealm.InitialZone.Name + "." + InitialRealm.InitialZone.InitialRoom.Name);
|
|
||||||
|
|
||||||
//Start the Telnet server
|
//Start the Telnet server
|
||||||
if (IsMultiplayer)
|
if (IsMultiplayer)
|
||||||
|
@ -384,116 +360,14 @@ namespace MudEngine.GameManagement
|
||||||
//Re-create the environment directory
|
//Re-create the environment directory
|
||||||
Directory.CreateDirectory(DataPaths.Environment);
|
Directory.CreateDirectory(DataPaths.Environment);
|
||||||
|
|
||||||
//Loop through each Realm and save it.
|
//Save the Game World.
|
||||||
for (int x = 0; x <= RealmCollection.Count - 1; x++)
|
World.Save();
|
||||||
{
|
|
||||||
string realmFile = Path.Combine(DataPaths.Environment, RealmCollection[x].Filename);
|
|
||||||
|
|
||||||
//Save the Realm
|
|
||||||
RealmCollection[x].Save(realmFile);
|
|
||||||
|
|
||||||
//Loop through each Zone in the Realm and save it.
|
|
||||||
for (int y = 0; y <= RealmCollection[x].ZoneCollection.Count - 1; y++)
|
|
||||||
{
|
|
||||||
string zonePath = Path.Combine(DataPaths.Environment, Path.GetFileNameWithoutExtension(RealmCollection[x].Filename), Path.GetFileNameWithoutExtension(RealmCollection[x].ZoneCollection[y].Filename));
|
|
||||||
|
|
||||||
if (!Directory.Exists(zonePath))
|
|
||||||
Directory.CreateDirectory(zonePath);
|
|
||||||
|
|
||||||
//Save the Zone.
|
|
||||||
RealmCollection[x].ZoneCollection[y].Save(Path.Combine(zonePath, RealmCollection[x].ZoneCollection[y].Filename));
|
|
||||||
|
|
||||||
for (int z = 0; z <= RealmCollection[x].ZoneCollection[y].RoomCollection.Count - 1; z++)
|
|
||||||
{
|
|
||||||
if (!Directory.Exists(Path.Combine(zonePath, "Rooms")))
|
|
||||||
Directory.CreateDirectory(Path.Combine(zonePath, "Rooms"));
|
|
||||||
|
|
||||||
string roomPath = Path.Combine(zonePath, "Rooms");
|
|
||||||
|
|
||||||
RealmCollection[x].ZoneCollection[y].RoomCollection[z].Save(Path.Combine(roomPath, RealmCollection[x].ZoneCollection[y].RoomCollection[z].Filename));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Load()
|
public virtual void Load()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a Realm to the Games current list of Realms.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="realm"></param>
|
|
||||||
public void AddRealm(Realm realm)
|
|
||||||
{
|
|
||||||
//If this Realm is set as Initial then we need to disable any previously
|
|
||||||
//set Realms to avoid conflict.
|
|
||||||
if (realm.IsInitialRealm)
|
|
||||||
{
|
|
||||||
foreach (Realm r in RealmCollection)
|
|
||||||
{
|
|
||||||
if (r.IsInitialRealm)
|
|
||||||
{
|
|
||||||
r.IsInitialRealm = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set this Realm as the Games initial Realm
|
|
||||||
if (realm.IsInitialRealm)
|
|
||||||
InitialRealm = realm;
|
|
||||||
|
|
||||||
//TODO: Check for duplicate Realms.
|
|
||||||
RealmCollection.Add(realm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddObject(BaseObject obj)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void RemoveObject(BaseObject obj)
|
|
||||||
{
|
|
||||||
foreach (BaseObject o in WorldObjects)
|
|
||||||
{
|
|
||||||
if (o == obj)
|
|
||||||
{
|
|
||||||
WorldObjects.Remove(o);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a Realm currently stored in the Games collection of Realms.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="realmName"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<Realm> GetRealmByName(string realmName)
|
|
||||||
{
|
|
||||||
List<Realm> realms = new List<Realm>();
|
|
||||||
|
|
||||||
foreach (Realm realm in RealmCollection)
|
|
||||||
{
|
|
||||||
if (realm.Name == realmName)
|
|
||||||
realms.Add(realm);
|
|
||||||
}
|
|
||||||
|
|
||||||
return realms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Realm GetRealmByID(Int32 id)
|
|
||||||
{
|
|
||||||
foreach (Realm r in RealmCollection)
|
|
||||||
{
|
|
||||||
if (r.ID == id)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Starts the Server.
|
/// Starts the Server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
204
MudEngine/GameManagement/GameWorld.cs
Normal file
204
MudEngine/GameManagement/GameWorld.cs
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
//Microsoft .NET Framework
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
//MudEngine
|
||||||
|
using MudEngine.FileSystem;
|
||||||
|
using MudEngine.GameManagement;
|
||||||
|
using MudEngine.GameObjects;
|
||||||
|
using MudEngine.GameObjects.Characters;
|
||||||
|
using MudEngine.GameObjects.Environment;
|
||||||
|
using MudEngine.GameObjects.Items;
|
||||||
|
using MudEngine.Scripting;
|
||||||
|
|
||||||
|
namespace MudEngine.GameManagement
|
||||||
|
{
|
||||||
|
public enum ObjectTypes
|
||||||
|
{
|
||||||
|
Realm,
|
||||||
|
Zone,
|
||||||
|
Room,
|
||||||
|
Character,
|
||||||
|
Item,
|
||||||
|
Standard,
|
||||||
|
//Any
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GameWorld
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of Objects that do not belong to any other Type of categories.
|
||||||
|
/// </summary>
|
||||||
|
public List<BaseObject> Objects { get; private set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of Items that are available in the game world.
|
||||||
|
/// </summary>
|
||||||
|
public List<BaseItem> Items { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of Characters (NPC/Monster) that are available in the Game world
|
||||||
|
/// </summary>
|
||||||
|
//TODO: This should be BaseAI
|
||||||
|
public List<BaseCharacter> Characters { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the collection of Realms currently available in the game world
|
||||||
|
/// </summary>
|
||||||
|
public List<Realm> Realms { get; private set; }
|
||||||
|
|
||||||
|
private Game _Game;
|
||||||
|
|
||||||
|
public GameWorld(Game game)
|
||||||
|
{
|
||||||
|
_Game = game;
|
||||||
|
|
||||||
|
Objects = new List<BaseObject>();
|
||||||
|
Items = new List<BaseItem>();
|
||||||
|
Characters = new List<BaseCharacter>();
|
||||||
|
Realms = new List<Realm>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
//See if we have an Initial Realm set
|
||||||
|
//TODO: Check for saved Realm files and load
|
||||||
|
Log.Write("Initializing World...");
|
||||||
|
foreach (Realm r in Realms)
|
||||||
|
{
|
||||||
|
if (r.IsInitialRealm)
|
||||||
|
{
|
||||||
|
_Game.InitialRealm = r;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check if any the initial room exists or not.
|
||||||
|
if ((_Game.InitialRealm == null) || (_Game.InitialRealm.InitialZone == null) || (_Game.InitialRealm.InitialZone.InitialRoom == null))
|
||||||
|
{
|
||||||
|
Log.Write("ERROR: No initial location defined. Game startup failed!");
|
||||||
|
Log.Write("Players will start in the Abyss. Each player will contain their own instance of this room.");
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Log.Write("Initial Location loaded-> " + _Game.InitialRealm.Name + "." + _Game.InitialRealm.InitialZone.Name + "." + _Game.InitialRealm.InitialZone.InitialRoom.Name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
//Save all of the Environments
|
||||||
|
for (int x = 0; x <= Realms.Count - 1; x++)
|
||||||
|
{
|
||||||
|
string realmFile = Path.Combine(_Game.DataPaths.Environment, Realms[x].Filename);
|
||||||
|
|
||||||
|
//Save the Realm
|
||||||
|
Realms[x].Save(realmFile);
|
||||||
|
|
||||||
|
//Loop through each Zone in the Realm and save it.
|
||||||
|
for (int y = 0; y <= Realms[x].ZoneCollection.Count - 1; y++)
|
||||||
|
{
|
||||||
|
string zonePath = Path.Combine(_Game.DataPaths.Environment, Path.GetFileNameWithoutExtension(Realms[x].Filename), Path.GetFileNameWithoutExtension(Realms[x].ZoneCollection[y].Filename));
|
||||||
|
|
||||||
|
if (!Directory.Exists(zonePath))
|
||||||
|
Directory.CreateDirectory(zonePath);
|
||||||
|
|
||||||
|
//Save the Zone.
|
||||||
|
Realms[x].ZoneCollection[y].Save(Path.Combine(zonePath, Realms[x].ZoneCollection[y].Filename));
|
||||||
|
|
||||||
|
for (int z = 0; z <= Realms[x].ZoneCollection[y].RoomCollection.Count - 1; z++)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(Path.Combine(zonePath, "Rooms")))
|
||||||
|
Directory.CreateDirectory(Path.Combine(zonePath, "Rooms"));
|
||||||
|
|
||||||
|
string roomPath = Path.Combine(zonePath, "Rooms");
|
||||||
|
|
||||||
|
Realms[x].ZoneCollection[y].RoomCollection[z].Save(Path.Combine(roomPath, Realms[x].ZoneCollection[y].RoomCollection[z].Filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} //Complete Environment saving.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a Realm to the Games current list of Realms.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="realm"></param>
|
||||||
|
public void AddRealm(Realm realm)
|
||||||
|
{
|
||||||
|
//If this Realm is set as Initial then we need to disable any previously
|
||||||
|
//set Realms to avoid conflict.
|
||||||
|
if (realm.IsInitialRealm)
|
||||||
|
{
|
||||||
|
foreach (Realm r in Realms)
|
||||||
|
{
|
||||||
|
if (r.IsInitialRealm)
|
||||||
|
{
|
||||||
|
r.IsInitialRealm = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set this Realm as the Games initial Realm
|
||||||
|
if (realm.IsInitialRealm)
|
||||||
|
_Game.InitialRealm = realm;
|
||||||
|
|
||||||
|
//TODO: Check for duplicate Realms.
|
||||||
|
Realms.Add(realm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returs a reference to an object that matches the supplied Type and filename.
|
||||||
|
/// Object MUST inherit from BaseObject or one of its child classes in order to be found.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="objectType">Determins the Type of object to perform the search for. Using Standard will search for objects that inherit from BaseObject, but none of BaseObjects child Types.</param>
|
||||||
|
/// <param name="filename"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public BaseObject GetObject(ObjectTypes objectType, string filename)
|
||||||
|
{
|
||||||
|
BaseObject obj = new BaseObject(_Game);
|
||||||
|
|
||||||
|
switch (objectType)
|
||||||
|
{
|
||||||
|
case ObjectTypes.Standard:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ObjectTypes.Character:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ObjectTypes.Item:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ObjectTypes.Realm:
|
||||||
|
obj = GetRealm(filename);
|
||||||
|
break;
|
||||||
|
case ObjectTypes.Zone:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case ObjectTypes.Room:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a reference to the Realm contained within the Realms collection if it exists.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filename"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private Realm GetRealm(string filename)
|
||||||
|
{
|
||||||
|
foreach (Realm r in Realms)
|
||||||
|
{
|
||||||
|
if (r.Filename == filename)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,22 @@ namespace MudEngine.GameObjects
|
||||||
[Description("The Display Name assigned to this object.")]
|
[Description("The Display Name assigned to this object.")]
|
||||||
//Required to refresh Filename property in the editors propertygrid
|
//Required to refresh Filename property in the editors propertygrid
|
||||||
[RefreshProperties(RefreshProperties.All)]
|
[RefreshProperties(RefreshProperties.All)]
|
||||||
public string Name { get; set; }
|
public string Name
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Name;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_Name = value;
|
||||||
|
if (this.GetType().Name.StartsWith("Base"))
|
||||||
|
Filename = value + "." + this.GetType().Name.Substring("Base".Length);
|
||||||
|
else
|
||||||
|
Filename = value + "." + this.GetType().Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string _Name;
|
||||||
|
|
||||||
public Int32 ID { get; internal set; }
|
public Int32 ID { get; internal set; }
|
||||||
|
|
||||||
|
@ -82,14 +97,14 @@ namespace MudEngine.GameObjects
|
||||||
//but different Identifiers. Letting there be multiple versions
|
//but different Identifiers. Letting there be multiple versions
|
||||||
//of the same object.
|
//of the same object.
|
||||||
|
|
||||||
ActiveGame.AddObject(this);
|
//ActiveGame.World.AddObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
~BaseObject()
|
~BaseObject()
|
||||||
{
|
{
|
||||||
//We must free up this ID so that it can be used by other objects being instanced.
|
//We must free up this ID so that it can be used by other objects being instanced.
|
||||||
ActiveGame.RemoveObject(this);
|
//ActiveGame.World.RemoveObject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldSerializeName()
|
private bool ShouldSerializeName()
|
||||||
|
|
16
MudEngine/GameObjects/Characters/BaseAI.cs
Normal file
16
MudEngine/GameObjects/Characters/BaseAI.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
using MudEngine.GameManagement;
|
||||||
|
|
||||||
|
namespace MudEngine.GameObjects.Characters
|
||||||
|
{
|
||||||
|
public class BaseAI : BaseCharacter
|
||||||
|
{
|
||||||
|
public BaseAI(Game game) : base(game)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -89,7 +89,7 @@ namespace MudEngine.GameObjects.Characters
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restore the users current Room.
|
//Restore the users current Room.
|
||||||
Realm realm = ActiveGame.GetRealmByID(Convert.ToInt32(FileManager.GetData(filename, "CurrentRealm")));
|
Realm realm = (Realm)ActiveGame.World.GetObject(ObjectTypes.Realm, FileManager.GetData(filename, "CurrentRealm"));
|
||||||
|
|
||||||
if (realm == null)
|
if (realm == null)
|
||||||
{
|
{
|
||||||
|
@ -125,9 +125,9 @@ namespace MudEngine.GameObjects.Characters
|
||||||
|
|
||||||
FileManager.WriteLine(filename, this.IsControlled.ToString(), "IsControlled");
|
FileManager.WriteLine(filename, this.IsControlled.ToString(), "IsControlled");
|
||||||
FileManager.WriteLine(filename, this.Role.ToString(), "Role");
|
FileManager.WriteLine(filename, this.Role.ToString(), "Role");
|
||||||
FileManager.WriteLine(filename, this.CurrentRoom.ID.ToString(), "CurrentRoom");
|
FileManager.WriteLine(filename, this.CurrentRoom.Name, "CurrentRoom");
|
||||||
FileManager.WriteLine(filename, this.CurrentRoom.ID.ToString(), "CurrentZone");
|
FileManager.WriteLine(filename, this.CurrentRoom.Zone, "CurrentZone");
|
||||||
FileManager.WriteLine(filename, this.CurrentRoom.ID.ToString(), "CurrentRealm");
|
FileManager.WriteLine(filename, this.CurrentRoom.Realm, "CurrentRealm");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
<Compile Include="GameManagement\CommandEngine.cs" />
|
<Compile Include="GameManagement\CommandEngine.cs" />
|
||||||
<Compile Include="GameManagement\CommandResults.cs" />
|
<Compile Include="GameManagement\CommandResults.cs" />
|
||||||
<Compile Include="GameManagement\GameTime.cs" />
|
<Compile Include="GameManagement\GameTime.cs" />
|
||||||
|
<Compile Include="GameManagement\GameWorld.cs" />
|
||||||
<Compile Include="GameManagement\ICommand.cs" />
|
<Compile Include="GameManagement\ICommand.cs" />
|
||||||
<Compile Include="FileSystem\FileManager.cs" />
|
<Compile Include="FileSystem\FileManager.cs" />
|
||||||
<Compile Include="FileSystem\SaveDataTypes.cs" />
|
<Compile Include="FileSystem\SaveDataTypes.cs" />
|
||||||
|
@ -71,6 +72,7 @@
|
||||||
<Compile Include="GameManagement\SecurityRoles.cs" />
|
<Compile Include="GameManagement\SecurityRoles.cs" />
|
||||||
<Compile Include="GameObjects\Bag.cs" />
|
<Compile Include="GameObjects\Bag.cs" />
|
||||||
<Compile Include="GameObjects\BaseObject.cs" />
|
<Compile Include="GameObjects\BaseObject.cs" />
|
||||||
|
<Compile Include="GameObjects\Characters\BaseAI.cs" />
|
||||||
<Compile Include="GameObjects\Characters\BaseCharacter.cs" />
|
<Compile Include="GameObjects\Characters\BaseCharacter.cs" />
|
||||||
<Compile Include="GameObjects\Environment\Door.cs" />
|
<Compile Include="GameObjects\Environment\Door.cs" />
|
||||||
<Compile Include="GameObjects\Environment\Realm.cs" />
|
<Compile Include="GameObjects\Environment\Realm.cs" />
|
||||||
|
|
|
@ -114,6 +114,7 @@ namespace MudEngine.Scripting
|
||||||
InstallPath = Environment.CurrentDirectory;
|
InstallPath = Environment.CurrentDirectory;
|
||||||
GameObjects = new List<GameObject>();
|
GameObjects = new List<GameObject>();
|
||||||
_AssemblyCollection = new List<Assembly>();
|
_AssemblyCollection = new List<Assembly>();
|
||||||
|
ScriptType = scriptTypes;
|
||||||
|
|
||||||
_Game = game;
|
_Game = game;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,13 +56,13 @@ namespace MudGame
|
||||||
Log.Write("Setting up the Default Engine Game Manager...");
|
Log.Write("Setting up the Default Engine Game Manager...");
|
||||||
game = new Game();
|
game = new Game();
|
||||||
obj = new GameObject(game, "Game");
|
obj = new GameObject(game, "Game");
|
||||||
scriptEngine = new ScriptEngine((Game)obj.Instance, ScriptEngine.ScriptTypes.Assembly);
|
scriptEngine = new ScriptEngine((Game)obj.Instance, ScriptEngine.ScriptTypes.Both);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Write("Setting up " + obj.GetProperty().GameTitle + " Manager...");
|
Log.Write("Setting up " + obj.GetProperty().GameTitle + " Manager...");
|
||||||
game = (Game)obj.Instance;
|
game = (Game)obj.Instance;
|
||||||
scriptEngine = new ScriptEngine(game, ScriptEngine.ScriptTypes.Assembly);
|
scriptEngine = new ScriptEngine(game, ScriptEngine.ScriptTypes.Both);
|
||||||
}
|
}
|
||||||
//Force TCP
|
//Force TCP
|
||||||
game.ServerType = ProtocolType.Tcp;
|
game.ServerType = ProtocolType.Tcp;
|
||||||
|
|
|
@ -16,35 +16,29 @@ public class MyGame : Game
|
||||||
myRealm.Name = "California";
|
myRealm.Name = "California";
|
||||||
myRealm.Description = "The Beaches of California are relaxing and fun to be at.";
|
myRealm.Description = "The Beaches of California are relaxing and fun to be at.";
|
||||||
myRealm.IsInitialRealm = true;
|
myRealm.IsInitialRealm = true;
|
||||||
|
World.AddRealm(myRealm);
|
||||||
//Add the Realm to the Games RealmCollection
|
|
||||||
AddRealm(myRealm);
|
|
||||||
|
|
||||||
Zone myZone = new Zone(this);
|
Zone myZone = new Zone(this);
|
||||||
myZone.Name = "San Diego";
|
myZone.Name = "San Diego";
|
||||||
|
myZone.Realm = myRealm.Name;
|
||||||
myZone.Description = "San Diego has many attractions, including Sea World!";
|
myZone.Description = "San Diego has many attractions, including Sea World!";
|
||||||
myZone.IsInitialZone = true;
|
myZone.IsInitialZone = true;
|
||||||
|
|
||||||
//Add the Zone to the Realm
|
|
||||||
myRealm.AddZone(myZone);
|
myRealm.AddZone(myZone);
|
||||||
|
|
||||||
//Create our HotelRoom
|
//Create our HotelRoom
|
||||||
Room myRoom = new Room(this);
|
Room myRoom = new Room(this);
|
||||||
myRoom.Name = "Hotel Room B33";
|
myRoom.Name = "Hotel Room B33";
|
||||||
myRoom.IsInitialRoom = true;
|
myRoom.IsInitialRoom = true;
|
||||||
|
myZone.AddRoom(myRoom);
|
||||||
myRoom.DetailedDescription.Add("Your Hotel Room is pretty clean, it is small but not to far off from the beach so you can't complain.");
|
myRoom.DetailedDescription.Add("Your Hotel Room is pretty clean, it is small but not to far off from the beach so you can't complain.");
|
||||||
myRoom.DetailedDescription.Add("You can exit your Hotel Room by walking West");
|
myRoom.DetailedDescription.Add("You can exit your Hotel Room by walking West");
|
||||||
//Add the Hotel Room to the Zones Room Collection
|
|
||||||
myZone.AddRoom(myRoom);
|
|
||||||
|
|
||||||
Room myHallway = new Room(this);
|
Room myHallway = new Room(this);
|
||||||
myHallway.Name = "Hotel Hallway";
|
myHallway.Name = "Hotel Hallway";
|
||||||
myHallway.DetailedDescription.Add("The Hotel Hallway is fairly narrow, but there is plenty of room for people to traverse through it.");
|
myHallway.DetailedDescription.Add("The Hotel Hallway is fairly narrow, but there is plenty of room for people to traverse through it.");
|
||||||
myHallway.DetailedDescription.Add("Your Hotel Room B33 is to the East.");
|
myHallway.DetailedDescription.Add("Your Hotel Room B33 is to the East.");
|
||||||
myHallway.DetailedDescription.Add("Hotel Room B34 is to your West.");
|
myHallway.DetailedDescription.Add("Hotel Room B34 is to your West.");
|
||||||
//Add the Hallway to the Zones Room Collection
|
|
||||||
myZone.AddRoom(myHallway);
|
myZone.AddRoom(myHallway);
|
||||||
|
|
||||||
myZone.LinkRooms(AvailableTravelDirections.West, myHallway, myRoom);
|
myZone.LinkRooms(AvailableTravelDirections.West, myHallway, myRoom);
|
||||||
|
|
||||||
Room nextRoom = new Room(this);
|
Room nextRoom = new Room(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue