[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] image.load() -->> array?



On 10/25/07, Casey Duncan <casey@xxxxxxxxxxx> wrote:
On Oct 25, 2007, at 12:11 PM, Ian Mallett wrote:

> On 10/25/07, Casey Duncan <casey@xxxxxxxxxxx> wrote:
>> On Oct 25, 2007, at 9:56 AM, Ian Mallett wrote:
>> surface.get_at() can be kinda slow, and typically sequence item
>> access is faster in python then a function call anyway.
>> Regardless, I wouldn't worry about it unless it helps makes the code
>> simpler or profiling shows you that using get_at() is slowing you
>> down too much.
> It's slowing it down some, but the speed is fine.  It's other people
> running my program that I'm worried about.  My computer can do 256
> squared calls to surface.get_at() in about 30 seconds, but it is
> pretty new.

yeah, it's always a good idea to have an old warhorse machine laying
around to test on. Either that or a relative that never upgrades ;^)

Even with a fast machine where performance is acceptable, profiling
can tell you if you are spending a disproportionate amount of time
doing certain things. And if you have capped the framerate, you can
experiment with inserting time.sleeps() in there to give away large
amounts of time per frame to simulate a slower environment. If you
don't cap the framerate, you can improve how smooth things are on
your fast machine by refactoring the slow bits. 50-60fps looks a lot
more polished than 30fps for instance, but it really depends on the
game and how much things are moving frame to frame.

-Casey
Yes, more framerates are always better- I've gotten the idea more than once to obtain some high-performance graphics card and play one of those new DirectX 10.0 games with the dynamically changing worlds (think blades of grass moving independently and reacting to everything and being rendered perfectly), or to play one of my older favorite games at like a billion fps. 

SDL has the limitation that it is really slow.  For some reason, it can never run more than 60-80 fps while doing nothing.  OpenGL, which is what I use for 3D stuff, runs at about 900fps doing nothing.  That's smooth.

Ian