Check This Awesome FAQ Before Posting

… you know it’s sweet stuff! Might save your life some day.

  1. I need help with my code!
    1. Check each level’s help guide for common tips
    2. If a level is too hard, try a different hero or different items
    3. Common error messages and how to debug them
    4. Post your code with radiant, harmonious formatting
    5. Personal coding help from the CodeCombat staff
  2. The game is not working!
    1. It crashes
    2. It doesn’t load
    3. It’s slow
    4. The graphics aren’t showing up
  3. Can you please fix this bug I found?
    1. Known bugs live in the GitHub issues
    2. How to report a bug
    3. Status of experimental programming languages
  4. What’s free and what’s paid?
    1. Levels
    2. Gems
    3. Heroes
    4. Support and tutorial videos
    5. Buying CodeCombat for your school or group
  5. I love this game! How can I help?
    1. Becoming an Archmage, Adventurer, Diplomat, Artisan, Scribe, or Ambassador
    2. Playtest new levels for free as an Adventurer
    3. Custom CodeCombat avatars

I need help with my code!

Post your code with radiant, harmonious formatting
You can get your code to format properly by surrounding it in triple backticks. This:

```
enemy = hero.findNearestEnemy()
if enemy:
    hero.attack(enemy)
```

becomes this:

enemy = hero.findNearestEnemy()
if enemy:
    hero.attack(enemy)

Use spoilers for long text
You can use the [details]-block to hide text or even code in an expandable textblock.

[details=Click here to learn the deep secrets of space]

This text will not be visible until you expand the spoiler.

[spoiler]It also works with blurred text.[/spoiler]

```
hero.say(“You can even put code in here”)
```

[/details]

becomes

Click here to learn the deep secrets of space

This text will not be visible until you expand the spoiler.

It also works with blurred text.

hero.say("You can even put code in here")

Check each level’s help guide for common tips
If you get stuck, first make sure you’ve carefully read the instructions in the comments, then chance the Hints, located in the upper right. Almost every level has custom hints.
We’ve listed common gotchas and good-to-knows that will save you some serious brain agony.

If a level is too hard, try a different hero or different items
In addition to writing the right code, for many levels, your hero will need to be strong enough to defeat her enemies and survive their slings and arrows. Some levels are easier with a warrior, wizard, or ranger, so try a different hero if you have one. If you’re dying too quickly, try buying more armor. If you don’t have enough gems, consider playing more of the replayable challenge levels or simulating some multiplayer games. You could buy more gems, too, but it’s not required to beat the core level progression.

Common error messages and how to debug them
I’ll pretend you’re writing Python, but most of this is the same for JavaScript or other languages.

  • Infinite loop detected: uh oh, this is probably a problem on our end. If the “Comment out my code” option doesn’t work, let us know. You can also try switching your programming language, hero, or gear to see if that lets you play. Most often, this happens either with an experimental programming language or a new, untested level.

  • undefined is not a function: You probably don’t have the method that you’re trying to call. Maybe you’re trying to buildXY but you have a sword instead of a builder’s hammer. Make sure that you equipped the item that should provide it. You might also just be trying to call a method that doesn’t exist.

  • Target is null. Is there always a target to attack?: you are probably trying to attack None. Make sure that if you use something like findNearestEnemy, you use an if enemy: check before you do anything with enemy, because there might not be an enemy!

  • Find the distance to a target unit: Same as above–if there is no target unit at some point during the level (possibly because you can’t see anyone or have killed everyone), you’ll pass a None target to distanceTo and error out. Use if statements to make sure that there is always a target.

  • ‘item’ was null. Use a null check before accessing properties. Try if item:: Same as above. If there is no item, then trying to access item.pos will throw an error. So use if to make sure there is always an item/flag/enemy before you read item.pos (or enemy.pos, or flag.pos, or enemy.health, or whatever!)

  • Move to an {x: number, y: number} position: are you sure that the arguments you passed to move or moveXY are numbers? For example, hero.moveXY(item.pos.X, item.pos.Y) won’t work, because the X and Y should be lower-case properties of item.pos, and you’ll see this message.

  • My hero isn’t doing anything, but there’s no error: are you using a loop? Do you have an if or else condition that is firing but not telling your hero to do anything?

  • My distance check isn’t working: make sure you are comparing to a number, like this: if hero.distanceTo(enemy) < 10:

Personal coding help from the CodeCombat staff
If you’re a paid CodeCombat subscriber, we love you and would be happy to look at your code, figure out what is wrong, and happy to explain what to do, why, and how programming concepts work. Just use the contact form on the site to email us. If you are playing for free, we still love you, just… not in that way.

Subscribers also get access to personalized help for every level,


The game is not working!

