[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Firing bullets
You guys kinda lost me here. Do you guys have examples of both styles?
and what's mVector and unfiredBullets?
On Sun, 8 Apr 2007 01:12:30 -0700
"andrew baker" <failrate@xxxxxxxxx> wrote:
> I absolutely have profiled using lists and creating/destroying
> instances. Using freelists is always faster if you have enough RAM.
> This amount of RAM is well within reasonable limits. I always develop
> for low-end machines, so my minspecs are usually tiny.
> Recycling is not particularly difficult if you use a factory.
> EX.
>
> def fireBullet(mVector):
> if returnVal = unfiredBullets.pop():
> return returnVal
> else:
> return Bullet(mVector) # produces a new Bullet object
>
> On 4/7/07, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
> > Kris Schnee wrote:
> >
> > > I'm not
> > > sure that the recycling method is really necessary, if you find
> > > it hard to program. (It's probably not hard; just laziness on my
> > > part that I didn't use it.)
> >
> > I suggest measuring before concluding that keeping a
> > free list is faster. It might not be.
> >
> > > -Is it worth using ODE physics for bullets? ... But you'd also
> > > have the
> > > overhead of constantly being notified about bullet-on-bullet
> > > collisions,
> >
> > Not necessarily. ODE geoms can have a bitmask that
> > determines what categories of objects collide with
> > others. So you could easily arrange for bullets to
> > collide e.g. with players and walls but not with
> > each other.
> >
> > --
> > Greg
> >
>
>