As of late 2021, we are in the process of updating Stencylpedia and fixing up outdated & broken content. Thanks for your patience!

61,616

Views

Beginner

Level

5

Comments

Testing your Game

by Jon (Updated on 2015-10-17)


Contents

  • Testing your Game
  • Testing Standalone Games (Windows, Mac, Linux)
  • Testing on Mobile Devices (iOS, Android)
  • Printing to the Console
  • Debug Draw
  • FPS Monitor
  • Compile Errors
  • Runtime Errors
  • Tips

Testing your Game

Pick the Platform and press the Test Game button.

Flash Player Option Button

You can also do this from the Run menu.

Run Menu

Prefer keyboard shortuts? Type Ctrl + Enter (or Command + Enter on Mac) to test your game.

Testing Standalone Games (Windows, Mac, Linux)

See this article for the steps required to get standalone games running.

Testing on Mobile Devices

Setting up for iOS

Setting up for Android

Print to the Console

It's often useful to record things that happen in a game during testing in a way that can be easily seen. For example...

  • Telling whether a piece of logic "happened", especially if you suspect that that logic is not being reached
  • Telling what the value of an attribute is. It may be different from what you think!

One quick and easy way to do this is to print these values to the console. Think of the console as a temporary text file that you can write out text to and view from Stencyl's Log Viewer.

If you prefer to see the console inside the game (as was the case before Stencyl 3), use this extension.

How to Print to the Console

Use this block. (under Flow > Debug)

Print Block

Debug Draw

Debug drawing is a special mode in which collision shapes are drawn as outlines. This can help you debug physics-related problems.

Debug Draw

Debug drawing is toggled from the Run > Enable Debug Drawing menu item.

FPS Monitor

The FPS Monitor reports the framerate and memory usage for your game in the top-right corner. It can be toggled from the Run > Enable FPS Monitor menu item.

It's normal for a game to see small but continual memory increases even if nothing is happening. After a while (30 - 60 seconds), the memory usage will suddenly drop back to a baseline level. This is known as garbage collection, which refers to the act of ditching memory that an app no longer has use for.

Summary: Don't obsess over this point. Memory usage isn't a problem unless it continually grows without ever dropping and is accompanied by a choppy framerate.

Compiler Errors (can't run game)

Ever seen this window? This is a Compiler Error, which is an error that happens when we're unable to build your game into a Flash SWF for testing or exporting.

Error

In most cases, if you hit OK, we'll open the offending behavior and highlight the blocks that are at fault.

Error Cause

In this case, we've used the "actor inside region" block outside its context. It has to be used inside its wrapper (something that seems obvious but can easily happen if you're not careful).

Solution

(Correct usage)

What are the common causes of compiler errors?

  • Using blocks outside their intended contexts, like what happened above.
  • Something changed on our end, and it broke your game.

What can I do about them if I'm stuck?

  • Drag out the offending blocks and see if the error goes away. Divide and conquer works well in isolating the issue.
  • Once you've figured out WHERE the problem is, try to understand the problem. What is the error message trying to say?
  • If you're stuck, ask for help on the forums. Describe your problem, take screenshots and attach your logs.

Runtime Errors (game crashes)

Runtime Errors are errors that happen while the game is running. They frequently lead to "freezing" or "crashing" of the game. If your game is freezing up, check what shows up in the Log Viewer (View > Log Viewer if it isn't open). You might see this kind of text.

Flash Error

Note: Stencyl 3.0 and later, Flash itself will display a popup with an error of its own with similar information.

Fortunately for you, a runtime error usually tells you what's going on. The first line usually tells you where the error happened. You often see line numbers (line 57), which can point you roughly towards the offending line.

Flash Error

What causes runtime errors?

By far, the most common cause is referring to an actor after it's been killed.

If you're stuck, ask for help on the forums. Describe your problem, take screenshots and attach your logs.

Tips

  1. Come up with a testing workflow that you feel comfortable with. Don't blindly guess what's wrong. Stick to the facts and verify your assumptions by printing to the console.

  2. Is your game running slowly? Read this and this to diagnose the causes and come up with solutions.

  3. It can tempting to "reinstall" the software to fix problems. In reality, this not only wastes time, but it can also cause more problems in the long run. Although there are circumstances where a reinstall is required, avoid the temptation and only switch to it as a last resort.

Summary

  • Use print blocks to print to the console.
  • Use the FPS Monitor to measure memory usage.
  • Debug drawing can be useful for debugging physics.
  • Develop a testing workflow that works for you.
Print Article Edit Article How to Edit an Article
Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!

5 Comments

ABDARAZAG
hi

-1 8 years, 2 weeks ago
DarkChaos
2015-11-23 17:51:23,390 INFO [main] stencyl.sw.Session: Logfile: C:\Documents and Settings\user\Application Data\Stencyl\stencylworks\logs\2015 -11-23_17-51-22.log
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: OS Name: Windows XP
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: OS Version: 5.1
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: Java Version: 1.8.0_60
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: Stencyl Version: 3.3.2 (b8734)
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: Stencyl Workspace: C:\Documents and Settings\user\Application Data\Stencyl\
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: User Working Directory: C:\Program Files\Stencyl
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: User Home Directory: C:\Documents and Settings\user
2015-11-23 17:51:23,453 INFO [main] stencyl.sw.Session: System Path: C:\Documents and Settings\All Users\Application Data\Oracle\Java\javapath;C:\WINDOW S\system32;C:\WINDOWS;C:\WINDOWS\Sy stem32\Wbem;C:\Program Files\Stencyl\runtimes\jre-win\bin< br /> 2015-11-23 17:51:24,031 DEBUG [main] stencyl.sw.util.FileHelper: Deleting: C:\DOCUME~1\user\LOCALS~1\Temp\sten cyl16983007121846476
2015-11-23 17:51:24,046 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-phrases.lang
2015-11-23 17:51:24,140 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-errors.lang
2015-11-23 17:51:24,203 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-menu.lang
2015-11-23 17:51:24,218 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-welcome.lang
2015-11-23 17:51:24,234 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-dashboard.lang
2015-11-23 17:51:24,250 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-publish.lang
2015-11-23 17:51:24,250 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-updater.lang
2015-11-23 17:51:24,250 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-chat.lang
2015-11-23 17:51:24,265 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-misc.lang
2015-11-23 17:51:24,406 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-forge.lang
2015-11-23 17:51:24,406 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-prefs.lang
2015-11-23 17:51:24,406 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\global-creategame.lang
2015-11-23 17:51:24,406 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\behavior-main.lang
2015-11-23 17:51:24,468 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\behavior-blocks.lang
2015-11-23 17:51:24,546 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\behavior-blockhelp.lang
2015-11-23 17:51:24,593 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\behavior-events.lang
2015-11-23 17:51:24,625 DEBUG [main] stencyl.sw.loc.LanguagePack: Reading... lang\en\behavior-code.lang
2015-11-23 17

-4 8 years, 10 months ago
ZombieGame
I try to load my game, but when I do it just shows the scene and not the tile sets or characters. How can I fix this to see what it plays like?
3 11 years, 5 months ago
marssien
On my English Canadian Keyboard set in Canadian French the key was the one beside the enter key to make appear the console. (`) for the grave accent example: รจ if this could help someone else.
0 11 years, 6 months ago
rojasstencylman
i didnt realize there were so many different ways to test games. I thought it was just u play it and hope it works
1 11 years, 10 months ago

Sign In to Comment