MudEngine:
- FileManager.GetDataPath now returns the actual Root directory when Root is requested rather than Root/Projects. That was considered Root for the older Designer. - CommandEngine.GetCommands is now a method rather than a property. - CommandEngine.LoadAllCommands replaced with CommandEngine.LoadBaseCommands for loading Engine specific Game commands. This is called from within Game.Start. A possible property for disabling default commands could be looked at in the future. - CommandEngine.LoadCommandLibrary method added for loading custom user commands. This is fully implemented. - CommandEngine.ClearCommands method added for clearing all currently loaded commands. - Game.IsDebug static property added. - Added additional logging for testing purposes throughout the project. Changing Game.IsDebug to false will remove the majority of the logged messages. - Game.IsMultiplayer property added for enabling or disabling the server for Online/Offline support. Fully implemented. - Game no longer loads user script libraries as this was being handled already by ScriptEngine.Initialize() - Log now caches messages so consoles can print only content that was logged since the last loop. Using Log.FlushMessages() will clear the cached messages allowing each loop to show only the new logged messages. - BaseCharacter IsAdmin argument in the constructor has been removed. No longer needed for testing. - ScriptEngine can now compile more than 1 script without error. - ScriptEngine.Assembly property added for accessing the currently loaded script library. This should be a List<Assembly> in the future for multiple libraries. - Removed the last of my BlitScript engine code from ScriptEngine.cs as it was XNA specific. Need to look at StartupObject.cs as I believe that is XNA specific as well and not needed. MudGame: - Renamed MudGame to MudOfflineExample as it will be used for testing the game with Game.IsMultiplayer disabled. Makes testing easier then needing to stop/restart the server and connect via telnet constantly. MudServer: - Added MudServer project. This is a dedicated server that runs with Game.IsMultiplayer enabled. Developers can connect to it via telnet clients. All engine game commands are implemented. - MudServer includes bin/Debug/Scripts.dll, which is a compiled library of scripts generated via MudCompiler. MudEngine.Game handles loading the library and there is no additional code required by the developers to implement their libraries into their games provided the name is 'Scripts.dll'
This commit is contained in:
parent
281fe4b320
commit
793c3cf1e9
20 changed files with 334 additions and 68 deletions
|
@ -1,6 +1,9 @@
|
|||
public class Player : MudEngine.GameObjects.Characters.Controlled.PlayerBasic
|
||||
public class Player : BaseCharacter
|
||||
{
|
||||
public Player()
|
||||
public Game _Game;
|
||||
|
||||
public Player(Game game) : base(game)
|
||||
{
|
||||
_Game = game;
|
||||
}
|
||||
}
|
|
@ -3,10 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 11.00
|
|||
# Visual C# Express 2010
|
||||
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}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MudOfflineExample", "MudOfflineExample\MudOfflineExample.csproj", "{048E755C-DD05-47EC-930E-F45146B66F7C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MUDCompiler", "MUDCompiler\MUDCompiler.csproj", "{98E974DA-C650-4B88-B2F8-57AC7AE6C34F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MudServer", "MudServer\MudServer.csproj", "{5BA65833-A99D-486C-8E74-C11A0713D44A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -47,6 +49,16 @@ Global
|
|||
{98E974DA-C650-4B88-B2F8-57AC7AE6C34F}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{98E974DA-C650-4B88-B2F8-57AC7AE6C34F}.Release|x86.ActiveCfg = Release|x86
|
||||
{98E974DA-C650-4B88-B2F8-57AC7AE6C34F}.Release|x86.Build.0 = Release|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Debug|x86.Build.0 = Debug|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Release|x86.ActiveCfg = Release|x86
|
||||
{5BA65833-A99D-486C-8E74-C11A0713D44A}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -64,12 +64,11 @@ namespace MudEngine.FileSystem
|
|||
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
|
||||
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
|
||||
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
|
||||
string rootPath = System.IO.Path.Combine(installBase, "Project");
|
||||
|
||||
if (DataType == SaveDataTypes.Root)
|
||||
return rootPath;
|
||||
return installBase;
|
||||
else
|
||||
return System.IO.Path.Combine(rootPath, DataType.ToString());
|
||||
return System.IO.Path.Combine(installBase, DataType.ToString());
|
||||
}
|
||||
|
||||
public static string GetDataPath(string Realm, string Zone)
|
||||
|
@ -77,11 +76,10 @@ namespace MudEngine.FileSystem
|
|||
string assemblyPath = System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.FullyQualifiedName;
|
||||
string assemblyName = System.IO.Path.GetFileName(assemblyPath);
|
||||
string installBase = assemblyPath.Substring(0, assemblyPath.Length - assemblyName.Length);
|
||||
string rootPath = System.IO.Path.Combine(installBase, "Project");
|
||||
string realmsPath = System.IO.Path.Combine(rootPath, "Realms");
|
||||
string requestRealm = Path.Combine(realmsPath, Realm);
|
||||
string requestedRealmZones = Path.Combine(requestRealm, "Zones");
|
||||
string requestedZone = Path.Combine(requestedRealmZones, Zone);
|
||||
string realmsPath = System.IO.Path.Combine(installBase, "Realms");
|
||||
string requestRealm = Path.Combine(installBase, Realm);
|
||||
string requestedRealmZones = Path.Combine(installBase, "Zones");
|
||||
string requestedZone = Path.Combine(installBase, Zone);
|
||||
|
||||
return requestedZone;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
//MUD Engine
|
||||
using MudEngine.GameObjects;
|
||||
|
@ -12,18 +14,18 @@ using MudEngine.GameManagement;
|
|||
|
||||
namespace MudEngine.GameManagement
|
||||
{
|
||||
public class CommandEngine
|
||||
public static class CommandEngine
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or Sets a Dictionary list of available commands to use.
|
||||
/// </summary>
|
||||
static internal Dictionary<string, IGameCommand> Commands { get; set; }
|
||||
static internal Dictionary<string, IGameCommand> Commands { get { return _Commands; } set { _Commands = value; } }
|
||||
static Dictionary<string, IGameCommand> _Commands = new Dictionary<string, IGameCommand>();
|
||||
|
||||
public List<string> GetCommands
|
||||
{
|
||||
get
|
||||
public static List<string> GetCommands()
|
||||
{
|
||||
List<string> temp = new List<string>();
|
||||
|
||||
foreach (string name in Commands.Keys)
|
||||
{
|
||||
temp.Add(name);
|
||||
|
@ -31,9 +33,8 @@ namespace MudEngine.GameManagement
|
|||
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetCommand(string Name)
|
||||
public static bool GetCommand(string Name)
|
||||
{
|
||||
if (Commands.ContainsKey(Name.ToLower()))
|
||||
return true;
|
||||
|
@ -49,6 +50,9 @@ namespace MudEngine.GameManagement
|
|||
public static CommandResults ExecuteCommand(string command, BaseCharacter player)
|
||||
{
|
||||
string commandKey = command.Insert(0, "Command");
|
||||
if (Game.IsDebug)
|
||||
Log.Write("Executing command: " + command);
|
||||
|
||||
foreach (string key in Commands.Keys)
|
||||
{
|
||||
if (commandKey.ToLower().Contains(key.ToLower()))
|
||||
|
@ -59,17 +63,55 @@ namespace MudEngine.GameManagement
|
|||
|
||||
return new CommandResults();
|
||||
}
|
||||
|
||||
public static void LoadBaseCommands()
|
||||
{
|
||||
LoadCommandLibrary(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dynamically loads the specified library into memory and stores all of the
|
||||
/// classess inheriting from MudCreator.InputCommands.ICommand into the CommandEngines
|
||||
/// commands dictionary for use with the project
|
||||
/// </summary>
|
||||
/// <param name="CommandLibrary"></param>
|
||||
public static void LoadAllCommands()
|
||||
public static void LoadCommandLibrary()
|
||||
{
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
Commands = new Dictionary<string, IGameCommand>();
|
||||
foreach (Type t in assembly.GetTypes())
|
||||
LoadCommandLibrary(Assembly.GetExecutingAssembly());
|
||||
}
|
||||
|
||||
public static void LoadCommandLibrary(string libraryFilename)
|
||||
{
|
||||
if (System.IO.File.Exists(libraryFilename))
|
||||
{
|
||||
Assembly assem = Assembly.LoadFile(libraryFilename);
|
||||
LoadCommandLibrary(assem);
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadCommandLibrary(List<Assembly> commandLibraries)
|
||||
{
|
||||
foreach (Assembly lib in commandLibraries)
|
||||
LoadCommandLibrary(lib);
|
||||
}
|
||||
|
||||
public static void LoadCommandLibrary(Assembly commandLibrary)
|
||||
{
|
||||
LoadCommandLibrary(commandLibrary, false);
|
||||
}
|
||||
|
||||
public static void LoadCommandLibrary(Assembly commandLibrary, bool purgeOldCommands)
|
||||
{
|
||||
//no assembly passed for whatever reason, don't attempt to enumerate through it.
|
||||
if (commandLibrary == null)
|
||||
return;
|
||||
|
||||
Log.Write("Loading commands within " + Path.GetFileName(commandLibrary.Location));
|
||||
|
||||
if (purgeOldCommands)
|
||||
ClearCommands();
|
||||
|
||||
foreach (Type t in commandLibrary.GetTypes())
|
||||
{
|
||||
if (t.GetInterface(typeof(IGameCommand).FullName) != null)
|
||||
{
|
||||
|
@ -100,6 +142,11 @@ namespace MudEngine.GameManagement
|
|||
}
|
||||
}
|
||||
|
||||
public static void ClearCommands()
|
||||
{
|
||||
_Commands = new Dictionary<string, IGameCommand>();
|
||||
}
|
||||
|
||||
public static string GetCommand(object Parameter)
|
||||
{
|
||||
List<object> objectList = (List<object>)Parameter;
|
||||
|
|
|
@ -33,9 +33,19 @@ namespace MudEngine.GameManagement
|
|||
Transition,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets if this game is currently running.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public bool IsRunning { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets if this game is running in debug mode. Additional information is sent to the log if enabled.
|
||||
/// </summary>
|
||||
public static bool IsDebug { get; set; }
|
||||
|
||||
public bool IsMultiplayer { get; set; }
|
||||
|
||||
[Category("Company Settings")]
|
||||
[Description("The name of the Company or Author building the game.")]
|
||||
/// <summary>
|
||||
|
@ -176,6 +186,7 @@ namespace MudEngine.GameManagement
|
|||
_Filename = "Game.xml";
|
||||
BaseCurrencyAmount = 1;
|
||||
BaseCurrencyName = "Copper";
|
||||
IsMultiplayer = true; //default.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -183,30 +194,26 @@ namespace MudEngine.GameManagement
|
|||
/// </summary>
|
||||
public bool Start()
|
||||
{
|
||||
//Setup the scripting engine
|
||||
Log.Write("Starting Game...");
|
||||
//Setup the scripting engine and load our script library
|
||||
scriptEngine.Initialize();
|
||||
scriptEngine.ScriptPath = "Scripts";
|
||||
scriptEngine.ScriptExtension = ".mud";
|
||||
|
||||
//Load our scripts library
|
||||
if (System.IO.File.Exists("Scripts.dll"))
|
||||
{
|
||||
Assembly assem = Assembly.LoadFile("Scripts.dll");
|
||||
Log.Write("Loading internal game commands...");
|
||||
//Loads the MudEngine Game Commands
|
||||
CommandEngine.LoadBaseCommands();
|
||||
//Loads any commands found in the users custom scripts library loaded by the script engine.
|
||||
CommandEngine.LoadCommandLibrary(scriptEngine.Assembly);
|
||||
|
||||
foreach (Type t in assem.GetTypes())
|
||||
//Ensure custom commands are loaded until everything is fleshed out.
|
||||
if (Game.IsDebug)
|
||||
{
|
||||
if (t.BaseType.Name == "BaseCharacter")
|
||||
foreach (string command in CommandEngine.GetCommands())
|
||||
{
|
||||
Scripting.GameObject obj = new Scripting.GameObject();
|
||||
obj = scriptEngine.GetObject(t.Name);
|
||||
//PlayerCollection.Add((BaseCharacter)obj.Instance);
|
||||
}
|
||||
Log.Write("Command loaded: " + command);
|
||||
}
|
||||
}
|
||||
|
||||
//Load all of the engine commands
|
||||
CommandEngine.LoadAllCommands();
|
||||
|
||||
Log.Write("Initializing location...");
|
||||
//See if we have an Initial Realm set
|
||||
foreach (Realm r in RealmCollection)
|
||||
{
|
||||
|
@ -217,27 +224,36 @@ namespace MudEngine.GameManagement
|
|||
}
|
||||
}
|
||||
|
||||
if (InitialRealm == null)
|
||||
if ((InitialRealm == null) || (InitialRealm.InitialZone == null) || (InitialRealm.InitialZone.InitialRoom == null))
|
||||
{
|
||||
Log.Write("ERROR: No initial realm set, un-able to finish starting of Game");
|
||||
Log.Write("ERROR: No initial location defined. Game startup failed!");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
Log.Write("Initial Location defined -> " + InitialRealm.Name + "." + InitialRealm.InitialZone.Name + "." + InitialRealm.InitialZone.InitialRoom.Name);
|
||||
|
||||
Log.Write("Starting Server...");
|
||||
//Start the Telnet server
|
||||
if (IsMultiplayer)
|
||||
this.StartServer();
|
||||
|
||||
IsRunning = true;
|
||||
|
||||
Log.Write("Game startup complete.");
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
Log.Write("Server shutdown requested...");
|
||||
//Place ending code here for game shut down.
|
||||
//TODO: Save content on shutdown.
|
||||
if (IsMultiplayer)
|
||||
Server.EndServer();
|
||||
|
||||
IsRunning = false;
|
||||
|
||||
Log.Write("Shutdown completed...");
|
||||
}
|
||||
|
||||
public void Save(string filename)
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace MudEngine.GameManagement
|
|||
{
|
||||
public static class Log
|
||||
{
|
||||
static List<string> cachedMessages = new List<string>();
|
||||
|
||||
public static void Write(string message)
|
||||
{
|
||||
string filename = Path.Combine(FileManager.GetDataPath(SaveDataTypes.Root), "Log.txt");
|
||||
|
@ -22,6 +24,30 @@ namespace MudEngine.GameManagement
|
|||
|
||||
sw.WriteLine(message);
|
||||
sw.Close();
|
||||
|
||||
//Add to the cache so consoles can get these messages if they want to.
|
||||
cachedMessages.Add(message);
|
||||
}
|
||||
|
||||
public static string GetMessages()
|
||||
{
|
||||
string messages = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (string message in cachedMessages)
|
||||
{
|
||||
sb.AppendLine(message);
|
||||
}
|
||||
|
||||
if (sb.ToString() == "")
|
||||
return "";
|
||||
else
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static void FlushMessages()
|
||||
{
|
||||
cachedMessages = new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,10 +44,9 @@ namespace MudEngine.GameObjects.Characters
|
|||
/// </summary>
|
||||
public Game Game { get; private set; }
|
||||
|
||||
public BaseCharacter(Game game,bool admin = false)
|
||||
public BaseCharacter(Game game)
|
||||
{
|
||||
Game = game;
|
||||
IsAdmin = admin;
|
||||
IsActive = false;
|
||||
CurrentRoom = game.InitialRealm.InitialZone.InitialRoom;
|
||||
}
|
||||
|
@ -108,16 +107,22 @@ namespace MudEngine.GameObjects.Characters
|
|||
{
|
||||
// convert that data to string
|
||||
String str;
|
||||
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
|
||||
System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
|
||||
str = enc.GetString(data);
|
||||
|
||||
if (Game.IsDebug)
|
||||
Log.Write("Client entered command: " + str);
|
||||
|
||||
// execute, and get result
|
||||
str = ExecuteCommand(str);
|
||||
|
||||
// convert the result back to bytes and send it back
|
||||
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
|
||||
Send(encoding.GetBytes(str));
|
||||
if (!Game.IsRunning)
|
||||
Clear();
|
||||
}
|
||||
|
||||
internal void Send(byte[] data)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace MudEngine.Networking
|
|||
private void ReceiveThread(object obj)
|
||||
{
|
||||
int sub = (int)obj;
|
||||
MudEngine.GameManagement.Log.Write("Receiving client data...");
|
||||
while (stage == 2 && players[sub].IsActive)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -10,6 +10,8 @@ using System.Text;
|
|||
using System.Reflection;
|
||||
|
||||
using MudEngine.GameObjects;
|
||||
using MudEngine.GameObjects.Characters;
|
||||
using MudEngine.GameManagement;
|
||||
|
||||
namespace MudEngine.Scripting
|
||||
{
|
||||
|
@ -28,6 +30,8 @@ namespace MudEngine.Scripting
|
|||
public string InstallPath { get; private set; }
|
||||
public GameObjectCollection ObjectCollection { get; private set; }
|
||||
|
||||
public Assembly Assembly { get { return _ScriptAssembly; } private set { _ScriptAssembly = value; } }
|
||||
|
||||
/// <summary>
|
||||
/// File Extension for the scripts
|
||||
/// </summary>
|
||||
|
@ -100,12 +104,12 @@ namespace MudEngine.Scripting
|
|||
Directory.CreateDirectory("temp");
|
||||
|
||||
//Setup the additional sourcecode that's needed in the script.
|
||||
string[] usingStatements = new string[] { "using System;", "using MudEngine.GameObjects;", "using MudEngine.FileSystem;" };
|
||||
string source = "\nnamespace MudScripts{\n}";
|
||||
string[] usingStatements = new string[] { "using System;", "using MudEngine.GameObjects;", "using MudEngine.GameObjects.Characters;", "using MudEngine.GameManagement;", "using MudEngine.FileSystem;" };
|
||||
|
||||
foreach (string script in scripts)
|
||||
{
|
||||
string tempPath = "temp";
|
||||
string source = "\nnamespace MudScripts{\n}";
|
||||
|
||||
FileStream fr = new FileStream(script, FileMode.Open, FileAccess.Read, FileShare.None);
|
||||
FileStream fw = new FileStream(Path.Combine(tempPath, Path.GetFileName(script)), FileMode.Create, FileAccess.Write);
|
||||
|
@ -186,6 +190,7 @@ namespace MudEngine.Scripting
|
|||
if (!System.IO.File.Exists("Scripts.dll"))
|
||||
{
|
||||
ErrorMessage = "Failed to load Script Assembly!";
|
||||
Log.Write(ErrorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -193,16 +198,10 @@ namespace MudEngine.Scripting
|
|||
|
||||
foreach (Type type in _ScriptAssembly.GetTypes())
|
||||
{
|
||||
//TODO: Re-implement StartupObject instancing only during Initialize calls.
|
||||
//Remaining scripts should be instanced via a ScriptEngine.LoadObjectList() method.
|
||||
//if (type.BaseType == typeof(StartupObject))
|
||||
//{
|
||||
GameObject gameObject = new GameObject();
|
||||
gameObject.Instance = Activator.CreateInstance(type);
|
||||
gameObject.Name = type.Name;
|
||||
if (type.BaseType == typeof(BaseCharacter))
|
||||
{
|
||||
|
||||
ObjectCollection._GameObjects.Add(gameObject);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ namespace MUDGame
|
|||
game.ServerType = ProtocolType.Tcp;
|
||||
game.ServerPort = 555;
|
||||
game.MaximumPlayers = 1000;
|
||||
game.IsMultiplayer = false; //Disables the server
|
||||
|
||||
//Create the world
|
||||
BuildRealms();
|
||||
|
@ -54,7 +55,7 @@ namespace MUDGame
|
|||
|
||||
//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,true);
|
||||
player = new BaseCharacter(game);
|
||||
//Add the player to the game.
|
||||
//Note once the server is fully implemented the player will be generated automatically by Game.
|
||||
//game.PlayerCollection.Add(player);
|
66
MudServer/MudServer.csproj
Normal file
66
MudServer/MudServer.csproj
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{5BA65833-A99D-486C-8E74-C11A0713D44A}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MudServer</RootNamespace>
|
||||
<AssemblyName>MudServer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\MudOfflineExample\Environments\Zeroth.cs">
|
||||
<Link>Zeroth.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MudEngine\MudEngine.csproj">
|
||||
<Project>{498943A8-DF5A-4DB0-B506-0BFF44788657}</Project>
|
||||
<Name>MudEngine</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
52
MudServer/Program.cs
Normal file
52
MudServer/Program.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
using MudEngine.FileSystem;
|
||||
using MudEngine.GameManagement;
|
||||
using MUDGame.Environments; //Pulling this from the example game, no sense re-writing what already exists.
|
||||
|
||||
namespace MudServer
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Game game = new Game();
|
||||
Zeroth realm = new Zeroth(game);
|
||||
|
||||
realm.BuildZeroth();
|
||||
|
||||
//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;
|
||||
|
||||
Game.IsDebug = true;
|
||||
|
||||
game.Start();
|
||||
|
||||
while (game.IsRunning)
|
||||
{
|
||||
Console.Write(Log.GetMessages());
|
||||
Log.FlushMessages();
|
||||
System.Threading.Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
MudServer/Properties/AssemblyInfo.cs
Normal file
36
MudServer/Properties/AssemblyInfo.cs
Normal file
|
@ -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("MudServer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("MudServer")]
|
||||
[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("5fd303bb-c0fa-40e1-aef2-b959665fc84a")]
|
||||
|
||||
// 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")]
|
1
MudServer/bin/Debug/..svnbridge/Scripts.dll
Normal file
1
MudServer/bin/Debug/..svnbridge/Scripts.dll
Normal file
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:mime-type</Name><Value>application/octet-stream</Value></Property></Properties></ItemProperties>
|
BIN
MudServer/bin/Debug/Scripts.dll
Normal file
BIN
MudServer/bin/Debug/Scripts.dll
Normal file
Binary file not shown.
11
Readme.txt
11
Readme.txt
|
@ -17,10 +17,13 @@ to the project, development roadmap file and the projects design document.
|
|||
Not all of these files are completed files and are subject to change over
|
||||
the next few weeks.
|
||||
|
||||
The Mud Designer Source is included within the "Mud Designer" directory.
|
||||
The source code can be modified by loading the Mud Designer.csproj file
|
||||
into Microsofts Visual C# 2008 Express or newer. The Source Code requires
|
||||
Microsofts .NET Framework 3.5 to compile correctly.
|
||||
The Mud Designer Source is included within the "Mud Designer" directory,
|
||||
however the designer is not being worked on at the moment due to a hefty
|
||||
chunk of the engine being re-wrote.
|
||||
The source code can be modified by loading the MudDesigner.sln file
found
|
||||
in the root directory of the source code.
|
||||
You will need Microsofts Visual C# 2010 Express. The Source Code requires
|
||||
Microsofts .NET Framework 4.0 to compile correctly.
|
||||
|
||||
The File "Mud Designer.pod" is the project roadmap, and can be viewed by
|
||||
opening the file within the free OpenProject software found at
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue