protected override float GetGroupPriority(int frameCountWithoutSync, MyClientStateBase client, PrioritySettings settings)
        {
            if (IsSlaveGrid())
                return 0;

            return base.GetGroupPriority(frameCountWithoutSync, client, settings);
        }
Example #2
0
        public FormSettings(EntityBox entityBox)
        {
            InitializeComponent();

            savedEntityBox = entityBox;

            propertyGridEntityBox.SelectedObject = entityBox;

            globalSettings = new GlobalSettings(entityBox);
            propertyGridGlobal.SelectedObject = globalSettings;

            colorSettings = new ColorSettings(entityBox);
            propertyGridColors.SelectedObject = colorSettings;

            prioritySettings = new PrioritySettings(entityBox);
            propertyGridPriority.SelectedObject = prioritySettings;

            opacitySettings = new OpacitySettings(entityBox);
            propertyGridOpacity.SelectedObject = opacitySettings;

            sizeSettings = new SizeSettings(entityBox);
            propertyGridSize.SelectedObject = sizeSettings;

            shapeSettings = new ShapeSettings(entityBox);
            propertyGridShape.SelectedObject = shapeSettings;
        }
        /// <summary>
        /// Gets priority scale and update rate based on prioritySettings.
        /// </summary>
        protected float GetMovementScale(PrioritySettings prioritySettings, out float updateOncePer)
        {
            float result;

            if (IsMoving(Entity))
            {
                m_lastMovementFrame = MyMultiplayer.Static.FrameCounter;
            }

            bool isStopped = (MyMultiplayer.Static.FrameCounter - m_lastMovementFrame) > prioritySettings.StopAfterUpdateCount;

            if (IsAccelerating)
            {
                updateOncePer = prioritySettings.AcceleratingUpdateCount;
                result        = prioritySettings.AcceleratingPriority;
            }
            else if (isStopped)
            {
                updateOncePer = prioritySettings.StoppedUpdateCount;
                result        = prioritySettings.StoppedPriority;
            }
            else
            {
                // Linearly moving or not moving and waiting for being stopped (StopAfterUpdateCount)
                updateOncePer = prioritySettings.LinearMovingUpdateCount;
                result        = prioritySettings.LinearMovingPriority;
            }
            return(result);
        }
        /// <summary>
        /// Gets priority scale and update rate based on prioritySettings.
        /// </summary>
        protected float GetMovementScale(PrioritySettings prioritySettings, out float updateOncePer)
        {
            float result;

            if (IsMoving(Entity))
            {
                m_lastMovementFrame = MyMultiplayer.Static.FrameCounter;
            }

            bool isStopped = (MyMultiplayer.Static.FrameCounter - m_lastMovementFrame) > prioritySettings.StopAfterUpdateCount;

            if (IsAccelerating)
            {
                updateOncePer = prioritySettings.AcceleratingUpdateCount;
                result        = prioritySettings.AcceleratingPriority;
            }
            else if (isStopped)
            {
                updateOncePer = prioritySettings.StoppedUpdateCount;
                result        = prioritySettings.StoppedPriority;
            }
            else
            {
                // Linearly moving or not moving and waiting for being stopped (StopAfterUpdateCount)
                updateOncePer = prioritySettings.LinearMovingUpdateCount;
                result        = prioritySettings.LinearMovingPriority;
            }

            if (MyFakes.NEW_POS_UPDATE_TIMING)
            {
                // Slower physics = more updates so clients have fluent object movement
                updateOncePer *= MyPhysics.SimulationRatio;
            }
            return(result);
        }
