Home > Dev > Flash for big Games?

Flash for big Games?

Even though I love ActionScript more than my daily meal I’ve recently started to think about if the Flash Platform is actually the right stuff for developing big games. Most Flash game developers write small-scale games for the web which is totally fine and I too like to write a small coffee-break game sometimes but often I’m craving for more! My dream has since long been to design and develop a large-scale role-playing game and I’m usually overflowing from new ideas coming to my mind every day that it’s almost hard to track all of them.

I could go on and make this project an oldschool-style game with 2D graphics like some other indie devs are doing but I feel that going 3D would be the best bet to convey atmosphere and tactical gameplay at the same time (you could use switchable first-person and third-person views). This makes me think if ActionScript is actually sufficient for this but the experience of some of my recent coding tests with Away3D which already start to bog down the CPU with a few hundred polygons on the screen tend to say “no!” to my ambitious plans.

Since this is a desktop game my platform choice is AIR which offers more freedom that the Web Player but there are still many let-downs that make you grind your teeth …

Hardware 3D

Without a doubt the biggest problem is the lack of hardware-accelerated 3D rendering. With the current software-rendering engines you could make simple 3D games where you try to always keep down poly-count to an absolute minimum. Basically your game will then look like anno 2000, if not worse. I remember most games of the late nineties to early two-thousands as having these “wood  puppet”-appearing character models, both in terms of look and animation. I must admit that some games achieved quite good quality for the technology they were running on, for example Metal Gear Solid on the first-gen Playstation. Would that be possible in Flash? Probably yes, with a lot of trickery but who wants to make games that look that outdated? As I mentioned in another post, I’d be better off with well designed 2D instead.

Not sure what Adobe is doing regarding 3D but sure is if if they are sleeping on this, the competition will not sleep and we might see developers wander over to Silverlight or Unity3D.

Full-screen Resolutions

There are several other painfully missing features in Adobe AIR which I hope Adobe will care about. One such feature would be the option to change the screen resolution! As it is currently if you switch your game to full screen it will run at the same resolution in that the player runs the OS in. Screens have become larger and with that screen resolutions have too. If you now switch your Papervision game – which was running fine in a 640 x 480 window – to fullscreen in 1920 x 1200 you can watch how your game is being degraded into a slideshow! Fullscreen games would profit a lot from being able to change screen resolutions.

The fullscreen mode brings me to another bugger: The Escape key! Adobe has the opinion that the Escape key must not be remapped and that it should solely be used to close a full screen mode. I guess they did this for security reasons so that an ill-intended coder cannot hijack your screen. However I disagree with this rationale! Such a coder could use C, Java or Python or any other universal programming platform for that matter in a much more suitable way. Some security restrictions go too far and the Escape key is one of them. It’s more of a blocker than a help!

Resource Files

Most modern commercial games use what is called Resource Files; large compressed archive files which contain all of the game’s media and data files. These files are often in the hundreds of megabytes up to several gigabytes. While I doubt that I will make a game anytime soon that has an assets library of several gigabytes I can imagine that my current project could go easily up into several hundred megabytes of assets.
The commercial developers use resource file formats to organize their asset files into nicely compact files. These resource files house many advantages over just simply having your naked files on the harddisk. Among the advantages are compactness, protection, easy file distribution and better structural organization.

With ActionScript you could load compressed Zip files that store all your games’ assets but there’s a tiny but important catch to this: Most of those commercial games which are written in C++ and which utilize the file system have the ability to access any of the packed files quickly and right at their position in the resource archive without the need to load the whole resource archive into memory first. In fact you wouldn’t want to load a 4Gb file into memory completely but how about a 200Mb file? While that’s possible it’s not a best-practice.

ActionScript currently provides the URLStream class that can be used to stream a file in but it still does so only in a linear way. You could start loading your Zip file, check which assets from it is available, abort loading and use the asset but this is sub-optimal! Imagine your file is somewhere at the end of the Zip file you’d still have to load the whole Zip file first. ActionScript (or in particular AIR) would go nicely with a URLStream class, or even a completely new API that could make optimal use of a Resource File format which houses compressed media and data files. Maybe Adobe could even introduce a specific new file format for this purpose. That would be ultimately nice!

I have no idea where Adobe stands with the future plans for Flash and whether some or all of the above mentioned points are resolved at some time or if they are never resolved in which case I’d get the impression that the Flash platform is a sinking ship for me – which I do not hope for!

Currently we as Flash game developers (I hate that name!) are standing at the fence which borders on that green and juicy meadow of professional game development and we can only hope that things improve in our favor so we too can graze on that green grass where the big cows are reveling.

