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

Re: [pygame] time progression independent of game "ticks"



Michael George wrote:
Having recently taught a data structures course I'm forced to point out that for some number of fish, inserting into the queue will become a bottleneck,

Actually, it's not the number of fish that determines when this
will become a bottleneck, but the typical number of events in
the queue at any given moment. This is not necessarily proportional
to the number of active entities in the simulation.

Another thing is that the event-queue approach might not help
so much for an *animated* simulation. If the fish are all swimming
around on the screen, you're going to have to process them all
every frame anyway to update their positions.

But if only a small proportion of the fish are visible at a time,
and you can avoid having to simulate the motion of off-screen
fish in a detailed way, it will probably help, as long as you have
a way of quickly finding all the visible fish.

--
Greg