Example #5
0
        private void GradingQueue_Load(object sender, EventArgs e)
        {
            prioritySettings = new PrioritySettings();
            defaultPriority  = Properties.Settings.Default.DefaultPriority;
            //The checking the auto refresh will load the queue for the first time

            cbxAutoRefresh_CheckedChanged(this, e);
            //await RefreshQueue();
        }
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientStateBase client, PrioritySettings settings)
        {
            const float HighQualityDistance = 8; // under 8m, character physics sync gets high priority to have smooth movement

            var clientPos = ((MyClientState)client).Position;
            var characterPos = Entity.PositionComp.GetPosition();
            bool isHighQuality = Vector3D.DistanceSquared(clientPos, characterPos) < HighQualityDistance * HighQualityDistance;
            isHighQuality = isHighQuality && !Entity.IsDead;

            return base.GetGroupPriority(frameCountWithoutSync, client, isHighQuality ? m_highQuality : settings);
        }
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            const float HighQualityDistance = 8; // under 8m, character physics sync gets high priority to have smooth movement

            if (ResponsibleForUpdate(Entity, client.EndpointId))
            {
                return 0.0f;
            }
            var clientPos = ((MyClientState)client.State).Position;
            var characterPos = Entity.PositionComp.GetPosition();
            bool isHighQuality = Vector3D.DistanceSquared(clientPos, characterPos) < HighQualityDistance * HighQualityDistance;
            isHighQuality = isHighQuality && !Entity.IsDead;

            var priority = base.GetGroupPriority(frameCountWithoutSync, client, isHighQuality ? m_highQuality : settings);
            return priority;
        }
        /// <summary>
        /// Gets priority scale and update rate based on prioritySettings.
        /// </summary>
        protected float GetMovementScale(PrioritySettings prioritySettings, out float updateOncePer)
        {
            float result;

            var sync = (MySyncEntity)Entity.SyncObject;
            if(sync.IsMoving)
            {
                m_lastMovementFrame = MyMultiplayer.Static.FrameCounter;
            }

            bool isStopped = (MyMultiplayer.Static.FrameCounter - m_lastMovementFrame) > prioritySettings.StopAfterUpdateCount;
            
            if(sync.IsAccelerating)
            {
                updateOncePer = prioritySettings.AcceleratingUpdateCount;
                result = prioritySettings.AcceleratingPriority;
            }
            else if(isStopped)
            {
                updateOncePer = prioritySettings.StoppedUpdateCount;
                result = prioritySettings.StoppedPriority;
            }
            else
            {
                // Linearly moving or not moving and waiting for being stopped (StopAfterUpdateCount)
                updateOncePer = prioritySettings.LinearMovingUpdateCount;
                result = prioritySettings.LinearMovingPriority;
            }

            if (MyFakes.NEW_POS_UPDATE_TIMING)
            {
                // Slower physics = more updates so clients have fluent object movement
                updateOncePer *= MyPhysics.SimulationRatio;
            }
            return result;
        }
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            if (Entity.MarkedForClose)
            {
                return 0.0f;
            }

            if (Entity != GetMasterGrid(Entity))
                return 0;

            return base.GetGroupPriority(frameCountWithoutSync, client, settings);
        }
Example #10
0
        protected virtual float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            float priority = GetBasicPhysicsPriority(client);
            if (priority <= 0)
                return 0;

            float updateFrameCount;
            priority *= GetMovementScale(settings, out updateFrameCount);
            
            return MyReplicationHelpers.RampPriority(priority, frameCountWithoutSync, updateFrameCount);
        }
