aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgareth2007-03-02 22:17:39 +0000
committergareth2007-03-02 22:17:39 +0000
commitcb55056e3bb0d34e51d8efa60cb8ef82484af900 (patch)
tree5bc1a97e7f8c1629dd99433c0751a77159fc3555
parentr105 somehow got put in wrong place, so replacing files (diff)
downloadopensim-SC-cb55056e3bb0d34e51d8efa60cb8ef82484af900.zip
opensim-SC-cb55056e3bb0d34e51d8efa60cb8ef82484af900.tar.gz
opensim-SC-cb55056e3bb0d34e51d8efa60cb8ef82484af900.tar.bz2
opensim-SC-cb55056e3bb0d34e51d8efa60cb8ef82484af900.tar.xz
Began implementing basic physics engine plugin framework
-rw-r--r--src/Config.cs11
-rw-r--r--src/Main.cs5
-rw-r--r--src/world/PhysicsEngine.cs21
-rw-r--r--src/world/World.cs18
4 files changed, 43 insertions, 12 deletions
diff --git a/src/Config.cs b/src/Config.cs
index d4a0797..f85e4d5 100644
--- a/src/Config.cs
+++ b/src/Config.cs
@@ -106,18 +106,19 @@ namespace OpenSim
106 } 106 }
107 107
108 public World LoadWorld() { 108 public World LoadWorld() {
109 IObjectSet world_result = db.Get(typeof(OpenSim.world.World)); 109 Console.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB");
110 if(world_result.Count==1) { 110 // IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
111 // if(world_result.Count==1) {
111 Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading"); 112 Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
112 return (World)world_result.Next(); 113 //return (World)world_result.Next();
113 } else { 114 // } else {
114 Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one"); 115 Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
115 World blank = new World(); 116 World blank = new World();
116 Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk"); 117 Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
117 db.Set(blank); 118 db.Set(blank);
118 db.Commit(); 119 db.Commit();
119 return blank; 120 return blank;
120 } 121 // }
121 } 122 }
122 123
123 public void LoadFromGrid() { 124 public void LoadFromGrid() {
diff --git a/src/Main.cs b/src/Main.cs
index 6075035..146d837 100644
--- a/src/Main.cs
+++ b/src/Main.cs
@@ -50,7 +50,6 @@ namespace OpenSim
50 public static SimConfig cfg; 50 public static SimConfig cfg;
51 public static World local_world; 51 public static World local_world;
52 private static Thread MainListener; 52 private static Thread MainListener;
53 private static Thread PingRespponder;
54 public static Socket Server; 53 public static Socket Server;
55 private static IPEndPoint ServerIncoming; 54 private static IPEndPoint ServerIncoming;
56 private static byte[] RecvBuffer = new byte[4096]; 55 private static byte[] RecvBuffer = new byte[4096];
@@ -68,7 +67,7 @@ namespace OpenSim
68 sim = new OpenSim_Main(); 67 sim = new OpenSim_Main();
69 sim.Startup(); 68 sim.Startup();
70 while(true) { 69 while(true) {
71 Thread.Sleep(1000); 70 local_world.DoStuff();
72 } 71 }
73 } 72 }
74 73
@@ -91,6 +90,8 @@ namespace OpenSim
91 MainListener = new Thread(new ThreadStart(MainServerListener)); 90 MainListener = new Thread(new ThreadStart(MainServerListener));
92 MainListener.Start(); 91 MainListener.Start();
93 92
93 Console.WriteLine("Main.cs:Startup() - Starting up main world loop");
94 local_world.InitLoop();
94 } 95 }
95 96
96 private void OnReceivedData(IAsyncResult result) { 97 private void OnReceivedData(IAsyncResult result) {
diff --git a/src/world/PhysicsEngine.cs b/src/world/PhysicsEngine.cs
new file mode 100644
index 0000000..5bc52de
--- /dev/null
+++ b/src/world/PhysicsEngine.cs
@@ -0,0 +1,21 @@
1using System;
2using System.Threading;
3using libsecondlife;
4using libsecondlife.Packets;
5using System.Collections.Generic;
6using System.Text;
7
8namespace OpenSim.world
9{
10 public class PhysicsEngine
11 {
12
13 public PhysicsEngine() {
14 }
15
16 public void Startup() {
17 Console.WriteLine("PhysicsEngine.cs:Startup() - DOING NOTHING, DUMMY FUNCTION!");
18 }
19
20 }
21}
diff --git a/src/world/World.cs b/src/world/World.cs
index ebbd61e..f02f73f 100644
--- a/src/world/World.cs
+++ b/src/world/World.cs
@@ -1,4 +1,5 @@
1using System; 1using System;
2using System.Threading;
2using libsecondlife; 3using libsecondlife;
3using libsecondlife.Packets; 4using libsecondlife.Packets;
4using System.Collections.Generic; 5using System.Collections.Generic;
@@ -13,6 +14,7 @@ namespace OpenSim.world
13 public ScriptEngine Scripts; 14 public ScriptEngine Scripts;
14 public TerrainDecode terrainengine = new TerrainDecode(); 15 public TerrainDecode terrainengine = new TerrainDecode();
15 public uint _localNumber=0; 16 public uint _localNumber=0;
17 public PhysicsEngine physics;
16 18
17 private Random Rand = new Random(); 19 private Random Rand = new Random();
18 20
@@ -28,13 +30,19 @@ namespace OpenSim.world
28 LandMap[i] = 21.4989f; 30 LandMap[i] = 21.4989f;
29 } 31 }
30 32
31 Console.WriteLine("World.cs - Creating script engine instance");
32 // Initialise this only after the world has loaded
33 Scripts = new ScriptEngine(this);
34 } 33 }
35 34
36 public void Update() 35 public void InitLoop() {
37 { 36 Console.WriteLine("World.cs:StartLoop() - Initialising physics");
37 this.physics = new PhysicsEngine();
38 physics.Startup();
39 }
40
41 public void DoStuff() {
42 Thread.Sleep(1000);
43 }
44
45 public void Update() {
38 foreach (libsecondlife.LLUUID UUID in Entities.Keys) 46 foreach (libsecondlife.LLUUID UUID in Entities.Keys)
39 { 47 {
40 Entities[UUID].update(); 48 Entities[UUID].update();