diff options
* This makes in-world terrain editing smoother, even in MegaRegions. This change only affects the editing user's experience. Non-editing users will see nothing different from the current 'slow' result. See comments for the thought process and how the issues surrounding terrain editing, cache, bandwidth, threading, terrain patch reliability and throttling were balanced.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8b2440a..0dbce2f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
327 | private PriorityQueue m_entityProps; | 327 | private PriorityQueue m_entityProps; |
328 | private Prioritizer m_prioritizer; | 328 | private Prioritizer m_prioritizer; |
329 | private bool m_disableFacelights = false; | 329 | private bool m_disableFacelights = false; |
330 | 330 | private volatile bool m_justEditedTerrain = false; | |
331 | /// <value> | 331 | /// <value> |
332 | /// List used in construction of data blocks for an object update packet. This is to stop us having to | 332 | /// List used in construction of data blocks for an object update packet. This is to stop us having to |
333 | /// continually recreate it. | 333 | /// continually recreate it. |
@@ -1239,9 +1239,32 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1239 | LLHeightFieldMoronize(map); | 1239 | LLHeightFieldMoronize(map); |
1240 | 1240 | ||
1241 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); | 1241 | LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(heightmap, patches); |
1242 | layerpack.Header.Reliable = true; | 1242 | |
1243 | // When a user edits the terrain, so much data is sent, the data queues up fast and presents a sub optimal editing experience. | ||
1244 | // To alleviate this issue, when the user edits the terrain, we start skipping the queues until they're done editing the terrain. | ||
1245 | // We also make them unreliable because it's extremely likely that multiple packets will be sent for a terrain patch area | ||
1246 | // invalidating previous packets for that area. | ||
1243 | 1247 | ||
1244 | OutPacket(layerpack, ThrottleOutPacketType.Land); | 1248 | // It's possible for an editing user to flood themselves with edited packets but the majority of use cases are such that only a |
1249 | // tiny percentage of users will be editing the terrain. Other, non-editing users will see the edits much slower. | ||
1250 | |||
1251 | // One last note on this topic, by the time users are going to be editing the terrain, it's extremely likely that the sim will | ||
1252 | // have rezzed already and therefore this is not likely going to cause any additional issues with lost packets, objects or terrain | ||
1253 | // patches. | ||
1254 | |||
1255 | // m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we only have one cache miss. | ||
1256 | if (m_justEditedTerrain) | ||
1257 | { | ||
1258 | layerpack.Header.Reliable = false; | ||
1259 | OutPacket(layerpack, | ||
1260 | ThrottleOutPacketType.Unknown ); | ||
1261 | } | ||
1262 | else | ||
1263 | { | ||
1264 | layerpack.Header.Reliable = true; | ||
1265 | OutPacket(layerpack, | ||
1266 | ThrottleOutPacketType.Land); | ||
1267 | } | ||
1245 | } | 1268 | } |
1246 | catch (Exception e) | 1269 | catch (Exception e) |
1247 | { | 1270 | { |
@@ -6263,6 +6286,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6263 | //m_log.Info("[LAND]: LAND:" + modify.ToString()); | 6286 | //m_log.Info("[LAND]: LAND:" + modify.ToString()); |
6264 | if (modify.ParcelData.Length > 0) | 6287 | if (modify.ParcelData.Length > 0) |
6265 | { | 6288 | { |
6289 | // Note: the ModifyTerrain event handler sends out updated packets before the end of this event. Therefore, | ||
6290 | // a simple boolean value should work and perhaps queue up just a few terrain patch packets at the end of the edit. | ||
6291 | m_justEditedTerrain = true; // Prevent terrain packet (Land layer) from being queued, make it unreliable | ||
6266 | if (OnModifyTerrain != null) | 6292 | if (OnModifyTerrain != null) |
6267 | { | 6293 | { |
6268 | for (int i = 0; i < modify.ParcelData.Length; i++) | 6294 | for (int i = 0; i < modify.ParcelData.Length; i++) |
@@ -6278,6 +6304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6278 | } | 6304 | } |
6279 | } | 6305 | } |
6280 | } | 6306 | } |
6307 | m_justEditedTerrain = false; // Queue terrain packet (Land layer) if necessary, make it reliable again | ||
6281 | } | 6308 | } |
6282 | 6309 | ||
6283 | return true; | 6310 | return true; |