Example #11
0
        public static void SaveSettings(EntityBox entityBox)
        {
            Properties.Settings settings = Properties.Settings.Default;

            /// Save global settings

            GlobalSettings global = new GlobalSettings(entityBox);

            settings.SelectEntitiesAfterAdd = global.SelectEntitiesAfterAdd;
            settings.Grayscale         = global.Grayscale;
            settings.Lambda            = global.Lambda;
            settings.LockScroll0       = global.LockScroll0;
            settings.LockScroll1       = global.LockScroll1;
            settings.LockScroll2       = global.LockScroll2;
            settings.LockZoom0         = global.LockZoom0;
            settings.LockZoom1         = global.LockZoom1;
            settings.LockZoom2         = global.LockZoom2;
            settings.HideGrid          = global.HideGrid;
            settings.HideLambdaMetrics = global.HideLambdaMetrics;
            settings.CellTextAlignment = (int)global.CellTextAlignment;
            settings.ViasTextAlignment = (int)global.ViasTextAlignment;
            settings.WireTextAlignment = (int)global.WireTextAlignment;

            /// Save color settings
            ///

            ColorSettings color = new ColorSettings(entityBox);

            settings.SelectionBoxColor     = color.SelectionBoxColor;
            settings.ViasInputColor        = color.ViasInputColor;
            settings.ViasOutputColor       = color.ViasOutputColor;
            settings.ViasInoutColor        = color.ViasInoutColor;
            settings.ViasConnectColor      = color.ViasConnectColor;
            settings.ViasFloatingColor     = color.ViasFloatingColor;
            settings.ViasPowerColor        = color.ViasPowerColor;
            settings.ViasGroundColor       = color.ViasGroundColor;
            settings.WireInterconnectColor = color.WireInterconnectColor;
            settings.WirePowerColor        = color.WirePowerColor;
            settings.WireGroundColor       = color.WireGroundColor;
            settings.CellNotColor          = color.CellNotColor;
            settings.CellBufferColor       = color.CellBufferColor;
            settings.CellMuxColor          = color.CellMuxColor;
            settings.CellLogicColor        = color.CellLogicColor;
            settings.CellAdderColor        = color.CellAdderColor;
            settings.CellBusSuppColor      = color.CellBusSuppColor;
            settings.CellFlipFlopColor     = color.CellFlipFlopColor;
            settings.CellLatchColor        = color.CellLatchColor;
            settings.CellOtherColor        = color.CellOtherColor;
            settings.UnitRegfileColor      = color.UnitRegfileColor;
            settings.UnitMemoryColor       = color.UnitMemoryColor;
            settings.UnitCustomColor       = color.UnitCustomColor;
            settings.SelectionColor        = color.SelectionColor;
            settings.ViasOverrideColor     = color.ViasOverrideColor;
            settings.WireOverrideColor     = color.WireOverrideColor;
            settings.CellOverrideColor     = color.CellOverrideColor;
            settings.RegionOverrideColor   = color.RegionOverrideColor;

            /// Save priority settings
            ///

            PrioritySettings priority = new PrioritySettings(entityBox);

            settings.ViasPriority   = priority.ViasPriority;
            settings.WirePriority   = priority.WirePriority;
            settings.CellPriority   = priority.CellPriority;
            settings.BeaconPriority = priority.BeaconPriority;
            settings.RegionPriority = priority.RegionPriority;
            settings.AutoPriority   = priority.AutoPriority;

            /// Save opacity settings
            ///

            OpacitySettings opacity = new OpacitySettings(entityBox);

            settings.ViasOpacity = opacity.ViasOpacity;
            settings.WireOpacity = opacity.WireOpacity;
            settings.CellOpacity = opacity.CellOpacity;

            /// Save shape settings
            ///

            ShapeSettings shape = new ShapeSettings(entityBox);

            settings.ViasShape = (int)shape.ViasShape;

            settings.Save();
        }
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            if (Entity.MarkedForClose)
            {
                return 0.0f;
            }

            if (Entity != GetMasterGrid(Entity))
                return 0;

            //support has allways high priority
            if (client.State.SupportId.HasValue && client.State.SupportId.Value == Entity.EntityId && IsMoving(Entity))
            {
                return 1000.0f;
            }
            return base.GetGroupPriority(frameCountWithoutSync, client, settings);
        }
Example #13
0
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientStateBase client, PrioritySettings settings)
        {
            if (IsSlaveGrid())
            {
                return(0);
            }

            return(base.GetGroupPriority(frameCountWithoutSync, client, settings));
        }
Example #14
0
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            const float HighQualityDistance = 8; // under 8m, character physics sync gets high priority to have smooth movement

            if (ResponsibleForUpdate(Entity, client.EndpointId))
            {
                return(0.0f);
            }
            var  clientPos     = ((MyClientState)client.State).Position;
            var  characterPos  = Entity.PositionComp.GetPosition();
            bool isHighQuality = Vector3D.DistanceSquared(clientPos, characterPos) < HighQualityDistance * HighQualityDistance;

            isHighQuality = isHighQuality && !Entity.IsDead;

            var priority = base.GetGroupPriority(frameCountWithoutSync, client, isHighQuality ? m_highQuality : settings);

            return(priority);
        }
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            if (Entity.MarkedForClose)
            {
                return(0.0f);
            }

            if (Entity != GetMasterGrid(Entity))
            {
                return(0);
            }

            return(base.GetGroupPriority(frameCountWithoutSync, client, settings));
        }
