* Re-Adding Scene TimeDilation to Object Update Packets.
* Added Calculating Time Dilation in the OdePlubin * When multiple object updates are stuffed into one packet, average the time dilation between them as a compromise. * Time Dilation on the update is calculated when the EntityUpdate object is created. The pre-calc-ed TD is stored in the Entity update and used when it goes out on the wire. Previously, it was 1.0 all the time. The time dilation is tied to when the update is created, not when the update is sent.viewer-2-initial-appearance
parent
862da9a55f
commit
46db73b62b
|
@ -574,11 +574,13 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public ISceneEntity Entity;
|
||||
public PrimUpdateFlags Flags;
|
||||
public float TimeDilation;
|
||||
|
||||
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags)
|
||||
public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
|
||||
{
|
||||
Entity = entity;
|
||||
Flags = flags;
|
||||
TimeDilation = timedilation;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3554,7 +3554,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
|
||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId);
|
||||
}
|
||||
|
||||
private void ProcessEntityUpdates(int maxUpdates)
|
||||
|
@ -3570,14 +3570,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
|
||||
// condition where a kill can be processed before an out-of-date update for the same object.
|
||||
lock (m_killRecord)
|
||||
{
|
||||
{
|
||||
float avgTimeDilation = 1.0f;
|
||||
EntityUpdate update;
|
||||
while (updatesThisCall < maxUpdates)
|
||||
{
|
||||
lock (m_entityUpdates.SyncRoot)
|
||||
if (!m_entityUpdates.TryDequeue(out update))
|
||||
break;
|
||||
|
||||
avgTimeDilation += update.TimeDilation;
|
||||
avgTimeDilation *= 0.5f;
|
||||
|
||||
if (update.Entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart part = (SceneObjectPart)update.Entity;
|
||||
|
@ -3725,8 +3728,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
#region Packet Sending
|
||||
|
||||
const float TIME_DILATION = 1.0f;
|
||||
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
|
||||
//const float TIME_DILATION = 1.0f;
|
||||
|
||||
|
||||
ushort timeDilation = Utils.FloatToUInt16(avgTimeDilation, 0.0f, 1.0f);
|
||||
|
||||
if (terseAgentUpdateBlocks.IsValueCreated)
|
||||
{
|
||||
|
@ -3739,7 +3744,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
for (int i = 0; i < blocks.Count; i++)
|
||||
packet.ObjectData[i] = blocks[i];
|
||||
|
||||
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Unknown, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -287,6 +287,9 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
private OdePrim cp1;
|
||||
private OdeCharacter cc2;
|
||||
private OdePrim cp2;
|
||||
private int tickCountFrameRun;
|
||||
|
||||
private int latertickcount=0;
|
||||
//private int cStartStop = 0;
|
||||
//private string cDictKey = "";
|
||||
|
||||
|
@ -3123,6 +3126,22 @@ namespace OpenSim.Region.Physics.OdePlugin
|
|||
}
|
||||
d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
|
||||
}
|
||||
latertickcount = Util.EnvironmentTickCount() - tickCountFrameRun;
|
||||
|
||||
// OpenSimulator above does 10 fps. 10 fps = means that the main thread loop and physics
|
||||
// has a max of 100 ms to run theoretically.
|
||||
// If the main loop stalls, it calls Simulate later which makes the tick count ms larger.
|
||||
// If Physics stalls, it takes longer which makes the tick count ms larger.
|
||||
|
||||
if (latertickcount < 100)
|
||||
m_timeDilation = 1.0f;
|
||||
else
|
||||
{
|
||||
m_timeDilation = 100f / latertickcount;
|
||||
//m_timeDilation = Math.Min((Math.Max(100 - (Util.EnvironmentTickCount() - tickCountFrameRun), 1) / 100f), 1.0f);
|
||||
}
|
||||
|
||||
tickCountFrameRun = Util.EnvironmentTickCount();
|
||||
}
|
||||
|
||||
return fps;
|
||||
|
|
Loading…
Reference in New Issue