Thousands of Graphics = Bad Performance
alex at tweedly.net
Mon Feb 7 14:32:06 CST 2005
Scott Rossi wrote:
> One thing to remember about doing this kind of thing in Rev is that the
>default behavior of the development environment is to track all objects. If
>you allow the IDE to track all 2000 items, it will indeed slow down and take
>a good deal of time to manage them.
>However, if you 1) lock messages and 2) lock the screen before creating
>thousands of objects, you should be able to create them very quickly,
>especially with vector (graphic) objects. If you remember to group the
>resulting set of grcs, the you have the added bonus of being able to delete
>a single group, rather than deleting each grc one by one.
>I just tried a simple test of creating 2000 random rect graphics on a 600 x
>500 card, and was able to create and group the graphics in less than 2
>seconds (a 466 mHz machine). After increasing the graphic count to 5000,
>the total time was about 6-1/2 seconds. So Rev can actually be very fast
>depending on what you are doing.
>Because Rev often provides multiple ways of doing a single task, achieving
>desired results is often a matter of testing several methods.
I had a similar problem a few months ago (trying to draw large number of
graphics fast enough), and kind people on this list told me of the
various techniques. The one that worked best for me was to use a small
number of polygon graphics, using "invisible" edges between the points
and putting a marker for the actual polygons. So I finished up with 20
graphic objects - one polygon for each of the 5 different shapes I
needed in each of the 3 colours, plus a few spare ones. (I wasn't
scrolling a whole group - but I was trying to get each shape to move
With this setup, I have 2500 shapes moving around independently, at
around 10 fps - on a mid-range PC laptop. (25,000 polygon moves per
second). Not quite fast enough to get the illusion of smooth movement -
but pretty close.
Unfortunately, that project stalled for other unrelated reasons, so I
don't have a stack that does anything interesting; but Geoff Canyon's
"asteroids"-like game done with a very similar technique (using a single
polygon but without the markers) I found to be a very convincing demo.
Alex Tweedly http://www.tweedly.net
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.5 - Release Date: 03/02/2005
More information about the use-livecode