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

Atlases

Contents

  • Introduction
  • Atlas Size
  • What can be included inside an atlas?
  • Managing Atlases
  • Assigning Graphics to an Atlas
  • Reducing Memory Usage
  • Atlases and iPad (Stencyl 2.2 and below)
  • Tips

 

Introduction

Games made for use with mobile devices use atlases to store graphical game assets. An atlas is a large image that combines lots of smaller images into a single unit. Atlases are also sometimes called sprite sheets.

iOS-game-graphics-atlas-example

We use atlases to optimize a game's performance and make it possible to use more graphics within a game than a device can load in before exceeding its memory limit, by allowing sets of graphics to be unloaded when they're not in use.

 

Atlas Size

Important Note: In Stencyl 3.0 and above, atlases are not subject to the atlas size limit, but they still take up the same amount of memory.

Atlases can be up to 4096 x 4096 pixels in size on an iPad Gen 3, 2048 x 2048 on an iPhone 4 / iPad 1/2 / iPod Touch Gen 4 and 1024 x 1024 on everything else (including Android).

For the most part, a game can accommodate 4 to 5 full-size atlases at a time before you’ll see a memory warning.

The most problematic device is the iPod 4, which supports retina but has the least amount of memory (128 MB vs. 256 MB) of all modern devices.
 

Game Assets that can be included inside an Atlas

  • Actors
  • Fonts
  • Tilesets
  • Backgrounds
  • Animations (within Actors) (Stencyl 2.2 and below)


Managing Atlases

Note: In Stencyl 3.0, atlases can be created and deleted at will.

Every game made with Stencyl 2.2 comes with a pre-set number of atlases defined, which is currently 32. You will never need to "create" an atlas.

The Atlas Page is part of the Settings dialog. Click the Settings button to open the dialog.

Settings Button

Next, click the Atlases button, as shown below. This is where you can configure atlas settings.

Atlas Settings

Following is a list of the options you can configure for each atlas:

  • Name: The name of the atlas.
  • Load initially?: Whether or not to load the given atlas when the game starts. Loading it at the game’s start will require more memory.

The following options are available in Stencyl 2.2 and below. In Stencyl 3.0, atlases are considerably simpler and do not require such options.

  • Resize Method: This option resizes your graphics to fit the display of a given device.
  • Target Device: The device you intend people to play your game on.
  • Preview: Clicking this option will show you a preview of the graphics in the atlas so you can see how the various options affect your graphics’ appearance.


Assigning Graphics to an Atlas

To assign a tileset, actors, fonts, or backgrounds to an atlas, visit the Properties page for that resource, click on the Atlas dropdown menu and select which file you would like to assign to a given atlas.

stencyl-add-graphics-atlas


Reducing Memory Usage

You can load and unload entire atlases during the game to minimize memory usage. Stencyl can also unload atlases from the get go, and only load them when they are needed, to reduce memory usage.

You can use the “load/unload atlas” block to do this at runtime. This block is located under Flow > Advanced.

stencyl-design-mode-atlas-blocks

When you use this block, Stencyl will load and unload the specified atlases for the NEXT scene (NOT the current scene). You specify the atlas to load/unload by its ID. A given atlas’ ID is displayed in the atlas' own page.

stencyl-atlas-id


Using Atlases With the iPad (Stencyl 2.2 and below)

Note: In Stencyl 3.0, none of the directions below apply because we automatically handle iPad vs. iPod graphics loading separately, so you never run into a scenario where both sets of graphics are loaded at the same time.

One approach to creating a universal game (one that runs on iPhone and iPad) is to create two sets of graphics. However, this can strain memory usage if both sets of graphics are loaded, even if one set won’t be used at all when the game is played on one device vs. another!
 

ipad-game-graphics-atlas

(Both iPhone and iPad graphics in one atlas - not optimal)

To work around this issue, assign iPad-only graphics to particular atlases and mark those atlases as iPad only.

stencyl-ipad-graphics-atlas

If you're designing your game such that you’re including iPad graphics, in addition to other graphics, for an actor via different animations, there is a dropdown to assign a different atlas on a per-animation basis.

In this case, the game author created a Button in which different animations are used depending on whether the game is played on an iPhone or iPad.

 

Tips for Using Atlases

  • Keep the most common graphics in the Main Atlas.
  • Combine graphics that tend to appear together as much as possible, so they are located in the same atlas.
  • Use the Allocations feature in Xcode’s Instruments tool to monitor memory usage if you receive memory warnings.
  • Don't load more atlases than you need! Using atlases intelligently can reduce memory usage and improve your game’s load time.


Last Updated: 2013-04-13 by Ceric

11801 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!
1 Comment
MerlinoDreamlab
Atlas are limited to 16 and not 32 as is written (...which is currently 32)
1 1 year, 4 months 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.