MUST READ - World Map Loading Slowdown

    Joined Sep 2014 Posts: 22
    that because about last mantenaice  from kixeye thats why who coin start be boring about that you guys think not ?

  • CharlesHackfinder
    Minor Nuisance
    Joined May 2016 Posts: 241
    Maybe this would explain my other post......
    And why I was getting massive lag and lagged popups when my base was loading after it had been attacked....
    I may be a Low Level...But Im definitely not new :-)
  • virginiagolding
    Potential Threat
    Joined Mar 2018 Posts: 42

    Welcome the latest installment in Friendly Fixer's Must Read series. We haven't spoken in a while. How are you? I'm great. This is a format that I've used internally for a while now and thought I'd open it up to the community, as well. So, today I bring you an explanation on what happened to our World Map loading times. At some time on Wednesday or Thursday, transitioning to the world map started taking 45+ seconds instead of 1 or 2. 

    (Since you are new to this, I'll explain the format. There is a MUST READ section that is kept to the point, followed by a MAYBE READ section where I expand/explain/brag a bit. Enjoy.)

    • Wednesday we deployed as usual. 
    • We discovered our throttle no longer works as intended. 
      • We could let in everyone, or no one.
    • We were experiencing greater than average load on our mysql databases.
      • We 'pulsed' the throttle to avoid crippling load.
    • As a result the deploy was 'messy'.
    • Players began complaining of world map loading times.
    • We assumed this was from the DB load
    • Fast forward to Thursday. At this point the team starts noticing that ALL our development environments were loading slowly.
    After much investigation, it has been determined to be caused by a change in the Flash Player plugin, which was released on June 6th and 7th. 
    Adobe put out a security update to the flash player that bumped it up a major version number, from 29 to 30. This was to mitigate two things:
    • A security flaw in Microsoft Office embedded flash content
    • Security flaws due to Spectre/Meltdown
    • As part of this work Adobe changed the 'getTimer()' function at a low level. 
      • This is a core flash API function that we use for timing data. It is the closest thing to a high resolution timer that flash has and is EXTREMELY common for people to use. 
      • It's performance cost was increased at least 100 times

    We have a tight loop that iterates over all 250 thousand hex map cells and populates them based on a server defined height map. This is to place mountains and other features into each hex map cell. This naturally takes a bit to process so it is deferred over several frames.

    The exact mechanism to do this is a loop that has a counter into the server sent byte array. Each iteration through the loop processes exactly one hex map cell and reads one byte from the array. It then checks how long it has been since we started the loop. If that time goes over a defined threshold, which is 25 milliseconds, it breaks out of the loop. If we are not done loading yet, the next frame tick will go back into the loop and pick up where it left off, controlled by that index counter.

    The problem is that we are effectively calling getTimer() 250 thousand times. In flash player version 29 the algorithm could handle 6 thousand or more iterations per 25 millisecond time slice. In the latest flash player this dropped to 300 or less. Understandably this took a LOT longer to process world map data.

    I fixed it with a bit of a bodgy hack. Instead of calling getTimer EVERY iteration, I do it only every 1000. This means we only call it 250 times and process roughly 5 thousand per 25 ms. Much better. Also, simple and fast to get out to you guys!


    There are other places in our code where we call getTimer and I will be evaluating our use. In the meantime we will be deploying this fix later today. It is a flash client only deploy and does not require down time. It might however require you to delete your cache, or at least delete the game's SWF from your cache. This shouldn't matter since we invalidate the game's SWF in our cloud storage, but I can't control browser's caching strategies.

    Until next time!

    (If you want to see Adobe's comments on this:
    Ok now say all that again in non tech talk for us old farts who just want the basics lol
  • drag0nsun
    Master Tactician
    Joined Jun 2014 Posts: 2,407
    i am no tech guy but the way i understand it you are saying there was something in flash that was off ( not turned off just a bit off on its stuff )  so you had to update that without the need for a downtime but to get things working for the player they need to clear out their cookies CACHE ect ect   after you did this update  and no i do not need to lisen to my music news ect everyday but it does help pass the time when i am doing minor stuff in the game 
  • K-A-O-S-1
    Joined May 2016 Posts: 7
    i am having major problems with the game, since the facebook fiasco, i have not been able to load or save, i keep getting dc'd and kicked out of gamei have tried everything even paid my internet company to come and check all the system from top to bottom, i even done a full factory reset on my laptop, untill last week i was just getting normal lag, now i can't even play the game....
  • it will fitz
    it will fitz
    Force to be Reckoned With
    Joined Feb 2013 Posts: 1,934
    glad you pulled up a year old thread

    but ... have you really tried to clear your Flash files and real cache cleaning ....

    they are both different things

    and Neither will clear fully on a browser refresh (even if you have it set to clear on shut down)
  • K-A-O-S-1
    Joined May 2016 Posts: 7
    glad you pulled up a year old thread

    but ... have you really tried to clear your Flash files and real cache cleaning ....

    they are both different things

    and Neither will clear fully on a browser refresh (even if you have it set to clear on shut down)

  • K-A-O-S-1
    Joined May 2016 Posts: 7
    im glad that ur glad, and yes i have cleared the real cache and took away the old flash, as a matter of fact since my post i have actually formatted my laptop not just a clean up but a full format and done all new updates, and downloads, but im still having the same issues, also after talking with other players it seems im not the only 1 
This discussion has been closed.