Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Game is very laggy/slow?

Yeah, that’s the latest version. Okay, I’ll focus on Firefox.

I don’t really know what you mean, if the level editor is giving you some problem apart from just being slow.

level editor output:
“The initial code to build the world never finished running. It’s
probably either really slow or has an infinite loop. Or there might be a
bug. You can either try running this code again or reset the code to
the default state. If that doesn’t fix it, please let us know.”

it sounds like a programming mistage to me, but ive created a new random world and noticed, that after generating some terrain i couldnt load the game anymore.
error is shown after the voice said “Code Combat”.

i’ve testet chrome for a while now. no Problems. Should be a problem with Firefox.

I’m also having issues with the game being very laggy, making interactive levels like Deadly Dungeon Rescue practically impossible to solve with flags.

I’m running the game in Chrome 40.0.2214.115 on openSUSE 13.2. My computer has a 6-core Phenom II CPU running at 3.12 GHz, 16 GB RAM, and a GTX 560 GPU. I have the proprietary nvidia driver installed (version 340.76) and everything’s 64-bit, so the hardware’s full power is available to CodeCombat.

When I submit my code in Deadly Dungeon Rescue, Chrome’s process for the CodeCombat tab runs at about 150% CPU and the “GPU Process” tab runs at about 50% CPU. Memory and GPU usage are less stable.

When I first submit and run the level, it runs smoothly for the first minute or so, with Ctrl+\ showing a relatively stable 20-40 fps. Also, it takes about 1 GB RAM usage and the NVIDIA X Server Settings program shows about 5-10% GPU processing and 0.5/1 GB graphics memory used.

After about a minute, there are extreme lag spikes where it alternates between being “frozen” (claims to be running at about 20-30 fps and animations still run smoothly, but time has stopped and nothing changes position) and “catching up” (claims to run at about 3-6 fps while even animations are frozen, and then it suddenly jumps ahead several seconds). Also, the CodeCombat tab goes up to about 1.3 GB RAM and the GPU’s processing rises to about 15-20% with about 0.55 GB VRAM used.

Submitting again brings the tab’s memory up to about 2 GB when it’s focused and 1.5 GB when it’s unfocused, with GPU utilization of about 30-55% when the tab is focused and 5-15% when the tab is unfocused. The stuttering happens like before, only much sooner and more often.

Repeated submissions seem the same, only they keep lagging sooner and worse and using more and more memory. Changing the game window to a smaller size doesn’t seem to change anything.

One more thing I noticed is that repeatedly placing a flag when the game is lagging causes the game to skip removing the old copy.

Two things that could be going wrong is maybe you have other cpu intensive things going on on your concection of you might be having problems because you are far away from the codecombat uh…“fortress”

My computer’s total CPU usage was under 300% out of a maximum of 600% (100% = all of one core, so 300% is half of the 6-core CPU’s total processing), so it’s not CPU usage. Over half of my computer’s 16 GB RAM was unused, not even caching recently-accessed files (so literally every file touched since bootup was cached, including whatever local storage CodeCombat might rely upon). Combined with the GPU usage numbers reported by NVIDIA X Server Settings, I’m pretty sure this means my computer could throw at least twice as many computational resources at CodeCombat, if that were the issue.

It may be Internet problems, though the first stuttering happens rather consistantly after about a minute into submitting/playing the level. To test my computer’s connection to the “fortress”, I ran ping -c 100 in a console and found these results:

  • 42 packets were echoed back in 83.8 to 84.9 ms
  • 40 packets took 85 to 88.1 ms
  • 15 packets took 90.1 to 98.6 ms
  • 1 packet took 104 ms
  • 1 packat took 1518 ms
  • 1 packet was lost
    I know that’s not the best connection. However, shouldn’t the underlying network protocol have some sort of “if the response takes a couple standard deviations longer than average, try again” heuristic somewhere? I don’t understand networking, so I may be far off target.

Thanks for the detailed debugging info, sampla. It sounds like it’s 1) a memory leak plus 2) something in the level (or your code) that takes a long time to simulate, leading to stuttering when it simulates a few more frames and sends them over. Is your algorithm complicated, or might it be doing a lot of looping in certain cases? Otherwise, I wonder if there is something in the Deadly Dungeon Rescue level that can get performance-intensive that happens after a minute.

Certainly the memory leak will have to be solved either way. Just wondering if you see similar leak problems in other levels, or whether you see the leaks even with the simplest possible Deadly Dungeon Rescue algorithm.

i could use some advice please.

Don’t spit into the wind.

There you have gotten some advice…

Want some more? Be more specific when asking for help. :slight_smile:

What do you think of adding a option to downscale the details?

Could that help?

Its really annoying to play difficult levels and the main challenge is to get the level running.

When levels are big and bad, this issue is a problem for me too. I am using a MacBook Air.
The two levels Mountain Flower Grove and Zero Sum are WAY TOO LAGGY! In Zero Sum, I have to wait for a long time when I type a word. I tried to type in this.command(friend, "attack", enemy); But it came out as this.command(frienddd, "attackk", ene )

try to use another browser. Best is Chrome. Worked for me

I am using Chrome here.

I think blaming performance on the user is not right. I have a grfx card that can run any game on the market and these graphics are so old school. I think the issue may be with how many people are using your site.

The game simulation is run entirely in the client (i.e. inside your browser), if it feels laggy then it is due to your computer’s hardware or software (drivers, browser). The servers only come into play when loading resources (e.g. sprites, though CodeCombat has several CDNs for these) and saving/retrieving player and game data; the servers have nothing to do with the game simulations’ performance.

1 Like

After reading your post, I did some further investigation. I was actually able to solve this issue today and it was definitely not hardware related. It was solved due to client side software.

I tested Code Combat in Firefox and chrome with updated plugins and most updated versions using windows 10 on a beast gaming desktop. I even tried edge browser, the same results. However, when I started using Internet Explorer 11, installed all the latest plugins and updates, now it out-benchmarks chrome and Firefox combined.

Sometimes testing different software suites on different machines can reap unexpected results. Lag is gone and no glitching, runs smooth as butter now. :wink: :smile:

Nice! :smile:

I used this website:
it benchmarks JavaScript operations for whatever browser you’re using. the numbers differential per statistic were huge. IE11 creams Firefox and chrome on this current config. Not to mention any lag issues are gone/resolved.

1 Like

every time I change my code, game look like this

when code is unchanged, work better. LAGGY anyway.
work smoother on levels with less enemies BTW

and this is an example if game is cached

my params
4gb RAM
geforce nvidia video 820m
Pentium 1.9 GHz
win 7 x64
Chrome and Firefox (Chome works better)