Weer36 3 Posted August 14, 2022 Share Posted August 14, 2022 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 More sharing options...
Droidz 2738 Posted August 15, 2022 Share Posted August 15, 2022 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 More sharing options...
Weer36 3 Posted August 16, 2022 Author Share Posted August 16, 2022 So the only option for lower CPU consuming is engine's framerate ? Besides ingame performance Link to comment https://wrobot.eu/forums/topic/14716-latencyminlatencymax/#findComment-66467 Share on other sites More sharing options...
Droidz 2738 Posted August 16, 2022 Share Posted August 16, 2022 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 More sharing options...
Weer36 3 Posted August 17, 2022 Author Share Posted August 17, 2022 What is default values of them ? Link to comment https://wrobot.eu/forums/topic/14716-latencyminlatencymax/#findComment-66471 Share on other sites More sharing options...
Weer36 3 Posted August 17, 2022 Author Share Posted August 17, 2022 What is default values of them ? - nvm, I can read it )) What for engine.framerate then? Link to comment https://wrobot.eu/forums/topic/14716-latencyminlatencymax/#findComment-66472 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now