AS3 Starling Tower Defense Tutorial – Part 11 – Conclusion

We made it! Ten blog posts written in one month, averaging about 5,200 words per post (though most of it is code) is definitely a new record for me. I’m glad to be done with this phase of the code. My plan was always to get this demo working, write a tutorial series so that other people can do this easier, then take the same codebase and continue building with it to make a few games. So now it’s time to get to make a few games! Woo!

I wanted to wrap up the series going through some things I learned along the way. Maybe “postmortem” would be a better title but that sounded a little pretentious since I just made a little demo, not a real game like the big boys. I’ll get there though soon enough.

Thoughts on Starling

I had started a tutorial series before this on creating a straight AS3 game engine. I had made it through about 3 posts, discussing loading assets, enemies, and generating your tile map by blitting “by hand” (well, without Starling). It was going in a good direction then I remembered something called Starling and that it was supposed to make games faster, better, more FPS, less visual lag, all GPU-jacked-up and a hot new engine on the block. I stopped that series (and even removed it from the site) because I wanted people to focus on this series; I wanted to focus on this series. I wanted to take Starling for a spin and see how it did, then I wanted to write about it because telling Biscuit, my kitty, all about flattening Sprites and game ticks with the Juggler, he was not amused. Maybe he was? I dunno, he kindof has the same face all the time. Smile Kitty, damn you! Anyways…

Being a Developer, I know there’s a learning curve with any new language, engine, or library that you’re wanting to try out. For some of these libraries, the learning curve is stupid easy. Greensock’s Tweening and Loading libraries, for example, I can’t praise enough. He’s got excellent documentation, he’s built tools that Give you the code to paste if you want something to move on your screen, you really couldn’t ask for more. Sometimes the learning curve is steep… Assembly anyone? I guess it’s incredibly subjective saying something has a steep or shallow learning curve. If I had come fresh to AS3 and Starling, learning both at the same time, I’m sure the difficulty would’ve gone up exponentially. However, I was pleasantly surprised at how easy Starling was to incorporate into my project.

If you were reading closely throughout the series, you may have caught a few snarky remarks at Starling’s expense. Starling is growing and evolving, it’s relatively new, and all things aren’t exactly the way I personally was hoping for them to be. Oh well, get over it dude, because the positives of what Starling does for me outnumber those few quirks and gaps in functionality that I was commenting on.

It’s funny, last night I was checking out Starling’s github repo, just browsing through the commit log to see what the latest stuff was. It was impeccable timing as the latest commit said something about HOVER events. What?! I was just posting on how this was a pain, and clearly they’re actively working on adding new features and fixing bugs daily. These guys are on it. The community forums are thriving and they’ve got some great mods and users over there that make sure things get answered and people aren’t just hanging.

So, come on… what’s the real conclusion? Should I use Starling for my project?

The bottom line with any new library, tech, app, etc is that they are all tools. If what Starling does solves your project’s problems, then it sounds like it’s the right tool for your project. If your project is to make a 3D game then Starling is not right for your project. If your project is to make a platformer game, sure Starling can help, but there’s also CitrusEngine that builds on TOP of Starling, and has a lot of built-in functionality for platformer games.

Realistic Expectations

I went into Starling with an unrealistic expectation about just what a GPU-accelerated Flash game would be like. I bought Particle Designer and started making some cool particle effects, nothing crazy, just 200 particles for a single bullet’s particle effect. Yeah… so with about 8 Towers on the stage shooting every second or so, 8-15 (200 particles each) bullets on stage at a time, with ~30 enemies being animated on the screen, I was incredibly disappointed to find that I was running around 4-8 FPS. That wasn’t some failure of Starling’s, but an unrealistic expectation of how things were going to handle. I scaled the bullet particles down about 90% to about 20-30 particles, and things obviously bounced back. Now, mind you, most of my “benchmark” tests were done in debugging mode with tracing to the console still turned on. Obviously not the ideal environment for testing things like that as once you turn off tracing and get the SWF into a browser, things change dramatically. But still, do not expect any engine to do everything for you and solve all your problems and keep you warm at night. Read up on what Starling does. Download and use Starling. Work through some tutorials. Starling gets a LOT of things right, in my opinion. Sure I may take issue with this little inconsistency or a little “why didn’t they add this functionality”, but at the end of the day, the reason I 100% completed everything I set out to do in this tutorial series is because I enjoyed working with Starling.

It was familiar and easy to work with. It gave me a very easy way to run a game consistently at 50-60 FPS with a healthy amount of entities rendering on the stage. It gave me a very easy way to handle assets via the TextureAtlas. I was really happy using the Texture Packer app and TextureAtlas. The package hierarchy was built exactly like Flash. You don’t realize how important that is to new folks incorporating Starling into their existing codebase. It just makes sense and makes things easy. Starling sped up my development by a decent amount. It handled a lot of things that I had previously written in my old engine, or was going to write, but now, didn’t need to.

I guess the point is, don’t think that because it’s GPU-accelerated that you’re home free, that you can code sloppily and the GPU will have your back. Because it won’t. You be nice to Starling… don’t feed it 2,000 bullet particles plus 30 enemies animating and expect that next game tick to be a happy one. It will puke right on your new pants, man.

Things I Got Wrong

As more people read the series, I’m sure I’ll have more things to add and update here.

KeyboardEvents

After going through Starling’s docs (not sure how I missed this before), Starling does have a KeyboardEvent class. Apparently starling.display.Stage WILL dispatch keyUp and keyDown events as you would expect them to and in the same manner as you’re accustomed in AS3. I have not used them, nor gone back to incorporate them into my demo, though for the next project I may update that. I don’t think there’s anything wrong with having a flash event listener on the flash stage listening for a keyDown, but just to keep it all simple, might as well use Starling’s keyDown/keyUp.

TouchEvents

TouchEvents were a tough sell for me starting Starling. I wanted my Flash MouseEvents. They worked. They did what I expected them to do. It took me a day or two of working with Starling to stop complaining about how TouchEvents were different, and just shut up and use them. You’re in Starling’s world… deal with it. And as I was mentioning before, it made me really excited to see the new TouchProcessor class in the Repo. There are no docs posted for it yet but if you know where to look you can find it. It *should be* the perfect blend of Starling/Sparrow TouchEvents with classic Flash MouseEvents. I’m really excited about this as it’s being written to be quite extensible.

Apps Used

I have to give a few shoutouts to a few Apps that just absolutely go hand-in-hand with easy Starling development. You see them in almost every tutorial, but they just make things oh so much easier.

Special Thanks

So I think that’s it for now. I may update this post as things change or I realize I did more stuff wrong.

Thanks, and I hope this series was helpful!

-Travis

Series Navigation<< AS3 Starling Tower Defense Tutorial – Part 10 – Bullets, Collisions, and Managers
FacebookTwitterGoogle+Share

3 Comments

 Add your comment
  1. Great tutorial!
    Thanks.

  2. Where can one preview the final game?

Leave a Comment

Your email address will not be published.