Speed-ups and slow-downs


#1

Sometimes my code runs hyper-fast, sometimes it crawls and recovers, sometimes it stutters and crawls until it crashes. I play on Chrome, desktop is an i5 clocked at 4.3ghz 8gb memory, and laptop is i5 1.7 with 8gb ram.

At the moment I can’t seem to work on Summits Gate because my guys stutter around a little while, then everything goes turbo and seems to jump forward in time and I die. All seemed to be working well with this earlier today. Sometimes I just have to quit because nothing will run fast enough.

If some of my code is jamming it up, is there a way to find that other than trial and error?

If it’s slowness from the server, is there a way to tell which is which? me or it?


#2

Have you other tabs with CodeCombat open? If so it can (but don’t have to) slow your game down to a crawl. Even more when in one of then you have the Flower Ring equipped.


#3

The only other tabs I ever have open while playing are the main page and maybe a google search or this forum. I did notice that the flower ring slows things down.

More experimentation is starting to look like there are big problems with the spells SUMMON-UNDEAD and RAISE-DEAD. I came across another forum post of mine about i think Lost in the Dunes where it would freeze at the end. I did it without these spells the level was finishable.

I’m trying this one without those now but I can’t say whether removing them is causing it to run well today or if it’s just one of those times where it performs inconsistently.

I like to create hordes of the undead to do all of my fighting, but it’s hard to believe that 20-30 codecombat zombies are bogging down a machine that just finished playing through the likes of The Witcher 3 on high settings? Or is this that mythical “optimization” that so many people complain about in various games?


#4

Often times, the inefficient part will come either from running a lot of slow player code (which we have to make several times slower in order to make it yield control back to the game engine, instrument performance, handle errors, etc.) or from serializing updates from the worker thread to the main thread. CodeCombat simulates the level’s execution independently of playback speed, so usually we try to finish simulating a level that takes 60 seconds in about 2 seconds, and the streaming works fine. But sometimes on crazy levels when performance is bad, simulating actually goes slower than streaming–often because there are is so much data about where everything is and what it’s doing that can’t be super efficiently transferred because it’s a web browser with an imperfect concurrency model. (Whereas in The Witcher 3, you only run in real-time, there is no serialization needed, player input is very simple instead of possibly slow-running code, and you can optimize the crap out of your multi-processor performance to run graphics on graphics card, physics on one core, AI on another core, the rest of the game on a third core, etc.)

Then there are always places where we have introduced code in our game engine that’s just stupid slow, haha, like the Ring of Flowers. Possibly raise-dead is doing something similarly dumb and it just needs optimization.

Stranded in the Dunes is a particularly challenging level because of how long the level lasts–several minutes–and how many things there are (because it’s not just about serializing the data of what’s on the screen but also about serializing the full history of every unit that every existed in the level. Kevin likes to make these super challenge levels that make hardware bleed. Summit’s Gate is my fault, sorry. Makes it very hard to use flags in those levels, I know.

We’ll keep working on it, but you might want to skip the undead hordes for now if the performance is too bad to beat a particular challenge level.


#5

Thanks for the thorough reply. Makes sense. Working on how to do this now without my trusty horde to hide behind…