Began implementing basic physics engine plugin framework

adam
gareth 2007-03-02 22:17:39 +00:00
parent acc98fca7b
commit cb55056e3b
4 changed files with 43 additions and 12 deletions

View File

@ -106,18 +106,19 @@ namespace OpenSim
}
public World LoadWorld() {
IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
if(world_result.Count==1) {
Console.WriteLine("Config.cs:LoadWorld() - Looking for a world object in local DB");
// IObjectSet world_result = db.Get(typeof(OpenSim.world.World));
// if(world_result.Count==1) {
Console.WriteLine("Config.cs:LoadWorld() - Found an OpenSim.world.World object in local database, loading");
return (World)world_result.Next();
} else {
//return (World)world_result.Next();
// } else {
Console.WriteLine("Config.cs:LoadWorld() - Could not find the world or too many worlds! Constructing blank one");
World blank = new World();
Console.WriteLine("Config.cs:LoadWorld() - Saving initial world state to disk");
db.Set(blank);
db.Commit();
return blank;
}
// }
}
public void LoadFromGrid() {

View File

@ -50,7 +50,6 @@ namespace OpenSim
public static SimConfig cfg;
public static World local_world;
private static Thread MainListener;
private static Thread PingRespponder;
public static Socket Server;
private static IPEndPoint ServerIncoming;
private static byte[] RecvBuffer = new byte[4096];
@ -68,7 +67,7 @@ namespace OpenSim
sim = new OpenSim_Main();
sim.Startup();
while(true) {
Thread.Sleep(1000);
local_world.DoStuff();
}
}
@ -91,6 +90,8 @@ namespace OpenSim
MainListener = new Thread(new ThreadStart(MainServerListener));
MainListener.Start();
Console.WriteLine("Main.cs:Startup() - Starting up main world loop");
local_world.InitLoop();
}
private void OnReceivedData(IAsyncResult result) {

View File

@ -0,0 +1,21 @@
using System;
using System.Threading;
using libsecondlife;
using libsecondlife.Packets;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.world
{
public class PhysicsEngine
{
public PhysicsEngine() {
}
public void Startup() {
Console.WriteLine("PhysicsEngine.cs:Startup() - DOING NOTHING, DUMMY FUNCTION!");
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Threading;
using libsecondlife;
using libsecondlife.Packets;
using System.Collections.Generic;
@ -13,6 +14,7 @@ namespace OpenSim.world
public ScriptEngine Scripts;
public TerrainDecode terrainengine = new TerrainDecode();
public uint _localNumber=0;
public PhysicsEngine physics;
private Random Rand = new Random();
@ -28,13 +30,19 @@ namespace OpenSim.world
LandMap[i] = 21.4989f;
}
Console.WriteLine("World.cs - Creating script engine instance");
// Initialise this only after the world has loaded
Scripts = new ScriptEngine(this);
}
public void Update()
{
public void InitLoop() {
Console.WriteLine("World.cs:StartLoop() - Initialising physics");
this.physics = new PhysicsEngine();
physics.Startup();
}
public void DoStuff() {
Thread.Sleep(1000);
}
public void Update() {
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
{
Entities[UUID].update();