Username or E-mail
Password (Forgot?)
New? Sign Up
Join or Sign In
Forums Stencylpedia Stencyl TV Translations Go Pro - Plans & Pricing Download Stencyl


Switch to Book Layout

1: Getting Started

  • Getting Started
  • Crash Course
  • Crash Course 2
  • StencylForge

2: Building Logic

  • What is a Behavior?
  • Creating a Behavior
  • Attributes
  • Game Attributes
  • Attribute Types
  • Events
  • Our Behaviors

3: Actors

  • What are Actors?
  • Animations
  • Motion & Forces
  • Physics
  • Controls
  • Collisions & Groups
  • Killing vs. Recycling
  • Tweening
  • Effects
  • Chapter 3 Challenge

4: Scenes

  • Scene Basics
  • The Camera
  • Tilesets
  • Regions
  • Drawing Text & HUDs
  • Changing Scenes
  • Music, Sounds & Channels
  • Backgrounds
  • Customizing Actors
  • Chapter 4 Challenge

5: Game Mechanics

  • Saving
  • Pausing
  • 3rd Party Services
  • Web Requests

6: Advanced Topics

  • Get/Set Attributes
  • Custom Events
  • Blending Modes
  • Lists
  • Custom Blocks
  • Continuous Collisions

7: Testing & Tuning

  • Testing Games
  • Optimizing Performance 1
  • Optimizing Performance 2

8: The Last 10%

  • Flash Publishing
  • Standalone Apps
  • iOS App Store
  • Chrome Store
  • Making Money

M1: Mobile - Intro

  • Getting Started
  • Testing on your Device
  • Flash -> iOS Guide

M2: Mobile - Basics

  • Atlases
  • Drawing Text
  • Retina Display
  • Accelerometer
  • Joystick
  • Universal Games

M3: Mobile - Services

  • iAds
  • Game Center
  • In-App Purchases

M4: Mobile - Publishing

  • Debugging
  • Publishing to the App Store
  • Optimizing Performance
  • Promoting your Game

A: Troubleshooting

  • Showstoppers
  • General FAQ
  • iOS FAQ
  • The 90% Memory Warning
  • Recovering Broken Games
  • Can't Export to SWF
  • Reloading Documents
  • Generating Logs
  • Flash Security Settings
  • How to Report Bugs

B: How-To Guides

  • Importing Assets
  • Scene Designer
  • Code Mode
  • Font Editor
  • Pencyl (Image Editor)
  • Tile Editor (Shapes)
  • Game Cleaner

C: Reference

  • Glossary
  • Block Reference
  • Useful Shortcuts
  • Stencyl API

D: Resources

  • Stencyl TV
  • Abigayl's Guides
  • Giving Critiques
  • Creating Extensions
  • Translating Stencyl
  • Credits

3.0 Drafts (In Progress)

  • What's New in Stencyl 3.0?
  • Setup (Android)
  • Setup (Desktop)
  • Setup (iOS) - Concepts
  • Setup (iOS) - Mac
  • Setup (iOS) - Windows
  • Testing iOS on Windows
  • iOS Troubleshooter

  • Mobile App Scaling
  • Full Screen Mode
  • Simple Physics
  • Backgrounding an App

  • iOS App Store
  • Mac App Store
  • Windows Store
  • Google Play
  • HTML5

  • Android Ads
  • Android Purchases (WIP)
  • 4" Form Factor (iPhone 5)
  • Mobile Input
  • Mobile Features

  • Extending the Engine
  • iOS / Android Extensions
  • Developing the Official Extensions
  • Developing the Engine

  • iAds (Revised)
  • Game Center (Revised)
  • iOS Purchases (Revised)
  • Atlases (Revised)
  • Drawing Text (Revised)
  • Joystick (Revised)
  • Accelerometer (Revised)
  • Sounds (Revised, WIP)
  • Debugging (Revised, WIP)
  • iOS Performance (Revised)
Level: Beginner

Testing your Game

Contents

  • Testing in Flash
  • Testing in iOS
  • Printing to the Console
  • Debug Draw
  • Profiler
  • Compile Errors
  • Runtime Errors
  • Tips

 

Testing in Flash

Press the Test Game button, or type Ctrl + Enter (or Command + Enter on Mac) to test your game in Flash.



You can also do this from the Run menu.

By default, Stencyl games test in the standalone (desktop) version of Flash Player. You can optionally run games inside the web browser instead by switching this in the Flash Player option dropdown.

Flash Player Option Button

Note: For mobile projects, we don't show the Test Game button in the toolbar due to space constraints. We encourage you to use the shortcut or menu instead if you need to test in Flash rather than iOS.

 

Testing in iOS

We've written up a separate article on iOS testing and debugging.

 

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 while the game is running.

How to Print to the Console

Use this block. (Flow > Debug)

 

To view the console in-game, press the ` key. It's the one below ESC.

Note: If you're testing an iOS game, we pop up the Mac's Console app instead.

 

Debug Draw

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

Use the following blocks (Flow > Debug) to turn debug drawing on and off.

 

Profiler

A profiler is software that measures your game's performance by telling you how much memory it's using.

To view the profiler, right-click your game and pick the Profiler menu item out.

How do you read this? The profiler charts out memory usage over time.

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, a time when a program ditches a bunch of memory it's holding to but has no more use for.

Bottom Line: Generally speaking, memory usage isn't a problem for most games and only becomes an issue to investigate when a game's framerate isn't smooth.

 

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.

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

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).


(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. (Rare)

On iOS, compiler errors are somewhat more common. In many cases, these are caused by failing to "cast" (convert) a value to text when printing it or drawing it to screen.
 

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 on the forums. Take screenshots and attach your logs. (TODO: link to that article)

 

Runtime Errors (game errors out)

Runtime Errors are errors that happen while the game is running. They frequently lead to "freezing" of the game. If your game is freezing up, check the Console (` key). You might see this kind of text.

Note: In some instances, 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.

 

What causes runtime errors?

By far, the most common cause is referring to an actor after it's been killed. This accounts for 90% of cases.

If you're stuck, ask on the forums. 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 the next articles in this Chapter 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

  • Press ` (the button below ESC) to show/hide the console.
  • Use print blocks to print to the console.
  • Use the profiler to measure memory usage.
  • Debug drawing can be useful for debugging physics.
  • Develop a testing workflow that works for you.


Last Updated: 2012-08-23 by Ceric

9959 have read this article
Disclaimer: The Stencyl Team does not actively monitor comments on articles. If you're seeking help for your game, please ask a question on the forums. Thanks!
3 Comments
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?
0 2 weeks, 2 days 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 2 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
0 5 months, 3 weeks ago



Commenting Guidelines

Sign In to Comment

Make Games

  • What is Stencyl?
  • Roadmap
  • Pricing

Play

  • Arcade
  • Showcase

Community

  • Forums
  • Chat
  • Translations

Help

  • Stencylpedia
  • Stencyl TV

About Us

  • Blog
  • Contact Us
  • Press
  • Privacy
Follow Stencyl on Twitter



© 2013 Stencyl, LLC.