Making 2D Arrays, Fast!

  • Hey
    Im in a bit of trouble as I am making this effect using a massive 2D array. I have used Array Painter 1.1 to draw it and import it into flash. However, this programe SUCKS! I don't know the exact size of my array and I want to shift bits round quickly and easily. Array Painter is impossible to work with and is slow and painful. Before I go of and just make my own Flash Based Array Painter (Which I dont have time for) I would like to know if anyone else has a better progame?!

    I have searched loads but these kinds of random things are hard to find. So please I you know any better programes, please share them!

    Thanks,
    Dan


  • Damn i dont know how to do that. I had the idea, but im afraid you will have to post the code as I don't know anything about bitmaps :(. Sorry.
    HOWEVER! This sounds like a plan! I could effect each pixel individually but it would probably kill my FPS.
    Thanks for the help,
    Dan


  • I have no idea what Array Painter is, but I'll suppose that it's a drawing application that stores the strokes in an array...

    Well, the only way make arrays faster is to use them less or not too lengthy, as not the arrays, but the for loops are being slow. You can either come up with array-less algorithm or lower the number of indexes in the line by optimizing it and skipping redundant and insignificant points.


  • displacement filter, this is part of bitmapData itsnt it? Thanks for the ideas puppy. It doesn't really matter what it is like its just for art at school, they won't care how fast it is or how I have done it...


  • ideas are still free over here :)


  • this is very interesting Dan, I was wondering about drawing from arrays recently. I'd be really interested to find out the principle behind how the movement is controlled in your examples.
    Thanks
    Schm


  • I got a good one from this awesome website and i works really well for my needs: http://oos.moxiecode.com/tut_09/index.html
    You can download it to to suit your needs, quite easy to change to what I needed it to do and it is a flash program which I think you said you wanted, but didn't have the time to make one.


  • Thanks for your reply Dan, thats v generous to offer to put the source up, I understand why you want to keep it to yourself until after your exams. I don't know how to loop through bitmap data so I'll check that out first before I go any further. Your advice is much apppreciated tho :) ta and good luck with yr project


  • I don't think you understand my problem. My script is fine. My Movie runs fine. It is just creating the array which takes ages.
    All I need is a programe like Array Painter (where you can paint a 2D array!) but a better programe, as Array Painter is awful.

    Thanks for your help,
    Dan


  • Oh wow thats awsem Flamingtoaster! Nice find.
    However puppy intregged me (spelling :crazy: ) and I learnt how to use the bitmapdata object in flash. Its AWSEM now. I can do anything I want. Save as a jpg or png, then import, linkage to p0,1,2, w/e then BANG it makes a massive thingy which is well fun!
    Its so fast and effective and lets me use colour :D
    www.dan0.com/pixel.html - just a crappy testy thing to give you and idea
    At the moments its fine with a small number of pixels, but too many and the fps dies on me. Im not sure if/how I can increase the FPS. I made the onEnterFrame function with the most CPU frendly code I could muster.
    Thanks for all the help,
    Dan


  • consider using mspaint :) really. using x6 zoom, you can easily do pixel-level editing. then, you put the bitmap onto your library, attach it, and walk trough pixels to fill your arrays. this way you will not even have to change your code, simply update bitmap and publish.


  • Seriously!? AS3 will make THAT much difference?! If it does then I want to learn it now!!! However its all OOP to me and I don't know it yet. If it increases my speed that much then I will use it for sure.
    Im not sure how to increase the speed in AS2 though. At the moment it checks through ever single bloody square. I don't know how I can get it to just check the sqaures I want it to check. The only thing I have thought of is by making an array which holds all of the currently checking MCs and when they are finished moving they are removed from the array. Its overly complex and would proabably not make my code go any faster because it would still need to check which MCs were added to the array.

    :stare: scripting...

    Thanks for your help,
    Dan


  • in f8 you probably could do something similar and fast with displacement filter


  • Its no secret in the community how to do these things. Maybe the movement is a little specific but looping through a bitmap is easy. Flash 8 has loads of help just put bitmap data in the help, copy the examples and deconstruct them.


  • Dan, thanks for the info on how you did it. If you get time would you give me an idea on how the function sets the scaling of the mc's as I can't work it out, just an overview, I haven't done this sort of thing before.
    Thanks :)


  • Well is there any way I can copy+paste my code into the Flash 9 Alpha and add a bit of "CS3 stuff" to it to make it work?
    What would I need to add/change? I don't use attached MCs everything is created there and then with code etc..
    Thanks for the help,
    Dan


  • That looks pretty cool. I think you should convert it to AS3 for a major speed increase. The last image was a little laggy. But very nice work!


  • Just a massive onEnterFrame that loops through each created MC (excluding colours below a certain value near black). And a function is called and does all the cool stuff. Really its not hard to work out and you can put whatever you want in the function called in the onEnterFrame loop.


  • Thats great thanks for the link. So everything in my script I have to change to the AS3 equivalent on that .pdf. But don't I have to add some imports and a package{} thing. I don't know how to do that :*(

    schmichael I will put the final .fla on my site after jun. Sorry its just because its for my exams and I don't want any one to nick it. I will PM you if you like.
    If you know how to make arrays, attach MCs, loop through the BitmapData and send the MCs to a function everyframe, you will easily be able to make them scale. I only have 4 variables attached to the MCs, they are:
    _x
    _y
    sx (starting _x)
    sy (starting _y)
    using these you can make loads of cool stuffsz!


  • What would I need to add/change?

    clicky me (http://www.actionscriptcheatsheet.com/downloads/as3cs_migration.pdf)


  • Oh displacement looks a bit scary for my brain. Im not sure I can understand it. I will by a book with AS3 so I can get to grips with it. Moock's book proabably, out in June with Flash 9.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Making 2D Arrays, Fast! , Please add it free.