From 0587158f9208ecf9f39a6dd0ef7cb7c5663a39f8 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 13 Mar 2007 08:55:47 +0000 Subject: -- Trying to get trunk to run from first build * Collected required dll's into /bin * Moved timer start for great justice * Added some Writes to Console, and a Status field * Added dumb NullPhysicsScene and NullPhysicsActor that kicks in if Physics Plugin not specified * Svn-ignored a shitload --- src/Config/SimConfig/SimConfig.csproj | 2 +- src/Main.cs | 18 ++-- src/OpenSimConsole.cs | 43 ++++---- src/Properties/AssemblyInfo.cs | 33 +++++++ src/Second-server.csproj | 17 +++- src/ServerConsole/ServerConsole/ServerConsole.cs | 22 ++--- src/opensim.sln | 62 ++++++++++++ src/physics/PhysicsManager.cs | 119 ++++++++++++++++++++++- 8 files changed, 273 insertions(+), 43 deletions(-) create mode 100644 src/Properties/AssemblyInfo.cs create mode 100644 src/opensim.sln diff --git a/src/Config/SimConfig/SimConfig.csproj b/src/Config/SimConfig/SimConfig.csproj index 3131405..5aee907 100644 --- a/src/Config/SimConfig/SimConfig.csproj +++ b/src/Config/SimConfig/SimConfig.csproj @@ -8,7 +8,7 @@ {B063760D-DB8D-4F64-B6FE-335FAD1E650A} - bin\Debug\ + ..\..\..\bin\ False DEBUG;TRACE True diff --git a/src/Main.cs b/src/Main.cs index 3103ea3..0680cbb 100644 --- a/src/Main.cs +++ b/src/Main.cs @@ -71,7 +71,7 @@ namespace OpenSim private PhysicsManager physManager; private System.Timers.Timer timer1 = new System.Timers.Timer(); private string ConfigDll = "SimConfig.dll"; - private string _physicsEngine = "PhysX"; + private string _physicsEngine = ""; public bool sandbox = false; public bool loginserver = false; @@ -83,13 +83,18 @@ namespace OpenSim ServerConsole.MainConsole.Instance = new MServerConsole(ServerConsole.ConsoleBase.ConsoleType.Local,"",0); sim = new OpenSim_Main(); - + + sim.sandbox = false; + sim.loginserver = false; + sim._physicsEngine = ""; + for (int i = 0; i < args.Length; i++) { if(args[i] == "-sandbox") { sim.sandbox = true; } + if(args[i] == "-loginserver") { sim.loginserver = true; @@ -136,9 +141,6 @@ namespace OpenSim private void Startup() { startuptime=DateTime.Now; - timer1.Enabled = true; - timer1.Interval = 100; - timer1.Elapsed +=new ElapsedEventHandler( this.Timer1Tick ); // We check our local database first, then the grid for config options ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration"); @@ -150,7 +152,11 @@ namespace OpenSim ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - We are " + cfg.RegionName + " at " + cfg.RegionLocX.ToString() + "," + cfg.RegionLocY.ToString()); ServerConsole.MainConsole.Instance.WriteLine("Initialising world"); local_world = cfg.LoadWorld(); - + + timer1.Enabled = true; + timer1.Interval = 100; + timer1.Elapsed += new ElapsedEventHandler(this.Timer1Tick); + this.physManager = new PhysicsSystem.PhysicsManager(); this.physManager.LoadPlugins(); ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system"); diff --git a/src/OpenSimConsole.cs b/src/OpenSimConsole.cs index 11bc648..00a4cee 100644 --- a/src/OpenSimConsole.cs +++ b/src/OpenSimConsole.cs @@ -61,6 +61,7 @@ namespace OpenSim ConsType = constype; switch(constype) { case ConsoleType.Local: + Console.WriteLine("ServerConsole.cs - creating new local console"); Console.WriteLine("Logs will be saved to current directory in opensim-console.log"); Log=File.AppendText("opensim-console.log"); @@ -75,22 +76,30 @@ namespace OpenSim default: Console.WriteLine("ServerConsole.cs - what are you smoking? that isn't a valid console type!"); break; - } + } } public override void Close() { Log.WriteLine("OpenSim shutdown at " + DateTime.Now.ToString()); Log.Close(); } - - // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here - public override void WriteLine(string Line) { - Log.WriteLine(Line); - Console.WriteLine(Line); - return; - } - - public override string ReadLine() { + + public override void Write(string format, params object[] args) + { + Log.Write(format, args); + Console.Write(format, args); + return; + } + + public override void WriteLine(string format, params object[] args) + { + Log.WriteLine(format, args); + Console.WriteLine(format, args); + return; + } + + public override string ReadLine() + { string TempStr=Console.ReadLine(); Log.WriteLine(TempStr); return TempStr; @@ -102,12 +111,6 @@ namespace OpenSim return TempInt; } - public override void Write(string Line) { - Console.Write(Line); - Log.Write(Line); - return; - } - // Displays a command prompt and waits for the user to enter a string, then returns that string public override string CmdPrompt(string prompt) { this.Write(prompt); @@ -196,7 +199,13 @@ namespace OpenSim string[] cmdparams=(string[])tempstrarray; RunCmd(cmd,cmdparams); } - } + + + public override void SetStatus(string status) + { + Console.Write( status + "\r" ); + } + } } diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..90fc127 --- /dev/null +++ b/src/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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("opensim")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Playahead AB")] +[assembly: AssemblyProduct("opensim")] +[assembly: AssemblyCopyright("Copyright © Playahead AB 2007")] +[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("1d09756b-a461-4302-b6fe-15c455317909")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Second-server.csproj b/src/Second-server.csproj index 81399ce..89b508a 100644 --- a/src/Second-server.csproj +++ b/src/Second-server.csproj @@ -35,6 +35,9 @@ AnyCPU 4096 + + ..\bin\ + @@ -73,16 +76,26 @@ - - {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9} GridInterfaces + + {D7F0395B-FADC-4936-80A0-D95AACE92F62} + LocalGridServers + + + {74784F23-B0FD-484C-82C1-96C0215733DC} + Db4LocalStorage + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B} PhysicsManager + + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5} + RemoteGridServers + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245} ServerConsole diff --git a/src/ServerConsole/ServerConsole/ServerConsole.cs b/src/ServerConsole/ServerConsole/ServerConsole.cs index 93c8114..27d97e5 100644 --- a/src/ServerConsole/ServerConsole/ServerConsole.cs +++ b/src/ServerConsole/ServerConsole/ServerConsole.cs @@ -43,12 +43,7 @@ namespace ServerConsole instance = value; } } - - public MainConsole() - { - - } - } + } public abstract class ConsoleBase { @@ -60,16 +55,15 @@ namespace ServerConsole } public abstract void Close(); - - // You know what ReadLine() and WriteLine() do, right? And Read() and Write()? Right, you do actually know C#, right? Are you actually a programmer? Do you know english? Do you find my sense of humour in comments irritating? Good, glad you're still here - public abstract void WriteLine(string Line) ; - + + public abstract void Write(string format, params object[] args); + + public abstract void WriteLine(string format, params object[] args); + public abstract string ReadLine(); public abstract int Read() ; - public abstract void Write(string Line) ; - // Displays a command prompt and waits for the user to enter a string, then returns that string public abstract string CmdPrompt(string prompt) ; @@ -87,5 +81,7 @@ namespace ServerConsole // Displays a prompt to the user and then runs the command they entered public abstract void MainConsolePrompt() ; - } + + public abstract void SetStatus( string status ); + } } diff --git a/src/opensim.sln b/src/opensim.sln new file mode 100644 index 0000000..930bf09 --- /dev/null +++ b/src/opensim.sln @@ -0,0 +1,62 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Second-server", "Second-server.csproj", "{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridInterfaces", "GridInterfaces\GridInterfaces.csproj", "{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysicsManager", "physics\PhysicsManager.csproj", "{3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocalGridServers", "LocalServers\LocalGridServers\LocalGridServers.csproj", "{D7F0395B-FADC-4936-80A0-D95AACE92F62}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteGridServers", "RemoteServers\RemoteGridServers\RemoteGridServers.csproj", "{CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimConfig", "Config\SimConfig\SimConfig.csproj", "{B063760D-DB8D-4F64-B6FE-335FAD1E650A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}.Release|Any CPU.Build.0 = Release|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}.Release|Any CPU.Build.0 = Release|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C86A846-7977-4EE7-A8DC-DD487FA5DC2B}.Release|Any CPU.Build.0 = Release|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7F0395B-FADC-4936-80A0-D95AACE92F62}.Release|Any CPU.Build.0 = Release|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF0E7E62-34F4-4AB2-BDBD-AFC63224A7E5}.Release|Any CPU.Build.0 = Release|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B063760D-DB8D-4F64-B6FE-335FAD1E650A}.Release|Any CPU.Build.0 = Release|Any CPU + {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/physics/PhysicsManager.cs b/src/physics/PhysicsManager.cs index e5d5bd6..1fee628 100644 --- a/src/physics/PhysicsManager.cs +++ b/src/physics/PhysicsManager.cs @@ -46,15 +46,21 @@ namespace PhysicsSystem public PhysicsScene GetPhysicsScene(string engineName) { - if(_plugins.ContainsKey(engineName)) + if( String.IsNullOrEmpty( engineName ) ) + { + return new NullPhysicsScene(); + } + + if(_plugins.ContainsKey(engineName)) { ServerConsole.MainConsole.Instance.WriteLine("creating "+engineName); return _plugins[engineName].GetScene(); } else { - ServerConsole.MainConsole.Instance.WriteLine("couldn't find physicsEngine: "+ engineName); - return null; + string error = String.Format("couldn't find physicsEngine: {0}", engineName); + ServerConsole.MainConsole.Instance.WriteLine( error ); + throw new ArgumentException( error ); } } @@ -108,6 +114,14 @@ namespace PhysicsSystem public abstract class PhysicsScene { + public static PhysicsScene Null + { + get + { + return new NullPhysicsScene(); + } + } + public abstract PhysicsActor AddAvatar(PhysicsVector position); public abstract PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size); @@ -124,8 +138,49 @@ namespace PhysicsSystem } } + public class NullPhysicsScene : PhysicsScene + { + private static int m_workIndicator; + + public override PhysicsActor AddAvatar(PhysicsVector position) + { + ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddAvatar({0})", position ); + return PhysicsActor.Null; + } + + public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size) + { + ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : AddPrim({0},{1})", position, size ); + return PhysicsActor.Null; + } + + public override void Simulate(float timeStep) + { + m_workIndicator = ( m_workIndicator + 1 ) % 10; + + ServerConsole.MainConsole.Instance.SetStatus( m_workIndicator.ToString() ); + } + + public override void GetResults() + { + ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : GetResults()" ); + } + + public override void SetTerrain(float[] heightMap) + { + ServerConsole.MainConsole.Instance.WriteLine("NullPhysicsScene : SetTerrain({0} items)", heightMap.Length ); + } + + public override bool IsThreaded + { + get { return false; } + } + } + public abstract class PhysicsActor { + public static readonly PhysicsActor Null = new NullPhysicsActor(); + public abstract PhysicsVector Position { get; @@ -153,7 +208,61 @@ namespace PhysicsSystem public abstract void SetMomentum(PhysicsVector momentum); } - public class PhysicsVector + public class NullPhysicsActor : PhysicsActor + { + public override PhysicsVector Position + { + get + { + return PhysicsVector.Zero; + } + set + { + return; + } + } + + public override PhysicsVector Velocity + { + get + { + return PhysicsVector.Zero; + } + set + { + return; + } + } + + public override PhysicsVector Acceleration + { + get { return PhysicsVector.Zero; } + } + + public override bool Flying + { + get + { + return false; + } + set + { + return; + } + } + + public override void AddForce(PhysicsVector force) + { + return; + } + + public override void SetMomentum(PhysicsVector momentum) + { + return; + } + } + + public class PhysicsVector { public float X; public float Y; @@ -170,5 +279,7 @@ namespace PhysicsSystem Y = y; Z = z; } + + public static readonly PhysicsVector Zero = new PhysicsVector(0f, 0f, 0f); } } -- cgit v1.1