We’d love to figure out what’s going wrong and fix it up. Help us narrow the problem down:

  1. Try it in Google Chrome, Mozilla Firefox, and either Safari (Mac) or Edge (Windows) to see if the problem only affects certain browsers.
  2. Make sure that your browser is running the latest version.
  3. Make sure that you have at least 2GB of RAM (only really old computers have less than this).
  4. Figure out whether it happens on just one level or on all levels.
  5. If you are using an experimental programming language (not Python or JavaScript), try in Python or JavaScript to see if the problem is specific to the programming language.

It crashes
This is often caused by either an old browser version or by running out of memory. Please let us know when it crashes and how it crashes: does the tab crash, does the browser crash, does the page stop responding, or something else?

It doesn’t load
This is often caused by either a new bug on our end, an unsupported browser version, aggressive internet firewall settings (possibly from your work or school), malware on your computer, or a new and buggy level. Please open the Google Chrome JavaScript console and send us the entire log for when it stops loading, plus a list of the steps you take where it doesn’t load, and we can probably solve it.

It’s slow
If it’s choppy: CodeCombat should run fine on all but the oldest of computers. That said, the more CPU, graphics power, and RAM you have, the faster it will run. If you have a slow computer, consider trying another browser, which may often run faster. We find that Google Chrome is often the fastest.

If it takes a long time to load: either your bandwidth isn’t fast or our servers are having problems. CodeCombat does need to download a lot of data so you can play the game, but there isn’t any way around that, so on slow connections, it can take a minute or two to download everything. Browser and CPU speeds also affect level load times.

The graphics aren’t showing up
If you either see a dark gray screen or really glitchy graphics like this, then either not all the art was successfully downloaded (try reloading the page) or there’s an uncommon problem with your hardware accelerated graphics. Unfortunately, we don’t have a workaround for problems with hardware acceleration, but you might try updating your video card drivers.


Can you please fix this bug I found?

Known bugs live in the GitHub issues
You might want to do a quick search in our GitHub issues to see whether someone else has already reported the bug. If not, we’d love to hear about it so we can fix it. It’s really helpful if you can post the issue on GitHub, but if you’re not sure, you can also post it to the forum.

How to report a bug
When reporting a bug with gameplay in a level, please include:

  1. your code, and
  2. a screenshot of what’s going wrong.

When reporting a bug with the rest of the website, please include:

  1. what operating system,
  2. what browser(s),
  3. exactly when it stops working and what you see,
  4. what programming language you’re using,
  5. what level isn’t working,
  6. and whether it worked before or has never worked.

If something in the web interface isn’t responsive, it can be helpful to open the Google Chrome JavaScript console and send us the entire log for when it doesn’t work, plus a list of the steps you take to reproduce the bug, and we can probably solve it.

Status of experimental programming languages

JavaScript and Python are solid and well-tested, although some advanced Python features don’t work. Other experimental programming languages may have some bugs; if you see any, let us know.


What’s free and what’s paid?

Levels
The first several levels are free. Paid subscribers get access to hundreds of levels, in which you can learn new tricks, practice your skills, fight exclusive enemies, earn extra gems and experience, own pets, and unlock bonus heroes. See more on the CodeCombat Premium page.

Gems
You can earn all the gems you need to advance by playing levels. If you want extra awesome items or heroes, though, you can subscribe: subscribers get 3500 gems per month.

You can also get more gems for simulating games or for beating higher difficulties of replayable levels. The formula for repeatable level reward scaling is 0.125x2 + x, so the first several times you beat one, the linear term dominates. So as to not blow out the gem economy, we save the exponential growth on rewards for the very high difficulty levels that we hope are impervious to any hilarious tricks.

Heroes
The basic warrior heroes, Anya, Tharin, Ida, and Alejandro, are available for free. Subscribers unlock the ability to purchase additional heroes with your gems. There are Ranger- and Wizard-class heroes with different abilities and gameplay strategies, and there are more specialized Warrior heroes, too.

Support and debugging
Each level has a textual help guide that offers hints and programming info. Check it out if you get stuck!

In addition, if you are a subscriber, you get premium support from us, the CodeCombat developers: just shoot us an email through the contact form and we’ll be happy to take a look at your code, teach you about programming, and generally help you out!

Unfortunately, we can’t offer personal programming instruction for non-subscribers.

You can also try our live online classes to get coding mentorship live from our pro coding teachers.

Buying CodeCombat for your school or group
If you want to use CodeCombat in your classroom, that’s great! Just create a teacher account and invite your students to play the free introductory course. If you are looking for more levels or want to get your students even more excited about programming, then let’s get you set up with a discounted school/class/group license. Check out our teachers’ getting started guide for more info.


I love this game! How can I help?

CodeCombat is 100% open source, and we couldn’t have done it without the help of our wonderful open-source contributors. Check out our Contribute page to learn more about becoming a contributor:

Custom CodeCombat avatars
If you make significant contributions to the game, we may ask if you want your own custom CodeCombat avatar drawn for you. Join us!