diff options
author | Teravus Ovares | 2008-01-22 08:52:51 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-22 08:52:51 +0000 |
commit | 5cf96daaf29209e065b852a0eefeb7f5dbd88b48 (patch) | |
tree | 34518c3c3609fbe6654a651d6ad357d257f60f26 /OpenSim/Region/Environment/Scenes | |
parent | * Renamed a number of TerrainEngine functions to conform naming standards bet... (diff) | |
download | opensim-SC_OLD-5cf96daaf29209e065b852a0eefeb7f5dbd88b48.zip opensim-SC_OLD-5cf96daaf29209e065b852a0eefeb7f5dbd88b48.tar.gz opensim-SC_OLD-5cf96daaf29209e065b852a0eefeb7f5dbd88b48.tar.bz2 opensim-SC_OLD-5cf96daaf29209e065b852a0eefeb7f5dbd88b48.tar.xz |
* Enabled dead region tracking for ChildAgentDataUpdates
** If the region fails 3 times, then ChildAgentDataUpdates no longer get sent to that region
* Enabled Child_Get_Tasks in grid mode.
* When Child_Get_Tasks is enabled on neighbor regions, the neighbor region uses the client's draw distance to send out prim. This is a lot less likely to flood the client now since the ChildAgentDataUpdate contains both the throttle settings and the draw distance. This means that with this enabled, you can see prim in other regions in grid mode. Very experimental.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 19 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 58 |
4 files changed, 105 insertions, 35 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 9aa3f20..6c0ed28 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -537,20 +537,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
537 | // the initial update for and what we'll use to limit the | 537 | // the initial update for and what we'll use to limit the |
538 | // space we check for new objects on movement. | 538 | // space we check for new objects on movement. |
539 | 539 | ||
540 | if (presence.IsChildAgent) | 540 | if (presence.IsChildAgent && m_parentScene.m_sendTasksToChild) |
541 | { | 541 | { |
542 | //Vector3 avPosition = new Vector3(presence.AbsolutePosition.X,presence.AbsolutePosition.Y,presence.AbsolutePosition.Z); | 542 | LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; |
543 | //LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition; | 543 | float distResult = (float)Util.GetDistanceTo(presence.AbsolutePosition,oLoc); |
544 | //Vector3 objPosition = new Vector3(oLoc.X,oLoc.Y,oLoc.Z); | 544 | |
545 | //float distResult = Vector3Distance(avPosition, objPosition); | 545 | //MainLog.Instance.Verbose("DISTANCE", distResult.ToString()); |
546 | //if (distResult > 512) | 546 | |
547 | //{ | 547 | if (distResult > 60) |
548 | //int x = 0; | 548 | { |
549 | //} | 549 | int x = 0; |
550 | //if (distResult < presence.DrawDistance) | 550 | } |
551 | //{ | 551 | if (distResult < presence.DrawDistance) |
552 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); | 552 | { |
553 | //} | 553 | // Send Only if we don't already know about it. |
554 | // KnownPrim also makes the prim known when called. | ||
555 | if (!presence.KnownPrim(((SceneObjectGroup) ent).UUID)) | ||
556 | ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); | ||
557 | } | ||
554 | } | 558 | } |
555 | else | 559 | else |
556 | { | 560 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 64b9abb..f32de2e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1391,6 +1391,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1391 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; | 1391 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; |
1392 | m_sceneGridService.OnRegionUp += OtherRegionUp; | 1392 | m_sceneGridService.OnRegionUp += OtherRegionUp; |
1393 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; | 1393 | m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; |
1394 | |||
1395 | |||
1394 | 1396 | ||
1395 | 1397 | ||
1396 | 1398 | ||
@@ -1492,19 +1494,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1492 | public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 1494 | public virtual bool IncomingChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) |
1493 | { | 1495 | { |
1494 | ScenePresence childAgentUpdate = GetScenePresence(new LLUUID(cAgentData.AgentID)); | 1496 | ScenePresence childAgentUpdate = GetScenePresence(new LLUUID(cAgentData.AgentID)); |
1495 | if (!(childAgentUpdate.Equals(null))) | 1497 | if (childAgentUpdate != null) |
1496 | { | 1498 | { |
1497 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. | 1499 | // I can't imagine *yet* why we would get an update if the agent is a root agent.. |
1498 | // however to avoid a race condition crossing borders.. | 1500 | // however to avoid a race condition crossing borders.. |
1499 | if (childAgentUpdate.IsChildAgent) | 1501 | if (childAgentUpdate.IsChildAgent) |
1500 | { | 1502 | { |
1503 | uint rRegionX = (uint)(cAgentData.regionHandle >> 40); | ||
1504 | uint rRegionY = (((uint)(cAgentData.regionHandle)) >> 8); | ||
1505 | uint tRegionX = RegionInfo.RegionLocX; | ||
1506 | uint tRegionY = RegionInfo.RegionLocY; | ||
1501 | //Send Data to ScenePresence | 1507 | //Send Data to ScenePresence |
1502 | childAgentUpdate.ChildAgentDataUpdate(cAgentData); | 1508 | childAgentUpdate.ChildAgentDataUpdate(cAgentData, tRegionX, tRegionY, rRegionX, rRegionY); |
1503 | // Not Implemented: | 1509 | // Not Implemented: |
1504 | //TODO: Do we need to pass the message on to one of our neighbors? | 1510 | //TODO: Do we need to pass the message on to one of our neighbors? |
1511 | |||
1505 | } | 1512 | } |
1513 | return true; | ||
1506 | } | 1514 | } |
1507 | return true; | 1515 | return false; |
1508 | } | 1516 | } |
1509 | 1517 | ||
1510 | /// <summary> | 1518 | /// <summary> |
@@ -1614,6 +1622,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1614 | return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); | 1622 | return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); |
1615 | } | 1623 | } |
1616 | 1624 | ||
1625 | public void SendOutChildAgentUpdates(ChildAgentDataUpdate cadu, ScenePresence presence) | ||
1626 | { | ||
1627 | m_sceneGridService.SendChildAgentDataUpdate(cadu, presence); | ||
1628 | } | ||
1629 | |||
1617 | #endregion | 1630 | #endregion |
1618 | 1631 | ||
1619 | #region Module Methods | 1632 | #region Module Methods |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index a9c2c2f..805b44c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -332,7 +332,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
332 | //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); | 332 | //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region)); |
333 | } | 333 | } |
334 | 334 | ||
335 | public delegate void SendChildAgentDataUpdateDelegate(ulong regionHandle, ChildAgentDataUpdate cAgentData); | 335 | public delegate void SendChildAgentDataUpdateDelegate(ChildAgentDataUpdate cAgentData, ScenePresence presence); |
336 | 336 | ||
337 | /// <summary> | 337 | /// <summary> |
338 | /// This informs all neighboring regions about the settings of it's child agent. | 338 | /// This informs all neighboring regions about the settings of it's child agent. |
@@ -341,18 +341,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
341 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. | 341 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. |
342 | /// | 342 | /// |
343 | /// </summary> | 343 | /// </summary> |
344 | private void SendChildAgentDataUpdateAsync(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 344 | private void SendChildAgentDataUpdateAsync(ChildAgentDataUpdate cAgentData, ScenePresence presence) |
345 | { | 345 | { |
346 | MainLog.Instance.Notice("INTERGRID", "Informing a neighbor about my agent."); | 346 | //MainLog.Instance.Notice("INTERGRID", "Informing neighbors about my agent."); |
347 | bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); | ||
348 | 347 | ||
349 | if (regionAccepted) | 348 | foreach (ulong regionHandle in presence.KnownChildRegions) |
350 | { | ||
351 | MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent"); | ||
352 | } | ||
353 | else | ||
354 | { | 349 | { |
355 | MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); | 350 | bool regionAccepted = m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); |
351 | |||
352 | if (regionAccepted) | ||
353 | { | ||
354 | //MainLog.Instance.Notice("INTERGRID", "Completed sending a neighbor an update about my agent"); | ||
355 | } | ||
356 | else | ||
357 | { | ||
358 | //MainLog.Instance.Notice("INTERGRID", "Failed sending a neighbor an update about my agent"); | ||
359 | } | ||
356 | } | 360 | } |
357 | } | 361 | } |
358 | 362 | ||
@@ -362,11 +366,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
362 | icon.EndInvoke(iar); | 366 | icon.EndInvoke(iar); |
363 | } | 367 | } |
364 | 368 | ||
365 | public void SendChildAgentDataUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | 369 | public void SendChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, ScenePresence presence) |
366 | { | 370 | { |
367 | // This assumes that we know what our neighbors are. | 371 | // This assumes that we know what our neighbors are. |
368 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | 372 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; |
369 | d.BeginInvoke(regionHandle, cAgentData, | 373 | d.BeginInvoke(cAgentData,presence, |
370 | SendChildAgentDataUpdateCompleted, | 374 | SendChildAgentDataUpdateCompleted, |
371 | d); | 375 | d); |
372 | } | 376 | } |
@@ -374,11 +378,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
374 | public delegate void SendCloseChildAgentDelegate( ScenePresence presence); | 378 | public delegate void SendCloseChildAgentDelegate( ScenePresence presence); |
375 | 379 | ||
376 | /// <summary> | 380 | /// <summary> |
377 | /// This informs all neighboring regions about the settings of it's child agent. | 381 | /// This Closes child agents on neighboring regions |
378 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 382 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
379 | /// | ||
380 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. | ||
381 | /// | ||
382 | /// </summary> | 383 | /// </summary> |
383 | private void SendCloseChildAgentAsync(ScenePresence presence) | 384 | private void SendCloseChildAgentAsync(ScenePresence presence) |
384 | { | 385 | { |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index c8310e4..f37b38b 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -55,6 +55,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
55 | private LLVector3 m_requestedSitOffset = new LLVector3(); | 55 | private LLVector3 m_requestedSitOffset = new LLVector3(); |
56 | private float m_sitAvatarHeight = 2.0f; | 56 | private float m_sitAvatarHeight = 2.0f; |
57 | private float m_godlevel = 0; | 57 | private float m_godlevel = 0; |
58 | private LLVector3 m_LastChildAgentUpdatePosition = new LLVector3(); | ||
58 | 59 | ||
59 | private int m_perfMonMS = 0; | 60 | private int m_perfMonMS = 0; |
60 | 61 | ||
@@ -90,6 +91,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
90 | private LLQuaternion m_headrotation = new LLQuaternion(); | 91 | private LLQuaternion m_headrotation = new LLQuaternion(); |
91 | private byte m_state = (byte) 0; | 92 | private byte m_state = (byte) 0; |
92 | 93 | ||
94 | private List<LLUUID> m_knownPrimUUID = new List<LLUUID>(); | ||
95 | |||
93 | // Agent's Draw distance. | 96 | // Agent's Draw distance. |
94 | protected float m_DrawDistance = 0f; | 97 | protected float m_DrawDistance = 0f; |
95 | 98 | ||
@@ -136,6 +139,17 @@ namespace OpenSim.Region.Environment.Scenes | |||
136 | get { return m_physicsActor; } | 139 | get { return m_physicsActor; } |
137 | } | 140 | } |
138 | 141 | ||
142 | public bool KnownPrim(LLUUID primID) | ||
143 | { | ||
144 | if (m_knownPrimUUID.Contains(primID)) | ||
145 | { | ||
146 | return true; | ||
147 | } | ||
148 | m_knownPrimUUID.Add(primID); | ||
149 | return false; | ||
150 | } | ||
151 | |||
152 | |||
139 | public bool Updated | 153 | public bool Updated |
140 | { | 154 | { |
141 | set { m_updateflag = value; } | 155 | set { m_updateflag = value; } |
@@ -499,7 +513,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
499 | m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); | 513 | m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); |
500 | //if (!m_gotAllObjectsInScene) | 514 | //if (!m_gotAllObjectsInScene) |
501 | //{ | 515 | //{ |
502 | //m_scene.SendAllSceneObjectsToClient(this); | 516 | m_scene.SendAllSceneObjectsToClient(this); |
503 | //m_gotAllObjectsInScene = true; | 517 | //m_gotAllObjectsInScene = true; |
504 | //} | 518 | //} |
505 | } | 519 | } |
@@ -1408,6 +1422,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
1408 | m_scene.NotifyMyCoarseLocationChange(); | 1422 | m_scene.NotifyMyCoarseLocationChange(); |
1409 | } | 1423 | } |
1410 | } | 1424 | } |
1425 | |||
1426 | // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m | ||
1427 | if (Util.GetDistanceTo(AbsolutePosition,m_LastChildAgentUpdatePosition) > 32) | ||
1428 | { | ||
1429 | ChildAgentDataUpdate cadu = new ChildAgentDataUpdate(); | ||
1430 | cadu.ActiveGroupID=LLUUID.Zero.UUID; | ||
1431 | cadu.AgentID = UUID.UUID; | ||
1432 | cadu.alwaysrun = m_setAlwaysRun; | ||
1433 | cadu.AVHeight = m_avHeight; | ||
1434 | LLVector3 tempCameraCenter = new LLVector3(m_CameraCenter.x, m_CameraCenter.y, m_CameraCenter.z); | ||
1435 | cadu.cameraPosition = new sLLVector3(tempCameraCenter); | ||
1436 | cadu.drawdistance = m_DrawDistance; | ||
1437 | cadu.godlevel = m_godlevel; | ||
1438 | cadu.GroupAccess = 0; | ||
1439 | cadu.Position = new sLLVector3(AbsolutePosition); | ||
1440 | cadu.regionHandle = m_scene.RegionInfo.RegionHandle; | ||
1441 | cadu.throttles = ControllingClient.GetThrottlesPacked(1f); | ||
1442 | cadu.Velocity = new sLLVector3(Velocity); | ||
1443 | m_scene.SendOutChildAgentUpdates(cadu,this); | ||
1444 | m_LastChildAgentUpdatePosition.X = AbsolutePosition.X; | ||
1445 | m_LastChildAgentUpdatePosition.Y = AbsolutePosition.Y; | ||
1446 | m_LastChildAgentUpdatePosition.Z = AbsolutePosition.Z; | ||
1447 | } | ||
1411 | } | 1448 | } |
1412 | 1449 | ||
1413 | #endregion | 1450 | #endregion |
@@ -1532,15 +1569,30 @@ namespace OpenSim.Region.Environment.Scenes | |||
1532 | /// This updates important decision making data about a child agent | 1569 | /// This updates important decision making data about a child agent |
1533 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region | 1570 | /// The main purpose is to figure out what objects to send to a child agent that's in a neighboring region |
1534 | /// </summary> | 1571 | /// </summary> |
1535 | public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData) | 1572 | public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) |
1536 | { | 1573 | { |
1537 | // | 1574 | // |
1575 | int shiftx = ((int)rRegionX - (int)tRegionX) * 256; | ||
1576 | int shifty = ((int)rRegionY - (int)tRegionY) * 256; | ||
1577 | |||
1538 | m_DrawDistance = cAgentData.drawdistance; | 1578 | m_DrawDistance = cAgentData.drawdistance; |
1539 | m_pos = new LLVector3(cAgentData.Position.x, cAgentData.Position.y, cAgentData.Position.z); | 1579 | m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); |
1580 | |||
1581 | // It's hard to say here.. We can't really tell where the camera position is unless it's in world cordinates from the sending region | ||
1540 | m_CameraCenter = | 1582 | m_CameraCenter = |
1541 | new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); | 1583 | new Vector3(cAgentData.cameraPosition.x, cAgentData.cameraPosition.y, cAgentData.cameraPosition.z); |
1584 | |||
1585 | |||
1542 | m_godlevel = cAgentData.godlevel; | 1586 | m_godlevel = cAgentData.godlevel; |
1587 | SetHeight(cAgentData.AVHeight); | ||
1588 | |||
1543 | ControllingClient.SetChildAgentThrottle(cAgentData.throttles); | 1589 | ControllingClient.SetChildAgentThrottle(cAgentData.throttles); |
1590 | |||
1591 | |||
1592 | |||
1593 | // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. | ||
1594 | if (m_scene.m_sendTasksToChild) | ||
1595 | m_scene.SendAllSceneObjectsToClient(this); | ||
1544 | //cAgentData.AVHeight; | 1596 | //cAgentData.AVHeight; |
1545 | //cAgentData.regionHandle; | 1597 | //cAgentData.regionHandle; |
1546 | //m_velocity = cAgentData.Velocity; | 1598 | //m_velocity = cAgentData.Velocity; |