A Flash Developer Resource Site

Page 2 of 5 FirstFirst 12345 LastLast
Results 21 to 40 of 85

Thread: Tiles Conclusion

  1. #21
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    hmm same bug as what I had with my recent AS3 bitmap experiments,- my old Computer runs the AS3 code fast but what lags as hell is the mouse pointer when i move it fast over the flash object- very strange.

  2. #22
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Quote Originally Posted by Cimmerian
    As you wish
    f8 trying to copyPixels 1000 times each frame...
    I dont see much different speed from f8 when scrolling large stage-full bitmaps. This is f9 swf done with Flex SDK:
    http://www.tonypa.pri.ee/game.html

    I have no idea why it shows 90+ fps. Its has swf set to 41:

    Code:
    [SWF(width="560", height="420", frameRate="41", backgroundColor="#FFFFFF")]
    and then it calls the scrolling function:
    Code:
    var time:Timer = new Timer(10);
    time.addEventListener(TimerEvent.TIMER, scrollMe);
    I always thought listeners cant be run faster then fps allows, but the number shown calculates time passed since last call to function and it appears to be called several times compared to enterframe event.


    renderhjs, does this example lag too for you when moving mouse?

  3. #23
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    slightly better as the previous one (mouse issue), btw I set the FPS via the stage object- but perhaps the Timer class is independent from that (maybe can even exceed the 120 fps limit). I rather assume it controls the moveClip and timeline speed in the AS.

  4. #24
    Senior Member webgeek's Avatar
    Join Date
    Sep 2000
    Posts
    1,352
    The F9 version gives me 65 FPS at 1% CPU, the F8 version is 11 FPS at 24% CPU. Quite a bit more of a differential then I expected. For reference, I tested in IE 7 on Windows Vista Ultimate using a quad core processor.

  5. #25
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    I think I saw the mouse slowdown too on this example:
    http://www.tonypa.pri.ee/game2.html
    This example is basically old-type scroller, uses many small bitmap objects inside 1 sprite and changes x property of the scrollRect on main sprite. New ones are created when it scrolls far enough and old ones are removed. When moving mouse over them, I think each bitmap tries to register mouse movement.

    This used 1 single huge bitmap which bitmapdata object was updated every step by copying different part of other bitmapdata using copyPixels:
    http://www.tonypa.pri.ee/game.html

    Both scroll best if you right click on the movie and leave pop-up menu open. No idea why.
    Last edited by tonypa; 04-01-2007 at 07:29 AM.

  6. #26
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    Not to be offtopic but, Tony, your second example there reminds of when a cartridge wasn't properly loaded into the Nintendo console, and you'd get crap all over the screen. (Ahh the good old days of 8-bit...)
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  7. #27
    Truimagz.com everfornever's Avatar
    Join Date
    Sep 2006
    Location
    St. Louis
    Posts
    1,306
    So movie clip tile based is no good anymore?

    I liked the way tony's tile based tuts worked, placeing all tiles in one mc then using prototype to declare its frame.

    But I do notice a bit of lag with so many mc's, are you saying its better to just pull the tile image straight to the stage instead of using mc?

    One more question, will simply publishing in f9 speed up this type of tile based games?

  8. #28
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Quote Originally Posted by everfornever
    So movie clip tile based is no good anymore?

    I liked the way tony's tile based tuts worked, placeing all tiles in one mc then using prototype to declare its frame.

    But I do notice a bit of lag with so many mc's, are you saying its better to just pull the tile image straight to the stage instead of using mc?

    One more question, will simply publishing in f9 speed up this type of tile based games?
    Movie clips still work. But F9 offers new kind of objects that can be used instead of movie clips. In earlier version you HAD TO use mc, now you dont have to, but you still can.

    Using many movie clips lagged in earlier version too, but since it was only way nobody cared. AS3 has many new properties and functions which I dont understand yet (found stage.mouseChildren after making example) and you have in theory much more control over everything. I suppose you could rewrite default classes with your own classes to get rid of useless stuff and improve perfomance.

    These are simplest test, not games. In real games you have more stuff to worry about, animations, collisions, depths. Maybe the huge stage-covering bitmap is not very good once you add everything together.

    Publishing in F9 will not speed up anything. If you use AS1/AS2, your swf will run within AS1 engine and you may as well publish it from F8. To use improvements, you have to rewrite everything for AS3. Code execution is much faster (pathfinding, mass collisions, etc), drawing on display wont change much.

  9. #29
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Tried to make fullscreen scroller. Right click on movie and choose "Go full screen", Esc key or right click and choose "Exit full screen" to return normal view.

    Using CopyPixels:
    http://www.tonypa.pri.ee/tbw/tilesscroll.html
    Using ScrollRect:
    http://www.tonypa.pri.ee/tbw/tilesscrollrect.html
    Not really any speed difference between them, I just wanted to test both.

    The example changes fps dynamically, trying to achieve same time as it would take within 10 step under 40 fps (fps has max limit of 75).

    Interesting that in IE it runs faster at fullscreen (the fps drops from 60 to 50), in Opera there isnt much change between normal and fullscreen.

    Flash Player 9.0.28.0 required.
    Last edited by tonypa; 05-23-2007 at 03:19 AM.

  10. #30
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    nasty,- I had to shutdown my browser and the Flash Player in order to leave the fullscreen (Opera).
    For fullscreen certainly fast but not useable for smooth motions

  11. #31
    Senior Member webgeek's Avatar
    Join Date
    Sep 2000
    Posts
    1,352
    Worked fine here (IE 7). Thanks for posting that Tonypa!

  12. #32
    Developer
    Join Date
    Apr 2007
    Location
    UK
    Posts
    324
    Hmm, this thread has given me a lot to think about. Im in the process of making a full game and am working on the scrolling engine at the moment. I'm using 'super tiles' as they are affectionately known and they seem to be fast for the moment but after seeing Cimmerian's brilliant examples on how fast copyPixels is I think Im going to consider using that instead.

  13. #33
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    Quote Originally Posted by tonypa
    Tried to make fullscreen scroller:
    http://www.tonypa.pri.ee/tbw/tilesscroll.html
    Right click on movie and choose "Go full screen", Esc key or right click and choose "Exit full screen" to return normal view.

    The example changes fps dynamically, trying to achieve same time as it would take within 10 step under 40 fps (fps has max limit of 75).

    Flash Player 9.0.28.0 required.
    Wow, i didnt know that was possible! Is the message "press esc to exit fullscreen" automatic or added by you? And how do you do that?
    I don't have a photograph, but you can have my footprints. They're upstairs in my socks.

  14. #34
    Senior Member webgeek's Avatar
    Join Date
    Sep 2000
    Posts
    1,352
    The "esc" message is built in. Also, in Adobe's infinite wisdom, no keys can be captured while in full-screen mode. Sadly, this makes it significantly less useful for games then you might think.

  15. #35
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    Quote Originally Posted by webgeek
    The "esc" message is built in. Also, in Adobe's infinite wisdom, no keys can be captured while in full-screen mode. Sadly, this makes it significantly less useful for games then you might think.
    damn.. hope they add it in soon..
    I don't have a photograph, but you can have my footprints. They're upstairs in my socks.

  16. #36
    Elvis...who tha f**k is Elvis? phreax's Avatar
    Join Date
    Feb 2001
    Posts
    1,836
    Cimmerian, that's one of the most convinving performance differences I've seen!

    I wish I had something to say about the whole tile discussion but I clearly haven't read up on all the new possibilities yet

    One thing I will say is that "super tiles" in one sense or another has always been the standard. Even Mario and the likes use it! That's the code structure that's changed and not the visual, so not so relevant for this case! But you could take it a step further, using all of the above info, and draw the blocks(a set of tiles) as individual bitmaps and then have a big container that you copy the blocks onto!

    just trying to illustrate the above:

    tile = 1
    block =
    [1,1,1],
    [1,1,1],
    [1,1,1];
    map =
    [block,block,block],
    [block,block,block],
    [block,block,block];

    Now for some this may seem like an overkill but for large levels, there is quite a speed improvement Again I use this example as you can't even have large levels on mobile if you don't find ways around it! You have some overlay pointing somewhere in the map as you have to use % and / to get to a tile but it's not that big!

    From what I've read, I would probably go for the old "super tile" system Strille made (Flash 5), made with the new scrollRect (or copyPixels). Are there any definitive tests, that show the difference between copyPixels and scrollRect?
    Streets Of Poker - Heads-Up Texas Hold'em Poker Game

  17. #37
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    i'm with phrex

    i dont see the point in running copyPixels every frame, my method will be to store the whole map in seperate bitmaps (size of screen) in memory and use 4 visible bitmap areas. when an area leaves the screen, check which bitmapData needs to be copied. Copy that bitmap into the area bitmap
    lather yourself up with soap - soap arcade

  18. #38
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Quote Originally Posted by mr_malee
    i dont see the point in running copyPixels every frame, my method will be to store the whole map in seperate bitmaps (size of screen) in memory and use 4 visible bitmap areas. when an area leaves the screen, check which bitmapData needs to be copied. Copy that bitmap into the area bitmap
    I dont see any change in speed between using copyPixels and changing scrollRect (the fullscreen examples above). For coding its probably easier to change the x and y then using copyPixels.

  19. #39
    Senior Member
    Join Date
    Nov 2005
    Posts
    192
    sorry to bump

    But what is the best method for having animated tiles, posted a new thread a few days ago but no one answered.

    I don't have the time or knowledge to test all the different ways. The animations would be few. Basically im trying to make an engine that scrolls and behaves similar as pokemon and zelda. The bitmap size limitation is not really relevant here because in both of these games, the screen never scrolled more than about 2 times before having to load a new map area and sometimes it did not even scroll at all except upon loading a new map.

    Also, what method did these games actually use? Is flash just too slow to code it in the same manner?

    -thanks

  20. #40
    crossconscious
    Join Date
    Sep 2005
    Location
    Belgium
    Posts
    1,188
    (edit : didn't notice this was an old thread, but whatever )
    In my tile engine, which you can download from my blog at gamesquid.com, I use a mix of different techniques. Mostly it's tiles, supertiles, and automatically generated supertiles, with some caching (bitmap caching etc) in different places. However, it was a first attempt at making a scrolling engine post F7, so I'm sure it's not the fastest way to do it. I do like the way I structured things though, but I'm planning to rewrite it with a copypixels technique.

    Just a small question, would you use copypixels for "game sprites" (characters etc) as well? Otherwise, it would be hard to, for instance, create a tile layer that's in front of the players. Well, not so hard, but you'd need different bitmaps to copy to, and you'd have to clear the one(s) on top seperately, and I'm not sure if you'd still have a performance benefit over using other techniques. Any ideas?
    Last edited by Fall_X; 07-11-2007 at 03:55 AM.

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