* Few more tweaks to event queue server to improve performance and thread safety

[Simian]
* Made default assets for map water overlay and HyperGrid portals
* Fixed asset store loading regression
* Start synchronization after RegionHandshakeReply instead of CompleteAgentMovement (allows the sync function to be called for child agents as well)
* Start informing clients of neighbor regions when AgentThrottle is received (prevents client crashes, and this will become necessary data in the future)
* Minor fixes in map handling

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2488 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2009-03-17 00:17:07 +00:00
parent cb4e07b6c1
commit d4e07b8c4d
11 changed files with 212 additions and 149 deletions

View File

@@ -20,6 +20,8 @@ namespace Simian
scene.UDP.RegisterPacketCallback(PacketType.UseCircuitCode, UseCircuitCodeHandler);
scene.UDP.RegisterPacketCallback(PacketType.StartPingCheck, StartPingCheckHandler);
scene.UDP.RegisterPacketCallback(PacketType.LogoutRequest, LogoutRequestHandler);
scene.UDP.RegisterPacketCallback(PacketType.AgentThrottle, AgentThrottleHandler);
scene.UDP.RegisterPacketCallback(PacketType.RegionHandshakeReply, RegionHandshakeReplyHandler);
return true;
}
@@ -83,5 +85,70 @@ namespace Simian
scene.ObjectRemove(this, agent.ID);
}
void AgentThrottleHandler(Packet packet, Agent agent)
{
AgentThrottlePacket throttle = (AgentThrottlePacket)packet;
// TODO: These need to be transmitted to neighbor sims before child agent connections can be established
//throttle.Throttle.Throttles
// Initiate the connection process for this agent to neighboring regions
scene.InformClientOfNeighbors(agent);
}
void RegionHandshakeReplyHandler(Packet packet, Agent agent)
{
// Send updates and appearances for every avatar to this new avatar
SynchronizeStateTo(agent);
}
// HACK: The reduction provider will deprecate this at some point
void SynchronizeStateTo(Agent agent)
{
// Send the parcel overlay
scene.Parcels.SendParcelOverlay(agent);
// Send object updates for objects and avatars
scene.ForEachObject(delegate(SimulationObject obj)
{
ObjectUpdatePacket update = new ObjectUpdatePacket();
update.RegionData.RegionHandle = scene.RegionHandle;
update.RegionData.TimeDilation = (ushort)(scene.Physics.TimeDilation * (float)UInt16.MaxValue);
update.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
update.ObjectData[0] = SimulationObject.BuildUpdateBlock(obj.Prim, obj.Prim.Flags, obj.CRC);
scene.UDP.SendPacket(agent.ID, update, PacketCategory.State);
});
// Send appearances for all avatars
scene.ForEachAgent(
delegate(Agent otherAgent)
{
if (otherAgent != agent)
{
// Send appearances for this avatar
AvatarAppearancePacket appearance = otherAgent.BuildAppearancePacket();
scene.UDP.SendPacket(agent.ID, appearance, PacketCategory.State);
}
}
);
// Send terrain data
SendLayerData(agent);
}
void SendLayerData(Agent agent)
{
for (int y = 0; y < 16; y++)
{
for (int x = 0; x < 16; x++)
{
float[,] heightmap = scene.GetTerrainPatch((uint)x, (uint)y);
LayerDataPacket layer = TerrainCompressor.CreateLandPacket(heightmap, x, y);
scene.UDP.SendPacket(agent.ID, layer, PacketCategory.Terrain);
}
}
}
}
}