From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: timing mechanism Date: 11 May 2000 11:34:34 GMT Organization: Aachen University of Technology (RWTH) Lines: 34 Message-ID: <8fe5sa$dgb$1@nets3.rz.RWTH-Aachen.DE> References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 958044874 13835 137.226.32.75 (11 May 2000 11:34:34 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 11 May 2000 11:34:34 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Paul Cechner wrote: > Im not sure if this is off topic, because i dont really know if its c++ > specific or not... so please, minimal flaming .. :P It's neither specific to C++, nor to DJGPP, so it's twice offtopic, here. Anyway, just to give you a start: > The problem comes when i consider a controling mechanism... is the best > solution to have these things all in a large collection and call their > animate methods That's the simplest of all imaginable methods, but not necessarily the right one for your task. It's main drawback is that it assumes all objects to move equally fast, thus consuming CPU time increasing strictly linearly with the number of objects to be animated. A better method may well be to have every animated object inform the central 'world animator' about its current speed of movement, given by the time it should next be updated again, to avoid jerky movement by more than one pixel, or a similar criterion. The central animator can then keep a queue of animated objects sorted by next update time (a 'heap' or 'priority queue' is the technical term). This method is more flexible, accounting slowly and rapidly movind objects, equally. It also offers you a way to detect probable collisions or animation bottlenecks early on, so you can possibly move some of the updates a bit ahead in time, to reduce the impact. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.