Matenia 628 Posted January 28, 2019 Share Posted January 28, 2019 Hey Droidz, I noticed sometimes ObjectManager is updated while I iterate it in my rotation. If I use a lot of checks on units in the ObjectManager, it can slow down my rotations a lot. Sometimes iterations jump from 50ms to 500ms ("randomly") I noticed especially on TBC, this is because the ObjectManager in game gets huuuuge and wRobot takes a "long" time on every update. I noticed (I think) ObjectManager gets locked during these updates and the lock makes my thread wait. Sometimes, this lock can happen two or three times during one iteration, if I get unlucky. One way to prevent this would be to deepcopy the entire ObjectManager (or use my own implementation, reading directly from memory with wRobot API). Both of this would be a loooot of work. Therefore I have a question, something that would be way easier: Can I stop ObjectManager from behind updated manually? Pseudo code here: ObjectManager.DisablesUpdates(); for(spell in spells) { if(spell.AllConditionsTrue()) { spell.Cast(); break; } } ObjectManager.EnableUpdates(); Link to comment https://wrobot.eu/forums/topic/10727-stop-objectmanager-updates/ Share on other sites More sharing options...
Droidz 2738 Posted January 28, 2019 Share Posted January 28, 2019 Hello, In next update lock object will be public (wManager.Wow.ObjectManager.ObjectManager.Locker) But it is hard to tell if it is the problem, you lock wow frame when you run this code (wManager.Wow.Memory.WowMemory.LockFrame();)? (500ms seem a lot to refresh objectmanager), you can try to use program like JetBrains dotTrace to check. And I think the best for you is to request object list one time like: Quote try { wManager.Wow.Memory.WowMemory.LockFrame(); var units = ObjectManager.GetObjectWoWUnit(); var players = ObjectManager.GetObjectWoWPlayer(); for (spell in spells) { if (spell.AllConditionsTrue(ref units, ref player)) { spell.Cast(); break; } } } catch (Exception e) { } finally { wManager.Wow.Memory.WowMemory.UnlockFrame(); } Link to comment https://wrobot.eu/forums/topic/10727-stop-objectmanager-updates/#findComment-51151 Share on other sites More sharing options...
Matenia 628 Posted January 28, 2019 Author Share Posted January 28, 2019 I was locking frames before, that's why it confused me, that sometimes iterations took 400ms+. Currently rewriting my rotation framework for TBC. Will try locking frames again and let you know. I think storing all units by reference is a good idea. I will look into that. If I still have any problems after next update, I will get back to you. Thanks! Link to comment https://wrobot.eu/forums/topic/10727-stop-objectmanager-updates/#findComment-51155 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