Reported Village Loading Delay

  • Thread starter DeletedUser2007
  • Start date

DeletedUser2007

Guest
Since v1.12 there seems to be a village loading delay caused by the listener of the ContextMenuController listening to the Internal/Village/loaded event which triggers the init function of the ContextMenuController every time you switch villages. Due to some re-init code related to the map drawing, a small hiccup or delay of ~2 seconds can be noticed.
 

DeletedUser2007

Guest
One of the things that happen in that init function is the registration of a callback function for the MAPVIEW_UPDATE event, as this callback is simply pushed to the back of the list an additional (unnecessary!) callback is added each time you switch villages. Potentially this could cause a slowdown or delay as the same callback function is called multiple times, executing the same code multiple times where the amount of times it executes depends on how many times you've switched villages.

Possibly a call to initVillageMenu or initMapMenu cause the slowdown as those functions seem to be doing some additional loading of information that is likely already available or actually no longer required at that point.

Just calling the init function again when a village has finishED, past-tense, has already happend, loading causes the delay and isn't even needed as the context menu is closed/closes when switching villages or when a village is loaded. The only point where something might need to be re-initialized after a village has finished loading is when the player switched villages without using the context menu to switch villages (e.g. hotkeys) at which point you could fire a different event (broadcast) or call a different function to indicate this.
 

DeletedUser2007

Guest
After extensive research today I have found where the actual delay comes from.

To start off, simply disregard all the above, as it doesn't cause the delay at all.

What causes the delay is the emitting of the CHAT_GET_TRIBE_HISTORY. This occurs every time when a player changes village due to the fact that there is a listener to the 'DONE' event, which is also broadcast whenever a village has been loaded.
The reload of the chat history isn't needed in the first place, as it is already loaded and additional new messages are received in a different way.

A solution for this problem is to change the 'DONE' event, or simply add a boolean to check if chat history was already loaded or not, if not, it should emit the request, otherwise it should simply do nothing at all.
 

DeletedUser1993

Guest
i have been experiencing one issue which could be related. when i cycle through my villages to retrain the spies, sometimes the screen shows i'm starting the training of spy #1 in village N, while in fact my click goes to the previous village and it turns i'm queueing spy #5 in village N-1
that's quite irritating, as the only way to find out the problem is to cycle through the villages one more time to double check, which is quite time-consuming
 

DeletedUser40

Guest
The issue have been reported to our developers.
Thanks for sharing your findings and possible fixes with us. It is much appreciated.
 

DeletedUser2007

Guest
i have been experiencing one issue which could be related. when i cycle through my villages to retrain the spies, sometimes the screen shows i'm starting the training of spy #1 in village N, while in fact my click goes to the previous village and it turns i'm queueing spy #5 in village N-1
that's quite irritating, as the only way to find out the problem is to cycle through the villages one more time to double check, which is quite time-consuming

I assume this issue is the consequence of the village loading delay where, due to the delay and freezing caused by the chat history loading when switching villages, you assume you've switched village but actually are still in the previous village due to the delay and click the recruit button which triggers the recruiting for that 5th spy in that previous village. Perhaps you should wait until the devs fix this, or try my chrome extension to temporary fix it and check if this issue still exists or if it's resolved.
 
Top