A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Alternatives to flash for simple gaming

  1. #1
    Member
    Join Date
    Sep 2009
    Location
    South Spain
    Posts
    32

    Alternatives to flash for simple gaming

    Hi all,

    I'm developing a small videogame with AS2

    I'm not doing this OO style, and I find that as soon as I put a few tweens running at once and a few enemies shooting, it slows down pretty quick. I am doing a very typical onEnterFrame Event that constantly runs on an empty Movieclip and then checks different situations with "if" statemens, and a few loops to iterate through differernt enemies and obstacles. This happens on any pc as soon as there are a couple of things on the screen.

    The movieclips are small in size, and the canvas of the flash movie isnt that giant either (700 X 400) and there isnt too much going on. I'm using small vector clips, no bitmaps, no gradients no nothing.

    So my question is... I read several tips to keep performance high, ok, but I want do design a small videogame without having to worry about all these little annoying things. I'm guessing it's limited to the speed of the flash player and the specifications of the PC. What other options to I have? AS3 ... I'm guessing wouldnt make much of a difference. So what alternatives are there to building small games in AS2 with flash?

    Is Adobe Director too complicated for this? Is there anything else out there? Or is there something else I can do to build small games without having it slowing down constantly as soon as a few things are on the scren?

    Many thanks.

  2. #2
    Senior Member bluemagica's Avatar
    Join Date
    Jun 2008
    Posts
    766
    As3, is pretty fast, but the fastest I guess would be c++! But I don't think blaming it on the player is really ok, cause it might be a problem in your design that is causing the lag! Flash is a tested and proven platform, with people running stress tests on it from every angle.....and though it may not be the fastest, but I doubt a few instances can make it lag, unless they were coded poorly!
    If you like me, add me to your friends list .

    PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!

    My Arcade My Blog

    Add me on twitter:

  3. #3
    Member
    Join Date
    Sep 2009
    Location
    UK
    Posts
    40
    You really need to learn how to use Flash properly for games...

    Firstly avoid using tweens unless you really have to - they are very resource intensive! Learn to accomplish the same effects in actionscript and you'll notice that the speed improved massively!

    Secondly - you might want to avoid using vectors for some or all of your animations... Having the Flash engine redraw sprites again and again on every frame is again resoruce intensive. Depending on the style of game, and the complexity of your sprites you may be better off using bitmaps - convert your sprites to PNG files with transparant backgrounds and move those around - again you'll probably find you get a big speed increase!

    Then concentrate on writing effictent code! For most problems there are a number of ways to approach them, with games it's important to make sure the way you choose is efficient. AS3 will be generlaly faster than AS2, but only if your coding is up to par!

    Hope that helps,

    Billy

  4. #4
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    bluemagica:
    No, sadly that´s not true.
    Sure sloppy coding can lead to bad performance, too but even the best coded AS3 thingy that is highly optimized for performance can still easily get slowed down a lot by flash´s serious problems regarding display performance.
    Its known that flash will slow down as soon as you use many vector shapes at once, even more when they are using gradient fills, then it will also generally have a performance hit to use alpha gradients and too many filters. Well, in general anything you can do graphically in flash will in high doses (regarding flash´s limitations, not those of other technologies) lead to serious slowdowns.
    While initially seemingly a good solution to fix those problems, doing things in bitmapdata setup or setting on cacheAsBitmap can in return lead to way higher memory requirements depending on how you do it, hence in return again not running nice or even freezing or crashing for people with less free memory (or browsers that limit memory consumption for plugins heavily).
    So yeah, basically with flash you have to watch out how you set up things on display side a good bit and not overdue any fancy graphical stuff flash is known for to struggle with in high doses.
    So in this case charging from what you said bastrix you could try to reduce the amount of vector shapes being there at once, maybe turn on cacheABitmap for them if there aren´t lots of them and the shapes themselves don´t change often or do them as raster graphics in first place. If its fitting for your graphic setup type you might also want to consider doing stuff in bitmapdata setup way.

    If you want to go for other technologies than flash instead I suggest that you first decide where and in which way you want to release your game, cause that already narrows down the options:

    If you want to release your game as browser game to be played back on a standard website you essentially have 4 options for 2D games:
    silverlight, flash, director and unity3d

    There are others out there but those are less widely adopted and you might run into problems putting your game out there on various sites if you don´t go for the more adopted plugins. If you want to publish the game on your own site or one of a client that accepts more plugins than those, cool of course.

    Maybe on that note its also worth adding that there are some few sites like garagegame´s games portal which allow to do games in various other "offline" standalone game manners and still play them back on the browser via their wrapper.


    Then you have again other/more options when you instead of going for browser distribution go for standalone/download or other platform distribution.

    So yeah, once you decided for which platform/distribution way you want to go you can pick alternatives that make sense on that.
    Last edited by tomsamson; 09-23-2009 at 09:06 AM.

  5. #5
    Member
    Join Date
    Sep 2009
    Location
    South Spain
    Posts
    32
    Thanks for your replies and the tips.

    Thanks tomsamson that was very helpful.

    I'm not sure about using bitmaps would increase performance in this case and most of the tweens are done by actionscript also with the Tween class. There are no gradients, and there are no filters.

    True, my code might not be the best (I havent coded properly in actionscript since I first learnt actionscript 2) but in my opinion there is hardly anything there for it to run slow. Maybe because its looping through several movieclips to use the hitTest?

    I guess it will be easier if I post an example of what I'm building:
    http://www.marbelladelsol.com/minigame/index2.html

    Now you can see the vector graphics are really simple, and you can see the helicopter follows your cursor with a eased Tween done in actionscript. Ok, so as soon as I place a few of those tanks, and you try to move quickly, you will see how it lags on most PCs.

    Btw tomsamson, would you recommend any of those technologies you mentioned instead of Flash? And I mean if you are focusing in using it exactly and only for that purpose: Small games for the net.

    Many thanks

  6. #6
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    Doing your graphics as raster graphics would definately bump up your performance in this case, even with basic shaped vector graphics that has a considerable performance hit in flash (preferably you export ones with transparency as png and then for those which get scaled or rotated they would look jerky without smothing so you choose them in the library, right click to bring up their properties info and turn on smoothing there for them, for those which don´t get scaled or rotated skip that step).


    regarding the technologies i talked about silverlight on most setups has no hardware acceleration for display side things either so it probably wouldn´t perform massively better than flash right now.
    Director and unity3d would surely perform A LOT better in well done setup, but personally i don´t like director cause it feels very outdated on other ends to me, so yeah, i personally go for flash and unity3d for web stuff.
    I think you should already get a good bit better performance once you replace the vector art with raster graphic versions. If after that you´re still not satisfied with flash and/or maybe also can picture doing more involved stuff in this game or others flash is definately not capable of and/or bring stuff to iphone or Wii, too, then, yes, i´d suggest going for unity3d, but just regarding this single game i think it should run reasonably fine as it is right now once you replace the vector graphics, so dunno if i´d redo it again in another technology.

  7. #7
    Member
    Join Date
    Sep 2009
    Location
    South Spain
    Posts
    32
    Quote Originally Posted by tomsamson View Post
    Doing your graphics as raster graphics would definately bump up your performance in this case, even with basic shaped vector graphics that has a considerable performance hit in flash (preferably you export ones with transparency as png and then for those which get scaled or rotated they would look jerky without smothing so you choose them in the library, right click to bring up their properties info and turn on smoothing there for them, for those which don´t get scaled or rotated skip that step).


    regarding the technologies i talked about silverlight on most setups has no hardware acceleration for display side things either so it probably wouldn´t perform massively better than flash right now.
    Director and unity3d would surely perform A LOT better in well done setup, but personally i don´t like director cause it feels very outdated on other ends to me, so yeah, i personally go for flash and unity3d for web stuff.
    I think you should already get a good bit better performance once you replace the vector art with raster graphic versions. If after that you´re still not satisfied with flash and/or maybe also can picture doing more involved stuff in this game or others flash is definately not capable of and/or bring stuff to iphone or Wii, too, then, yes, i´d suggest going for unity3d, but just regarding this single game i think it should run reasonably fine as it is right now once you replace the vector graphics, so dunno if i´d redo it again in another technology.
    Thanks again for your helpful post there. I will do what you suggested and export all images as png from Fireworks.

    I don't think I will redo this specific simple game in another technology as you say but I'd like to get into more serious gaming (always keeping in mind is simple enough to develop as an individual, simple games for web mainly). So I will have a look unity3d.

  8. #8
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    You´re welcome =)
    And well, regarding unity3d: One can get way (way) better performance and do a lot fancier stuff than in flash with it but its really tailored as 3d game engine; doing anything 2D is still totally doable but it can be more work than in flash in setup as it comes with less features for 2D setup stuff.
    That said if you intend to get into more serious gaming with time unity3D definately is a great choice thanks to allowing to do things that surpass flash´s capabilities on many ends and then also allowing to deploy them on platforms flash is not available on or runs a lot worse on than (already) on higher up desktop machines.

  9. #9
    Member
    Join Date
    Sep 2009
    Location
    South Spain
    Posts
    32
    Quote Originally Posted by tomsamson View Post
    You´re welcome =)
    And well, regarding unity3d: One can get way (way) better performance and do a lot fancier stuff than in flash with it but its really tailored as 3d game engine; doing anything 2D is still totally doable but it can be more work than in flash in setup as it comes with less features for 2D setup stuff.
    That said if you intend to get into more serious gaming with time unity3D definately is a great choice thanks to allowing to do things that surpass flash´s capabilities on many ends and then also allowing to deploy them on platforms flash is not available on or runs a lot worse on than (already) on higher up desktop machines.
    Sounds like a toy I'd like to play with yeah Talking about different platforms... Would unity3d be also an option to design games for iPhone? Since you mentioned iPhone earlier, I was just wondering... If I was to learn some new stuff that has a big learning curve, might as well learn something that also has some possibilities to make money out of it, apart from being a fun hobby

  10. #10
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    Yeah, its definitely fun stuff to play with =)
    And yeah, unity3d is great for creating games for the iPhone. They released unity iPhone a good while ago and that allows to create xcode projects for iPhone deploy right from the unity IDE. You then hit compile and can install and run your game on the iPhone/ iPod touch right away. There´s also unity remote which is an app for iphone/ iPod that once you run it connects to your machine with unity running on it and you can run the game in the editor and the picture is streamed to your iPhone/iPod and the input of the iPhone is brought into the game so that´s a nice way to quickly test controls of a game for example without actually compiling it (which takes a bit longer so you´d do that for getting the actual look and performance etc feedback on the device).

    When developing for the iphone/iPod you of course can´t use all the latest 3d hardware using features but the performance of unity on it is still pretty nice (and still way higher when compared to flash running on a highend pc).

    What´s also nice about unity is that you can code in Boo, Javascript and C# and even mix and mash em in a single project.

    There are only few differences on codeside between unity desktop/web and unity iPhone projects so once you know about those you can basically turn the codeside of a desktop project into an iPhone ready project in less than an hour to my experience.
    (Those changes would make the desktop version run at nicer performance, too so once you´re used to em you´d usually want to do your iphone and desktop projects the same way right away, then it runs best on all and no porting work is needed on codeside).

    Then usually one changes the controls to be more suited to iphone and then tweak things on graphical side, but that´s about it regarding what you have to do to bring your game over to the iPhone/iPod for most games really.

    Again, for a super tiny game using unity might seem like shooting at birds using a cannon but for more involved stuff its pretty nice.

  11. #11
    Senior Member
    Join Date
    Feb 2004
    Posts
    312
    learn python.

  12. #12
    On one note.. Using tweens, I'd HIGHLY suggest checking out tweenlite.

    Here's a comparison link.
    http://blog.greensock.com/tweening-speed-test/


    It basically shows how bad the built in Adobe Tween is. I've been using it and it's ALOT faster than the stock one and also doesn't randomly break. I didn't see anybody else recomend this yet so that would be my advice. It can also do a bit more and with less code. Definately check that out for any tweening you need done. It'll be a guaranteed boost over the normal one your used to using. I think they have tweenlite for both AS2 and AS3. I use it for AS3.

  13. #13
    Member
    Join Date
    Sep 2009
    Location
    South Spain
    Posts
    32
    Thanks again, very helpful.

    I'm using the library you suggested robscherer123, I found it to work great, MUCH more smoother now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center