Jump to content

Recommended Posts

Hello everyone, especially DroidZ!

How works subj under the hood? It used for like Usefuls.Latency => return Random(LatencyMin, LatencyMax) or Thread.Sleep(Random(LatencyMin, LatencyMax)) or smth?

If Engine.StartEngine method has default 16fps framerate, so LatencyMax should be less than 625ms ?

I want to understand, how to tune LatencyMin & Engine.framerate for lower CPU using, meanwhile fighting with lowest latency between hits.

Link to comment
https://wrobot.eu/forums/topic/14716-latencyminlatencymax/
Share on other sites

Hello,

It's more for network latency than the delay to interact with the game. In the bot, before/after action, I generally use code like "Sleep(Usefuls.Latency + XXms)".

Actual code used to get "Latency" :

        /// <summary>
        /// Gets the latency (between <see cref="wManagerSetting.LatencyMax"/> and <see cref="wManagerSetting.LatencyMin"/>, to get real latency use <see cref="LatencyReal"/>).
        /// </summary>
        /// <value>The latency.</value>
        public static int Latency
        {
            get
            {
                lock (_lockLatency)
                {
                    try
                    {
                        var real = LatencyReal;

                        if (real > wManagerSetting.CurrentSetting.LatencyMax)
                            real = wManagerSetting.CurrentSetting.LatencyMax;
                        if (real < wManagerSetting.CurrentSetting.LatencyMin)
                            real = wManagerSetting.CurrentSetting.LatencyMin;

                        return real;
                    }
                    catch (Exception e)
                    {
                        Logging.WriteError("Latency: " + e);
                        return 0;
                    }
                }
            }
        }

        private static readonly Object _lockLatencyReal = new Object();
        /// <summary>
        /// Gets the real latency (home+world)).
        /// </summary>
        /// <value>The real latency.</value>
        public static int LatencyReal
        {
            get
            {
                lock (_lockLatencyReal)
                {
                    try
                    {
                        if (!_timerLatency.IsReady || !Conditions.InGameAndConnectedAndAlive)
                            return _lastLatency;

                        _timerLatency = new Timer(30 * 1000);
                        var result = Lua.LuaDoString<int>("local _, _, lag = GetNetStats(); return lag;");
                        if (result > 0)
                            _lastLatency = result;
                        return _lastLatency;
                    }
                    catch (Exception e)
                    {
                        Logging.WriteError("LatencyReal: " + e);
                        return 0;
                    }
                }
            }
        }

 

Link to comment
https://wrobot.eu/forums/topic/14716-latencyminlatencymax/#findComment-66464
Share on other sites

You can use low FPS in game. But you need to use optimised fightclass/plugins/profile (try to call lua codes between lock/unlockframe)

You can also change settings :

https://wrobot.eu/byme/doc/html/F-wManager.wManagerSetting.ReadObjectManagerFTS.htm

https://wrobot.eu/byme/doc/html/F-robotManager.MemoryClass.Hook.SleepTimeWaitCalled.htm

https://wrobot.eu/byme/doc/html/F-wManager.wManagerSetting.EventsLuaWithArgsWaitTime.htm

And use code like 

robotManager.Events.FiniteStateMachineEvents.OnAfterRunState += (engine, state) => { Thread.Sleep(10); };

 

Link to comment
https://wrobot.eu/forums/topic/14716-latencyminlatencymax/#findComment-66468
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...