A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: [DISC] Bitmap Data (and Flash 8 in general)

  1. #1
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988

    [DISC] Bitmap Data (and Flash 8 in general)

    It has been awhile since the release of Flash 8. I've been looking around lately and have found a lot of experiments using things like Bitmap Data but no one really screaming "I've developed a game in Flash 8 using Bitmap Data which rocks!".

    When I look around at things involving Flash 8, I'd say about 90% or more seem to be using the filters, the new video compression/components, or using the blends. The only thing people seem to be using Bitmap Data for is creating a bitmap tile based engine.

    So, I'm curious:
    1) Have you worked with Bitmap Data?
    2) What do you think of Bitmap Data?
    3) Can you see any application for Bitmap Data besides creating a bitmap-based tile engine?

    Also, if you have found ANY other features besides the filters, the blends and the new video compression in Flash 8, let me know as well.

    I think Bitmap Data has the potential to do some extremely cool things... I just need the time to develop something.

    -pXw

  2. #2
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    1) Only touched on it.

    2) Fantastic, best feature added to Flash since dot syntax.

    3) Hell yes! It opens up a whole world.

    Sorry about the short glib answers

    Squize.

  3. #3
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Quote Originally Posted by Squize
    1) Only touched on it.

    2) Fantastic, best feature added to Flash since dot syntax.

    3) Hell yes! It opens up a whole world.

    Sorry about the short glib answers
    Naw, man, it's good to hear. I have 100% ideas but quickly learned you can't use traditional Flash techniques with it. Anymore than 15 - 20 bitmapData instances displayed in a movie clip on screen at the same time, and things get really slow.

    However, I've found it is grand for tons of shapes vs tons of shapes environmental collision detection.

    Also, one of the major complaints I've heard from people (You can't draw rotated, or scaled shapes), I've discovered you can "cheat it". If the Flash movie clip being rotated or scaled is a few levels down from the _root level (I.E. _root._mc._mc._mc._sprite), the draw command with draw it with the rotation and scaling intact.
    Last edited by WilloughbyJackson; 05-25-2006 at 02:00 PM.

  4. #4
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Quote Originally Posted by WilloughbyJackson
    If the Flash movie clip being rotated or scaled is a few levels down from the _root level (I.E. _root._mc._mc._mc._sprite), the draw command with draw it with the rotation and scaling intact.
    But then you're probably losing the benefit of bitmapdata.
    ...?

  5. #5
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Not really. The only reason I checked that was someone said you can't do a bitmap hitTest with a rotated object, so I checked and I was able to create a rotating object which did an bitMap hitTest. It worked, and the rotating object could tell if it was hitting walls or not, pixel perfect.

    Of course, one can also use the Matrix Transformation when using the Bitmap Draw command.

  6. #6
    hmm Pugger's Avatar
    Join Date
    Sep 2003
    Location
    Perth, Australia
    Posts
    616
    I've only just played around with it as well, and it looks interesting, but I haven't looked into it enough to really know what it can do.

    If you use a matrix transformation on a bitmapdata movieclip's children (I asume all children are turned into bitmaps), will that work? Is that what you mean?

  7. #7
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    Another game application i've not yet seen is redundant shapes/mc's being stored on screen.

    Example, you're in a fighting game and you beat up loads of opponents and they stay dead on the ground, after while the the extra movieclips will eat memory and slow the processor.

    Using bitmap data you can commit as many images to it as you like without slowdown :-)

    Also useful for bullet holes, burn marks etc etc. You can have as as many of them as you like persist forever.

  8. #8
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Yep exactly. There are so many doors open now it's untrue ( I'm panting to do a true F8 game ).

    Even silly little things like being able to take a snapshot in game and display that again ( I dunno, say you're playing a beat em up, and you get that killer punch in, be cool to snapshot that and use that as a background to the stats screen ) are all stupidly easy now.

    Squize.

  9. #9
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    Actually whilst I'm on one about bitmaps:

    * Improved workflow. Designers can design, and coders can just pull in the images for external png's etc.
    Getting near the dream of not having a designer anywhere near a fla.

    * User enabled content. Written a worms game with a nice textured terrain ? Let users upload their own as a simple image file and get the engine to load it in.

    * So much potential for sFX it's untrue. Looking at this grab from my X game:



    Done with a mask and a duplicated pre-distorted image, all that could be done on the fly ( And a lot better as well ).

    Squize.

  10. #10
    ....he's amazing!!! lesli_felix's Avatar
    Join Date
    Nov 2000
    Location
    London UK
    Posts
    1,506
    Very cool.

    Another application of the displacement filter could be for realistic 3d terrain.

    I haven't got it working as sweetly as I'd like yet, but this zip should give you an idea: (can't use ftp where I am at the moment)
    Attached Files Attached Files

  11. #11
    Senior Member ozmic66's Avatar
    Join Date
    Oct 2005
    Posts
    472
    someone talked about bitmap hittest
    being a phys lover i played around with it a bit to find possible collision detection methods, but it turned out 2 be 2 slow for real-time and many objects
    see the attached file (click the ground to erase it)
    Attached Files Attached Files

  12. #12
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Quote Originally Posted by Pugger
    I've only just played around with it as well, and it looks interesting, but I haven't looked into it enough to really know what it can do.

    If you use a matrix transformation on a bitmapdata movieclip's children (I asume all children are turned into bitmaps), will that work? Is that what you mean?
    I haven't messed with the transformation matrix in great detail, however, here's what I know so far.

    The matrix can be applyed to a bitmapData movie clip itself (as in the entire bitmapData) which would effect all the children or a movie clip. However, when using the "draw" command to copy something from a movie clip or from a bitmap to a bitmapData field, you can apply a matrix at that time, meaning only whatever is being copied will have an effect on it. This allows you to manipulate individual elements as you add them to the bitmapData using the draw command.

    Quote Originally Posted by lesli_felix
    Another game application i've not yet seen is redundant shapes/mc's being stored on screen.

    Example, you're in a fighting game and you beat up loads of opponents and they stay dead on the ground, after while the the extra movieclips will eat memory and slow the processor.

    Using bitmap data you can commit as many images to it as you like without slowdown :-)

    Also useful for bullet holes, burn marks etc etc. You can have as as many of them as you like persist forever.
    Yep, I was always thinking that, however, as I mentioned earlier, you can't have too many bitmapData instances displayed on the screen (i.e. attached to a movie clip). This means that depth sorting things could be tricky IF you are doing it the traditional way with multiple movie clip and swap depth using Y.

    Notice I said IF..

  13. #13
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Quote Originally Posted by ozmic66
    someone talked about bitmap hittest
    being a phys lover i played around with it a bit to find possible collision detection methods, but it turned out 2 be 2 slow for real-time and many objects
    see the attached file (click the ground to erase it)
    It all depends on how you do the test. BitmapHittest is good for one verse many (I.E. tons of bullets on screen each of which will kill you... one test versus many). However, I so far, I have found getPixel seems to be a very fast for doing an simple test to see if you hit something or not. (I.E. walking on terrains, etc..)

    I'm once again in a place without Flash 8, so I'll take a look at that when I get home.

    (Or you can post your code here so I can read it right now)

  14. #14
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    "as I mentioned earlier, you can't have too many bitmapData instances displayed on the screen "

    Yeah, but you'd just draw it directly onto the "background" bitmap, no speed lose at all, aside from the intial plotting it incurs no performance hit at all

    Squize.

  15. #15
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    A BitmapData platformer I made in a couple of hours:

    http://www.birchlabs.co.uk/Micro%20Warriors.swf

    Based on tonypa's destructible terrain engine (notice how you can destroy the landscape by clicking on it). This has pixel-perfect collision detection. And, via clever use of for loops, you won't skip through 1-pixel-thin columns of terrain when moving at high speeds. Plus, you don't sink into the ground when falling at high speeds, and it runs quickly because it's getPixel()-based instead of using shapeFlag hitTests. All in all, I reckon it's a pretty solid engine which I could take in any direction.

    Do you think that beginBitmapFill() could be used to add a pattern to the bland landscape? Obviously I could've just used the paint bucket tool in Photoshop when I was making the level, but I'd like to have the option of dynamically adding terrain to the landscape, with Flash texturing it as it's added.
    http://www.birchlabs.co.uk/
    You know you want to.

  16. #16
    Patron Saint of Beatings WilloughbyJackson's Avatar
    Join Date
    Nov 2000
    Location
    Ro-cha-cha-cha, New York
    Posts
    1,988
    Well, you could always use the Bitmap displayed as a mask (if the above ground is alpha), and the object masked could be completely different.

    Untested but that's my theory anyhow...

  17. #17
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Ah, that could work, yes. Would there be a way to have certain colours of the terrain act as masks for separate bitmaps (a grass bitmap, a mud bitmap, a stone bitmap, etc)?
    http://www.birchlabs.co.uk/
    You know you want to.

  18. #18
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    i'm working on a similar engine vengeance, see it here:

    http://img90.imageshack.us/img90/372...terrain9sz.swf

    (hold space to stop drag, mouse to shoot)

    i did have collision detection and reaction using while loops, but i'm convinced i can do it with getColorBoundsRect which is the rectangle you can see. I kinda have it working, just gotta figure out how to handle x collisions and their reactions.
    lather yourself up with soap - soap arcade

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