How to Learn Starling Framework
Starling Framework is a free, open-source framework written using ActionScript 3.0. The primary purpose of this framework is to make it extremely easy for developers to build games for the Adobe Flash Platform. In this article, we'll introduce you to Starling, and share tips, screencasts, tutorials, and resources for getting started with it.
Why Choose Starling Framework?
There are a lot of benefits of using Starling Framework for creating your games; these are some of the most important reasons:
- It's free.
- It's open-source: developers contribute to extend the framework's limits.
- It's hardware accelerated: Starling is built on the new Stage3D technology of Adobe Flash Player, which uses the GPU hardware of the player's device to render the game.
- It's multi-screen friendly: One codebase can be compiled to run on multiple platforms - desktop, web, iOS, and Android.
Where to Download It
The official Starling Framework website contains a link to download the latest version. For any Starling-based games, this is the most important and the primary package that you'll need.
As mention, Starling is open source, and so it is also hosted on GitHub.
This branch contains the following:
- Full source-code of Starling framework written in AS3.
- Demo projects that can be used to explore how Starling code can be written.
- A scaffold project that offers you a starting point to get going with a new project.
- Some unit tests for different features of Starling Framework.
- Utilities that will help you deploy and test the game based on the framework.
It is assumed that you have intermediate-level of knowledge in Flash ActionScript 3.0 to be able to pick up Starling framework quickly. If you need help with Flash ActionScript 3.0, I recommend the book Essential ActionScript 3.0 by Colin Moock.
Getting Started With Development
Beginner Video Tutorials (Free)
To start with, if you are new to this framework, I recommend you start with a simple project that takes you through start to finish of a game's development process. You may find this in my video series Starting with Starling.
Throughout this series of videos, you will learn how to build a game called Hungry Hero.
The video series will take you through various topics involved in learning Starling Framework:
- Setting up
- Images, Textures and Buttons
- Sprite Sheets and Animation
- Navigation using Events and Listeners
- Parallax Scrolling
- Game states, Sprites, Collision detection, Text and Fonts, Particles
Introduction to Starling (Free Ebook)
For a more in-depth API guide of the entire framework, a good resource is the book Introduction to Starling by Thibault Imbert.
(More info available at Thibault's website.)
Once you get the hang of the basics of Starling Framework, I recommend that you concentrate on the following aspects.
Enhanced Visual Effects (like Particle Systems)
Adding particle effects and special effects enhances the experience of the players playing your games. There is a neatly tailored extension for Starling particle systems that is a must to explore for budding game developers.
MVC Patterns and the Likes for Efficient Coding
As important as the process involved in developing a game is the way in which you architect the code and assets (graphics and audio). Separating your code in to Model, View and Controller components will often give you a better approach for managing your projects, making it easier to find and fix bugs and giving you a more efficient implementation.
Optimization Techniques for Efficient Performance
Any game needs to be optimized, irrespective of the framework/language you use. This always ensures your games run on the least common platforms/hardware. Never underestimate the performance issues, especially in game development!
UI Components Built for Starling-Based Games
Explore the finely built UI framework for Starling-based games, Feathers. Built using AS3 and Starling Framework, and accelerated using Stage3D, it is optimized and architected for use with multiple screen densities and resolutions.
Extend Starling Framework With Extensions
There are a lot of mature extensions for Starling Framework, many of which you will find very useful! These are created by some of the best developers, for the purpose of game development - they used this code to build and extend their own games.
Process of Game Development
Now that you understand the technicalities of the framework itself, it is extremely important to know how a game is supposed to be built - especially the efficiency and architecture. This is one of the most important topic to grasp, so keep practicing and keep reading tutorials.
More Learning Resources
These links provide great learning resources for specific topics around the Starling Framework.
This is probably the best resource for a beginner trying to build games using Starling framework. It contains tutorials from basics to advanced level.
Here, you'll find the best video tutorials and articles to get started. If you are entirely new to Starling, this is a great place to start.
Once you pick up the basics and are able to build stuff, extensions is probably the place you need to look for. Here, you will find many different libraries written by awesome develpers. As the name suggests, it only extends the capabilities of the framework.
Any game is incomplete without a user interface. Building a main menu, options screen, about screen, credits, level select, and so on is all much simpler when using this amazingly easy framework.
Whether you are a beginner, intermediate, or advanced developer, it is always a good idea to refer to the API reference. It provides you with the up-to-date syntax of all the methods, classes, and properties for all objects in Starling framework.
Hit an issue you aren't able to solve during the development process? Starling Framework's community is the best place to look for help. A great set of developers contribute to this community forum, helping each other with the game development problems one might face.
This is the primary location of the Starling framework. If you want to fork, contribute or just watch for updates, don't forget to connect to this.
No product or framework is successful without the contribution of testers or real users. If you think you've found a bug or an issue in Starling framework, this is the tracker to report it through. Do contribute and keep Starling framework flying!
While some of these are Starling Framework-specific tips, most do hold good for any game development technology.
Use the Multi-Screen Features
Since Starling framework is based on Flash ActionScript 3.0, do not forget to take advantage of the multi-screen features of Starling framework.
There are numerous ways of making your games multi-platform or multi-screen friendly. Make sure you explore the "Demo" and "Scaffold" projects provided with the code base.
Plan Optimization Right From the Beginning
Optimization is an integral part of coding a game in any language. Remember, one of Starling Framework's most important features is its multi-platform support.
Once you start coding your game, the complexity of the code only continues to grow throughout the development process. To make sure you don't find yourself changing the architecture itself of your game at a later stage (due to inefficiency), it is always best to start thinking of "optimized coding" right from your first line of code.
Segregate the Code
Keep your code in separate sections (especially important for multiple platforms):
- Core logic: Contains the behaviours of different game characters, logic to move objects, add up scores, play music, and so on. Any bug fix in this part of the code should ascertain the fix for all platforms the game is built for.
- Platform logic: Contains only platform-specific code, which could mean considering iOS or Android; tablets, phones, or web; screen sizes, resolutions, and densities... This section of the code handles things for any specific platforms, like enabling or disabling special effects based on the capability of the platform to ensure the game always runs at a good framerate.
- Interaction logic: Contains interaction-based logic that ensures the interaction is defined based on the platform on which the game is running, then talking to the core logic to perform actions in the game. For instance, mouse controls for desktop and web, touch controls for mobile and tablet.
Decide Whether to Use Vector or Raster Graphics
Vectors are lightweight in terms of memory. These graphics are drawn in run time on the screen, so less graphical data is stored in the memory. However, rendering them can be costly on the processor.
Bitmaps or raster graphics are memory-intensive. Storing physically and consuming memory to render can be a challenge, but are comparatively lighter in terms of rendering (unless you perform bitmap-intensive processing).
Want the game to run faster on devices with limited processors? Use bitmaps. Want more flexibility visually? Use Vectors. There are challenges inherent in using either, so always try and balance the use of both of these elements. Keep in mind how much processing power and memory your game uses.
Use More Sprite Sheets When Required
You aren't forced to try and include all the graphics of your game in one single sprite sheet. If required, do expand your logic to use multiple sprite sheets - but, do keep this in check, as your game can occupy more file size and most importantly be more memory-intensive.
Consider Dynamic Sprite Sheet Generation
There are extensions out there that you may use for this - or, even better, you may write one to do exactly what you need.
Using pre-created vector Flash animations (SWFs) and dynamically converting them to sprite sheets could save you a lot of development time, as well as reduce the file size of your binary. Make sure you don't end up doing this too much to affect the run-time memory consumed by your game.
Look Into ActionScript Native Extensions
Use ANEs to expand your games to contain platform-specific features, like in-app purchases, in-game ads, and social features (such as Game Center for iOS). There are lots of free and paid ANEs available online, so don't forget to check them out. You can also easily write your own if required.
Stay active in the community. There are many expert developers in the community who have been contributing for a long time. Do post your queries on the Starling forums and don't forget to log bugs or support tickets if required. Developers' ideas and requirements are one of the reasons Starling Framework grows with more features by the day.
A Word of Experience
There is a saying: "It is not the tool, but the skill that matters". Starling Framework is a great open-source API set to build awesome GPU accelerated games for multiple platforms and devices. However, paying close attention to the development techniques, patterns, way of optimizing code, and so on will always help you in the long run. A lot of topics that I've listed throughout this article are valid for many other frameworks and languages.
Therefore, no matter what language, framework, platform or tool you use to build games, the concepts of game development remain important.
Successful Games Built on Starling Framework
Here are some of Starling-based games that have been really successful:
Angry Birds (Facebook Edition)
The Dragon's Time
Rivers of Olympus
Now that all the resources in the world are combined into one single place, learning Starling Framework should be a piece of cake.
Start by building the simplest of games and work your way through it. Don't forget to leave a comment and let us know what you built! Once you release a game, I'll be happy to review it and comment on it.
Lastly, like I always say, it is not the tool that is important, but the art and the science. Remember that Starling Framework is just a tool or a medium to express your game development skills; what really matters is the skill you will eventually build in yourself. There are countless platforms, operating systems, devices, screens, frameworks, languages and tools out there. Growing yourself to be able to build for them, and to be successful, is the key. Starling Framework is a great medium to achieve this with. All the best!