Categories: Dev Tags: , , , ,
  1. August 26th, 2009 at 17:28 | #1

    You know, both Alien Homonid and Castle Crashers were written in Flash, in AS1 of all things! Its absolutely possible to make fantastic games for consoles in Flash

  2. August 26th, 2009 at 17:51 | #2

    Fullscreen res isn’t needed we have fullScreenRect

  3. August 26th, 2009 at 19:14 | #3

    @Tom Vian,
    Alien Homonid, I believe, was created initially in Flash as a prototype. It was then ported over to multiple consoles and created as a native application from the ground up.
    Although I could be mistaken.

  4. August 26th, 2009 at 21:19 | #4

    Issue number three: Create your main .pak file, then create an utility that slices it into X 10 mb chunks along with an automatically generated resourcelist. You’ll have 50 pak files, but does the user care? No.

    Issue number two:

    var txtMsg:TextField = new TextField();
    sprInstructionsPanel.addChild(txtMsg);
    txtMsg.text = “To enjoy the game to it’s fullest, please change your screen resolution to 640×480. You can do this by minimizing this game, right-clicking on your wallpaper and choosing properties.”

    Was it *really* that hard?

    Issue number one:

    Unsolvable. I have no idea what kind of convulted mess AS3 is, but if Adobe wants Flash to be of any use, they need to rewrite the legacy 1997 remains of AS1, replace the //TODO: Add real font support here with real font support and start using interfaces.

  5. August 26th, 2009 at 22:29 | #5

    Resource management is a non-issue… you load what you can when you need it. If the platform/language supports or can handle large .pak files – great. If not, then developers need to be more judicious. I can understand your point… but every platform has limits (some are better than others).

    I blogged about a few items just the other day (Adobe press releases) that are interesting on the 3D front.
    http://www.quilix.com/node/57

    Following PushButton is a definite todo!
    http://pushbuttonengine.com/

  6. August 27th, 2009 at 00:02 | #6

    Completely agree that Adobe really risks to miss opportunity with 3D. Unity is already gathering a lot of hype in 3D browser games segment + it uses C# as language which is a bonus too. Many contests that were Flash only accept Unity now. And there are contests for game development that are Unity exclusive. Many developers who make games I know of are switched already or are planing to. And I plan too. Just need new notebook first :) Thing is will those developers come back after Adobe adds hardware acceleration? I kind of doubt. And I fear it may be already too late… They waited to long and on this front they are more like last then first. Even JavaScript has Canvas3D and some other things. But at the beginning of this month Khronos announced WebGL. And OpenGL ES version for browsers controlled by JavaScript and this project is backed up by AMD, Ericsson, Google, Mozilla, NVIDIA and Opera. Sounds serious huh? Why bother with Flash if even HTML/JavaScript will have hardware acceleration.

    As for other things you mentioned…

    Not shore about resource files and your use case but this problem in web can be handled with help of server side scripting. I mean that you can stream file trough script giving offset as a parameter. Will not do for AIR tough as that seems to be where you want to use it. Large files for browser games are a bad idea. Our Internet is not so fast yet.

    As for resolution. This is a nice addition but is not of utmost importance. But it can make performance + user experience a lot better with games.

    As for buttons not working right in full-screen mode. Well in browser I agree with Adobe here. I don’t want to see Flash used in a way that JavaScript is used sometimes making it impossible to close the page or do anything else… May be if there was some other way to close/stop Flash like Flash player task manager that shows all ruining SWF files and allows to stop them or change their priority or even ban them. Well that just idea…

  7. August 27th, 2009 at 00:17 | #7

    @Daniel Love
    There was an original Flash game of Alien Homonid, but the full console releases (with the exception of the GBA version) were all written in AS1, as was Castle Crashers.

  8. August 27th, 2009 at 01:23 | #8

    @maliboo ok using fullScreenRect would be kind of a workaround but in my opinion it’s still not as good as riding on a lower resolution.

    @archont @Rick Yes the resource files are not an issue but would be an optimization for AIR development. Creating several smaller pak files is the only way to solve this atm. For web development this is a whole different story but on the desktop I’d prefer a compact format over loose image-, xml and whatnot files.

    @archont Issue 2: Oh please! You can’t be serious! How many people do you know who would switch screen resolution manually everytime they start/end playing your game? I would not be one of them! This is unacceptable.
    On AS3: I think the language itself is fine, it just needs some missing OOP features. The structure of the language is ok in my book. But I guess you’re talking about the runtime? I don’t have much insight into that so I can’t really make up an opinion about that.

    @wonderwhy-er changing screen resolution would have a very high priority for me since I don’t want to create games that run only in a window and only being able to accept the user’s current screen res is a big problem.

    On the web player I can understand the full-screen security measures but as I wrote above I don’t see where they would be useful in AIR.

  9. August 27th, 2009 at 02:46 | #9

    Great Article, I agree Adobe should focus on becoming the best big game platform it can be (ie Hardware Accel, memory management, faster math processing, multi-threads).

  10. August 27th, 2009 at 03:30 | #10

    @sascha:

    Flash is a crappy platform. I have to use workarounds all the time. Now, for example, I had to struggle with embedding polish bitmap fonts into Flex. The only way to do so is using Flash’s library->new Font, however that method includes all european characters, norwegian, spanish, german, french… EXCEPT polish. And there’s no way, short of decompiling and recompiling the Flash CS4 IDE to force it to embed additional fonts.

    However, if a workaround is technically possible, even if it means unzipping, decompiling, parsing, injecting and recompiling an SWF file from AS at runtime, then it’s doable and that isn’t an insurmountable problem. Don’t complain, some people have it worse.

    As for changing resolution: I would do it. I don’t know what kind of gamer are you targetting, but if I spend 4+ months on a game, the player won’t exactly work himself to death if he changes the resolution. And even if he doesn’t he’ll just be playing in a small window, get pissed off at it and change it eventually. Then again, why not just render to a 640×480 buffer and then use a Shader, alchemy or some other fast, fancy method to scale the image to screen res? Using a simple algorithm similar to directx’s point filtering wouldn’t be terribly slow. Especially with some C++ code, however it would run pitifully on a Mac – then again, who uses that junk anyway?

  11. August 27th, 2009 at 11:46 | #11

    @archont Doesn’t it work to embed the polish font if you put a movieclip-wrapped textfield with all needed chars into the library swf and export it at runtime? I know Font embedding is one of the weaknesses of Flash, especially when mixing Flex and Flash.

    The screen resolution changing only is desired for AIR of course and has no relation to the web runtime because there it would indeed be a security risk. I think it wouldn’t be too difficult for Adobe to implement that and with the AIR platform Adobe had applications and, well, I guess games in mind too. So that screen res feature is a no brainer.
    Your idea with using Pixel Bender shaders or Alchemy might help but is yet again another dirty workaround and therefore sub-optimal. And as programmers we don’t strive for sub-optimal things. ;)

  12. August 27th, 2009 at 11:57 | #12

    @iMAN Khabazian Yes I agree that Adobe should be looking more forward to game development. I guess they do at least for some part but then again it’s really difficult where Flash is going because Adobe isn’t exactly open about their directions with the platform.

    Hardware 3D would be a key element for game development if Adobe isn’t switching some gears higher and add that support to Flash they’ll loose that market to other platforms, especially Unity3D. In fact for some people they already lost so if we don’t see 3D support in v11 I guess it could become very difficult for Adobe to catch up on that market.

  13. August 27th, 2009 at 16:20 | #13

    have a look at
    http://www.dofus.com
    it is done completly in Flash at least up to version 2.0, which should be on its way.
    no 3d there, but still a quite big thing.
    not speaking about the server side though.

  14. August 27th, 2009 at 18:14 | #14

    sascha: It does work, but only if you’re using the fonts in the embedded SWF. External applications can use embedded fonts only if they are named font objects (that is, Font.enumerateFonts(false) returns an [object Tahoma], not an [object Font]) – the only way to do so is to register the font class, however the only way to actually declare a font class is from the library, as doing a Font.registerFont with getdefinitionByName on the “nameless”, textfield-embedded font resulted in my IDE crashing. And errors. Of course Flash CS4 supports the [Embed..] flex syntax, but that, again, doesn’t support bitmap fonts.

    As a code monkey I’ve long given up noble ideals of making things work the right way. Sure, I use MVC and all that fancy stuff, but all that goes crashing down when I encounter one of the many bugs in Flash. Like, for example, code in your IDE suddenly stops compiling for no reason whatsoever. No compile errors, nothing.

    The art is to take a dirty hack, wrap it into a clean and useful library.

  15. August 28th, 2009 at 01:57 | #15

    My previous comment did not show through, and I’m going to assume that’s because I included too many links and it was possibly picked up as spam. So I’m going to try again without any links, but mentioning other sites.

    Anyways, all signs lately show that Adobe seem to be getting more serious about game development. A while back Mike Chambers, Ted Patrick and other Adobe employees twittered about a internal full day summit where the various product teams got together to talk specifically about game development. They even made a cool logo that we might see more of, which is a blocky Space Invaders-like character, where the bottom blocks are made up of the Flash, AIR and Flex logos. Since then Adobe launched the “Adobe Arcade” blog focusing on news about game development and Flash. Mike Chambers recently asked on his blog what new API game developers would like to see in the Flash Player. Also on Adobe Arcade, you can see pictures of Mike Chambers building an classic stand-up arcade cabinet to play Flash games on (I imagine this will be on display at MAX).

    If you check out Jesse Warden’s blog, you will see an interesting post with many of the links I mentioned above about Flash game development. He’s guessing that this means Flash Player 11 will have a lot of focus on game developers.

    However, I’m not sure they will be able to get everything that game developers such as yourself have been asking for. Jim Corbett, who’s on the Flash Player team has mentioned in his Flash Internals v2 talks that he’s given at conferences that Adobe has been working on for some time hardware acceleration in Flash. According to him, Adobe have just been moving very slowly because of what they see as mistakes made with Director’s Shockwave plugin when hardware acceleration and a 3D engine were added in.

    Certainly, when it comes to 3D, it seems that Unity3D has a huge edge that I don’t think Flash or Microsoft with Silverlight will ever surpass. As it’s a custom plugin that has it’s sole focus is on 3D compared to Flash or Silverlight where the plugin has other focuses beyond 3D. That said when it comes to Flash, the reach of the plugin will likely always dwarf Unity3D.

    As for the escape key, I seriously doubt that will ever happen on the web for security reasons (do a Google search for the keywords: “bunnyhero full screen scaring people” to playful examples of how it could be abused). Not sure if Adobe will make the change for Adobe AIR, but I doubt it as they have generally been paranoid about security (with good reasons with the kind of backlash seen anytime there’s a Flash security flaw). However, personally I don’t think it’s that big of a deal, as other keys can always be used instead of escape.

  16. August 28th, 2009 at 03:03 | #16

    @Benjamin of course we all know Dofus! Great work if you ask me but as you said, it’s not 3D. I never doubted that it wouldn’t be possible to create such a 2D game in Flash. They seem to have some excellent graphic designers at their hand btw.

    @Matthew I welcome it if we see more improvement for game development in the next player version but I can’t imagine that it would be so terribly difficult for a company like Adobe to add hardware 3D to Flash. But if this would be impossible for the web runtime it should at least be supported for AIR where there’s a lot more room for ‘system-depending’ features.

    Like I said in another comment I mean the AIR runtime in regards to the escape key. It is clear that this security restriction is valid for the web runtime. But in my opinion Adobe is overreacting there for the AIR runtime. I’d like to be able to remap any key. Imagine a fullscreen game which allows the player to use keys to control all kinds of things in the game (and of course remap keys to your liking). In the heat of the fight, a combat or whatever the player accidentally hits ESC and is catapulted to windowed mode. I don’t know about you but I would find this a herb let-down in any commercial game. Because you as the player would always need to care about not to press the Escape key. It’s a bad design case, quite clearly. Sure it’s not the end of the world but still I’d like to create flawless games. Is that too much to ask for? Security restrictions like this are clearly misplaced in the AIR runtime!

  17. September 12th, 2009 at 02:44 | #17

    The sad thing is…

    http://www.viget.com/inspire/bi-directional-actionscript-javascript-communication

    Few years ago Adobe binged thousands of talented programmers to the platform, with big hope that Flash is worth of the word ‘PLATFORM’. In my opinion if 3D and multi threading issue will not be resolved within next flash player release, flash will back to plug-in status only. And I am wondering… is this what Macromedia was intend to do with flash? Stay as processor hungry environment in other hand friendly to produce programmers from designers and let them go away?? I am getting pised of sometimes when I am reading blogs of Flash Player Enginers when they tryiing to calm us down with a bit sarcasm style when we realised that next cool feature is actualy one big disapointment.

    Sad time for me…

  18. September 14th, 2009 at 02:43 | #18

    Well I finally had some time to check out the stage.fullScreenSourceRect property (used in an AIR app). This would actually be quite satisfying if graphics wouldn’t become so blurry if you scale a smaller screen area on a large resolution. In my case I’m using a 1024×640 area and project it on a 1920×1200 screen res and things start to look quite a bit blurry. I’d rather prefer it if things stay sharp … even if pixely.

  19. September 22nd, 2009 at 06:46 | #19

    Hey Sascha,
    i’ve also started to develop games for fullscreen air and am using fullScreenSourceRect to reduce the resolution. i don’t know if somebody answered on your escape key question, but there is a way to disable the default behaviour.
    Use fscommand(“trapallkeys”,”true”); and your fullscreen mode won’t change back to normal on escape key.
    3D in flash is too slow at the moment, but bitmap blitting is ok. You can make great games with 2D too.

  20. September 22nd, 2009 at 12:26 | #20

    Thanks for the hint Dominik! Right, we still have FSCommands at our disposal. I almost forgot about them. I will try that command! The fullScreenSourceRect is great but as mentioned in my last comment, if you project a small area onto a very large resolution you get a lot of blurring. It would be cool if we had rasterization filters (Scale2X, SuperEagle etc.) for that like they are common with many emulators (WinUAE, MAME, DOSBox) instead of Flash only applying a 4x blur algorithm.

  1. September 9th, 2009 at 02:12 | #1
  2. October 13th, 2014 at 10:54 | #2
You must be logged in to post a comment.