Example #16
0
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientStateBase client, PrioritySettings settings)
        {
            const float HighQualityDistance = 8; // under 8m, character physics sync gets high priority to have smooth movement

            var  clientPos     = ((MyClientState)client).Position;
            var  characterPos  = Entity.PositionComp.GetPosition();
            bool isHighQuality = Vector3D.DistanceSquared(clientPos, characterPos) < HighQualityDistance * HighQualityDistance;

            isHighQuality = isHighQuality && !Entity.IsDead;

            return(base.GetGroupPriority(frameCountWithoutSync, client, isHighQuality ? m_highQuality : settings));
        }
        protected virtual float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            float priority = GetBasicPhysicsPriority(client);

            if (priority <= 0)
            {
                return(0);
            }

            float updateFrameCount;

            priority *= GetMovementScale(settings, out updateFrameCount);

            return(MyReplicationHelpers.RampPriority(priority, frameCountWithoutSync, updateFrameCount));
        }
Example #18
0
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            if (Entity.MarkedForClose)
            {
                return(0.0f);
            }

            if (Entity != GetMasterGrid(Entity))
            {
                return(0);
            }

            //support has allways high priority
            if (client.State.SupportId.HasValue && client.State.SupportId.Value == Entity.EntityId && IsMoving(Entity))
            {
                return(1000.0f);
            }
            return(base.GetGroupPriority(frameCountWithoutSync, client, settings));
        }
Example #19
0
        protected override float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            ProfilerShort.Begin("MyCharacterPhysicsStateGroup::GetGroupPriority");
            const float highQualityDistance = 20; // under 8m, character physics sync gets high priority to have smooth movement

            MyMultiplayer.GetReplicationServer().AddToDirtyGroups(this);

            if (ResponsibleForUpdate(Entity, client.EndpointId))
            {
                if (client.PriorityMultiplier >= 1.0f)
                {
                    ProfilerShort.End();
                    return(1000.0f);
                }
            }

            var  clientPos     = ((MyClientState)client.State).Position;
            var  characterPos  = Entity.PositionComp.GetPosition();
            bool isHighQuality = Vector3D.DistanceSquared(clientPos, characterPos) < highQualityDistance * highQualityDistance;

            var priority = base.GetGroupPriority(frameCountWithoutSync, client, isHighQuality ? m_highQuality : settings);

            ProfilerShort.End();
            return(priority);
        }
        protected virtual float GetGroupPriority(int frameCountWithoutSync, MyClientInfo client, PrioritySettings settings)
        {
            if (Entity.MarkedForClose)
            {
                return(0);
            }

            ProfilerShort.Begin("MyEntityPhysicsStateGroup::GetGroupPriority");
            float updateFrameCount;
            float priority;

            if (ResponsibleForUpdate(Entity, client.EndpointId))
            {
                if (client.PriorityMultiplier < 1.0f)
                {
                    priority         = 1.0f;
                    updateFrameCount = 1.0f;
                }
                else
                {
                    ProfilerShort.End();
                    return(1000);
                }
            }
            else
            {
                priority = GetBasicPhysicsPriority(client);
                if (priority <= 0)
                {
                    ProfilerShort.End();
                    return(0);
                }

                priority *= GetMovementScale(settings, out updateFrameCount);
            }
            if (client.PriorityMultiplier > 0)
            {
                updateFrameCount /= client.PriorityMultiplier;
            }
            else
            {
                ProfilerShort.End();
                return(0);
            }

            float adjustedPriority = MyReplicationHelpers.RampPriority(priority, frameCountWithoutSync, updateFrameCount);

            ProfilerShort.End();
            return(adjustedPriority);
        }
Example #21
0
 private void GradingQueue_Load(object sender, EventArgs e)
 {
     prioritySettings = new PrioritySettings();
     defaultPriority  = Properties.Settings.Default.DefaultPriority;
 }