The Companion Site for the Book ActionScript 3.0 Game Programming University

 
About the Book
Book Source Files
Q&A Forum
Buy the Book
Book Table of Contents
Book Corrections
All Articles
Email Newsletter
Contact

Looking for examples of Flash games? Try the free Flash games at GameScene.com and the iPhone games at MacMost.com.
Learn about the book ActionScript 3.0 Game Programming University.


Download the audio file.
Transcript:
G: Hi, and welcome to the Flash Game University Podcast episode number 2.
W: Or welcome back if you've just listened to our first one.
G: This is...we're at http://flashgameu.com. I'm Gary Rosenzweig and with me is William Follett.

W: Hey guys.
G: In this episode I want to talk specifically about the book. The book is ActionScript 3.0 Game Programming University by Gary Rosenzweig. Hey, that's me.
W: Some illustrations by Will Follett.
G: Yes, and the front cover character and everything like that...
W: By Will Follett.
G: By Will Follett. So, I wanted to talk about the book and talk about what it's about. It comes out end of August, hopefully, according to Amazon. It's all done now at this point we're recording this the very last day of July.
W: And you can probably pre-order it.
G: You can definitely pre-order it, and I have a link at the website. You can even preview the book at this thing called IT Safari which I think I have a link to in one of my blog posts. But, no point in doing that now and paying all the extra money now because by the time you hear this it will be really close for the book to come out. So the book is about ActionScript 3 game programming. I'm really excited about ActionScript 3 because this is not...it's almost misleading to say well there's ActionScript and there's ActionScript 2 and there's ActionScript 3 and they're just like iterations of the same thing. ActionScript 3 is almost a totally different thing than previous versions of ActionScript.
W: Really?
G: Yes, there's an engine in Flash that interprets the commands and in Flash 8 and earlier it interpreted all these ActionScript commands and everything and it was very slow which made it hard to make games.
W: It wasn't zippy at all.
G: No. You couldn't program things like path finding and checking lots of collisions and all this stuff, because it was just too slow and it was a problem with Flash. ActionScript 3 is a completely new engine for doing this and it is way faster. For a lot of tasks, a level of magnitude faster, maybe two levels of magnitude, maybe a hundred times faster.
W: Really?
G: Yes, so there's amazing things you can do. It got me very excited about Flash's game development platform again. I liked it at first and of course I wrote two books on Flash programming before, but this time boy you can just do some amazing things. It's not that you couldn't do some things before, but before you had to optimize. You would like write a game and it would work and then you would have to spend like twice that amount of time optimizing it until it would actually work on most computers. ActionScript 3 you can actually just program it and it works and it's done.
W: And it works fast.
G: And it works fast, like the way you should program it.
W: You can see the difference between similar games.
G: Oh, huge difference.
W: Earlier platform games were slow.
G: I tried to make a platform game in Flash and it's kind of slow and it was hard. In ActionScript 3 you can do all of the calculations and everything so much faster.
W: This new one is just right on.
G: So, I was excited about that. I've decided to come out of kind of retirement. For the last four years I've been saying I've retired from book writing. But, I got so excited about ActionScript 3 and I said boy there really needs to be a book on this soon and I think I'm going to do it, why not? I wrote a new one. I've written...the books in the past they were Flash 5 ActionScript For Fun and Games, and then the sequel Flash MX ActionScript For Fun and Games. This is not a continuation of that series.
W: It's a whole new series.
G: It's a whole new series, even though some of the games, of course, I mean you're going to do a book on game programming and you're going to include like a matching game and there's a matching game in those two books and there's a matching game in the new book, but I didn't even look at the old books to actually write this new one. I completely wrote new code because the ActionScript 3 way of doing things is so different.
W: That's basically to teach the fundamentals of game programming.
G: Exactly, so this is a book from scratch. It's a whole new thing. You can almost think of earlier versions of Flash being a different program than this new version of Flash and this is doing it for this new program. I've also written a lot of books about Director and Shockwave and things like that. I wrote a book called Teach Yourself ActionScript in 24 Hours, for Sams, which was ActionScript 1.
W: I remember that one.
G: Yeah, that was not even ActionScript 2. So, that book is so obsolete now. This new one is just, boy it's a different animal in a lot of ways. The idea here is, I really want to teach people how to do things the ActionScript 3 way. The ActionScript 3 is not very well defined now, because it will be defined as people start using it in writing large programs in it. But I kind of adapted the way that the documentation uses. I adapted the way the Flex developers, Flex is another program that produces Flash movies just like Flash does, so Flex developers had been using ActionScript 3 for six months before Flash developers were, and I looked at the way they were doing programming and then I also looked at the way, 'what do you want to do for games?' and I adapted this style of programming for ActionScript 3 that I think works really well. One of the things you can do with ActionScript 3 is you can have like a ton of different files, like class files, so you can have like say, one that controls like the player, one that controls like the enemies in the game, one that controls the map in the game and all this. You can divide it up into a lot of things. That gets really cumbersome. It makes sense when you're doing like a large project like maybe multiple programmers, long development times and all that. But I think it bogs down game development, so I followed the one ActionScript class for each game type of thing. It makes development fast and easy. That's kind of the idea that the book teaches. The first game which is in Chapter 3, which is the matching game, actually builds up this class from like a version of a very simple thing, it just puts the cards on the screen and the next one, okay we're going to move them, and the next one I built it up in ten steps. The rest of the chapters take the approach of, 'here's the whole class,' and then here's how it's built and what it does, and that's how that works. In the book, let's see, what do we have in the book? There's twelve chapters in the book. It's about 450 plus pages. The first chapter really goes into the basics of ActionScript 3. So it teaches you basically a little bit about the language. It's for beginners, but it's also for people who might be used to programming in older versions of ActionScript. Then it shows you the basics, shows you how to build this class file, do a little "Hello World" program, you know what are the basic things for conditional statements, like if/then statements, and also for loops and stuff like that. You build a couple simple little examples. Second chapter is one I'm really excited about. It's building blocks for games. It goes through about twenty or thirty building blocks. Things like little physics of a ball getting thrown or collision detection or just storing data, that type of thing.
W: All sorts of useful stuff.
G: Yeah, they're like little nuggets that you can actually take and use in your games.
W: You can use in other games.
G: Yeah, and by building these little building blocks, you're getting ready for the next step which is to build a full game. So, I'm really excited about Chapter 2 because there's things like how to tell time, and things like that that are in there, that's real easy. How do you play a sound? That's a good example. So, playing a sound, I always had trouble with ActionScript 2, remembering what the sequence you've got to do to attach a sound and all that, and it's completely different in ActionScript 3 to play a sound.
W: Really?
?'
G: It's like two lines, and it's like, 'what is it again?' I haven't done it in a few weeks and I can't remember. Well, I've just got it in there, so it's easy to refer to. Even I've referred to it at this point a few weeks after finishing writing. So, that's Chapter 2. Then Chapter 3 goes into that matching game which is the basic thing where you have to match two cards, turn over two cards and see if they match. And it builds it up in ten steps, adding something to each part, and the last part, the tenth part is a fairly robust matching game with animation and everything, but you get to just kind of learn how to do it step by step.
W: These are the basics, this is like the early classes in your university career.
G: Right. There's something in this book for beginners and there's stuff for advanced users. Wait 'til you see what the last few chapters have. Chapter 4 is a memory game and a deduction game. A memory game being like repeat the sequence and deduction is basically Mastermind, the old game Mastermind, the tags and all that. So, it goes a little further into building games and it shows you everything about those games and how they were built in ActionScript 3. Then we go into, Chapter 5 goes into animation and there's shooting and bouncing games. So, a little paddle game, a paddle with bricks and everything.
W: Which, luckily you've read that chapter about ball detection.
G: Right, yeah there's some parts from earlier, from collision detection stuff. There's also a game in there called Air Raid in there, where you're shooting at little objects flying by. So, it's some basic arcade game stuff.
W: Kind of cool looking...
G: ...Yeah, you drew those neat, retro looking air planes.
W: That's right.
G: And then we go into picture puzzles, and we have a sliding puzzle where you know you click and the squares slide around the screen. We do some work on the image...there's a great image engine in Flash, so I actually take the image, it's one .jpg and I break it apart.
W: In Flash?
G: Which is great. Which in the older books we used to have to do things like, okay, break it apart in Photoshop and then bring it in. Well, here you just have to supply a .jpg and it breaks it apart. For the jigsaw puzzle, actually the same thing, now a lot books, other books I've looked at that have jigsaw puzzles in them, and it's like you have a grid and you drag the puzzle pieces onto the grid.
W: Yeah.
G: This is actually a free flowing jigsaw puzzle. Like you actually can attach two pieces together and then move those two pieces as one.
W: You can build in different parts of the puzzle. You can build this corner down here.
G: Build the edges first.
W: Yeah, work on the edges, work on the middle.
G: I did a lot of effort to actually simplify these ideas, instead of actually saying, 'Well this is...I can make this really complex.' But instead, how can bring this down to the nugget of what you're trying to learn here as a programmer, and make it still a good game. So, I did a lot of work where I tried to simplify things and not do them the brute force, obvious way. But try to look for clever ways to actually do these that are simpler than what you would first think to do.
W: Yeah.
G: The next one is more of a movement arcade game, it's Space Rocks, a game I think I've done in every book I've ever written, and it's basically Asteroids.
W: Yeah.
G: So, you've got rotation and firing and these rocks getting blasted apart, and all that. This is a great game, a lot people from my older books have taken this Space Rocks type game and customized it to be something completely different.
W: Because they're learning, you're learning the fundamentals.
G: Right.
W: So you can build something greater.
G: Exactly. And then the next one, this is something new. It's going to a casual game and I teach how to do Match Three. Now Match Three is also know by a lot of names, including Bejeweled and Diamond Mine, and things like that. It's a basic...if you go to Real Arcade, you know and you look at all their games, half of them are match three games, and they all start off in the instructions, you can recognize them because they say try to match three or more pieces by swapping, so it's like the whole casual game genre almost means match three. So, you're swapping these pieces and they drop down. You can actually build one, you've got the full source code in the book to build one. We actually did one, ours is little gems, because that seems to be the most recognizable thing to do.
W: That's right.
G: Then we move on the stuff that uses text. So, we have the trivia games, the question and answer games, and this is definitely, of my old books, people love to adapt these and I guess there are a lot of educators using these books.
W: These could be testing engines.
G: And I carry it really far here. Because not only does it start with a basic quiz engine, where you can ask questions back and forth, but it arranges them very nicely. And then I have it go further into having things like timers, so you have time to answer the question. You've got Hint, you can ask for a hint. And then after the question you can get an additional piece of information. So, for instance, you know an explanation of why that is the correct answer. Then I carry it further and actually go and say, well, how do get even pictures into it? And I have a little thing where you can ask a question like, 'Which one is an equilateral triangle?' and have four pictures, and the pictures are actually, it's still external XML. I'm using XML for these, so you actually can have a lot of quiz engines and educational engines can export XML, so you can bring this in to this, and/or write your own XML and then you can actually have these little images be like external .swf's that it brings in and asks questions with pictures. So, much more advanced than anything I've ever done with trivia and quiz in the past, and much more adaptable as well.
W: Well, that sounds useful.
G: Yeah, it should be. Chapter 10 goes into more traditional type of word games. Hang Man is one I teach very quickly to show how simple it can be, and then I go into a much more complex Word Search example, of how to do that, and actually randomly arranging the words and then being able to select them. The next one I go into, Chapter 11, is action games and here's revisiting the platform game.
W: This is my favorite chapter.
G: Much more advanced platform game than I've done in the past in a book, because I can do it much simpler in ActionScript 3. Actually, I do a complete two level little thing where you have to go and get a key and open a chest. People should have a lot of fun adapting this code, because it's two levels but you know you can go and build forty levels and have different things in it.
W: Build as many levels as you want. It runs fast.
G: Yes.
W: This ActionScript 3 it's zippy.
G: It is.
W: I can't describe it any other way.
G: It's great. And then the last chapter, Chapter 12, we actually turn ninety degrees and we're looking top down, and we do two top down games. One is a racing game, where you're actually racing around a track, using some interesting collision detection stuff to allow you...you know you hit the side of the road and you go slower and everything. And then I do another one, where you're actually driving around Flash Game University, a little fictional campus, and you can't go onto the city blocks you have to stay on the streets, and then you can collect objects. And actually I took that and I added a few things to it and it's actually at our website as Campus Clean Up. But in the book it's just the Chapter 12 game, top down driving game. A great one to adapt. I see a lot of Flash games now where you're driving around a little area, collecting things, doing things. So, this is a framework for that. But it's also a complete game as well. So, that's the twelve chapters. At the site, I don't have them up yet, but before the release of the book I hope to have up all of these games as playable versions so you can actually play them on the website and see exactly what they do. And they'll be the exact versions in the book, so you'll actually be playing the real things that you're going to get when you buy the book and get the source code. Also, I wanted to say that these games can be used, if you're not like well a super developer and want to go in and alter these and learn this stuff, it's still a really good library to be able to take these games, swap out the artwork, and put them up on your website.
W: And create your own games.
G: And create your own games. So, it's a library. And if you are a good developer, and you've learned all the stuff in the book, but you need a quick start, you know you have maybe clients or your boss coming to you and saying, 'I want a game like this,' it's like oh, it's a match three game, I can start with Chapter 8 from this book and then modify it from there instead of starting from scratch. So a lot you can do and there's a more detailed table of contents up on the website already at http://flashgameu.com and as I said there'll be the example games also posted to http://flashgameu.com pretty soon. So that's it for this episode. Next episode I'm going to talk a little bit more about me.
W: Yes, let's talk about you. It's all about you.
G: Enough about me, what do you think of me? So alright, that's it for this episode. Thanks.
W: Bye.