I would suggest you should not created and destory objects all the time. The
heap space will become very fragmented (and slow to allocate objects).
You could just mark objects as being destroyed, or move them to another
list, and then re-use them.
Allocating lots of objects is not a problem, it's only an issue if you
create/destroy large numbers.
The other alternative would be to manage you own object allocations ( as
suggested), or perhaps just use arrays of records.
You could perhaps try the "Flyweight" design pattern, but I suspect this may
not be suitable - it depends upon what data is being held in each object.
You could just have one object and it works on a Pointer to a record
structure that holds details of the data to be manipulated. - Pointers are
always fast. Calling object methods is not as fast as global procedures etc,
as the "Object Self" parameter has to be passed to each method, it's also
good it you keep down the number of parameters on function/procedure calls
eg <= 3.
Myles.
> -----Original Message-----
> From: Matthew Comb [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, September 13, 1999 9:53 AM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Optimisation.
>
> Yes, I am currently using a wrapper called Delphi-X for direct-x.
>
> Delphi 2 unleashed had a chapter on direct-x but it was mainly about
> accessing the interface not optimisation. I will have a look at the Delphi
> 4
> chapters though, thanks.
>
> The actual drawing of objects is not the problem I am facing, thats all
> working very smoothly, its the underlying logic and just getting
> everything
> to work very fast.
>
> Matt.
> ----- Original Message -----
> From: Coulter, Jeremy <[EMAIL PROTECTED]>
> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> Sent: Monday, September 13, 1999 9:31 AM
> Subject: RE: [DUG]: Optimisation.
>
>
> > Well I know that Delphi 4 Unleased has a chapter or 2 on gaming.
> > BUT I cant remember if its using Direct-X or not. I know it gets a
> meantion.
> > Have you looked into Direct-x for games ?
> >
> > Jeremy Coulter
> > Application Developer
> >
> > Application Development Centre
> > Compaq Computer New Zealand Ltd.
> >
> > Phone: 64 3 371 5724
> > Fax: 64 3 371 5724
> > Mobile: 64 0212533214
> > E-mail: [EMAIL PROTECTED]
> > Personal Email: [EMAIL PROTECTED]
> >
> >
> >
> > -----Original Message-----
> > From: Matthew Comb [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, September 13, 1999 9:25 AM
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: Optimisation.
> >
> >
> > HI guys,
> >
> > just to break up the conversations about DB controls :)
> >
> > A question about gaming techniques with Delphi.
> >
> > I am programming the odd game with Delphi and am wondering what are the
> most
> > efficient datatypes to use. For example.
> >
> > I am using Tobject as the basis for some of my sprite objects and when I
> am
> > handling them within the game I am using a tlist.
> >
> > Trouble is in some of my games the number of objects that are being
> added
> > and deleted are quite huge as one of the types of objects I have is a
> bullet
> > and one of the other objects is a plane that sprays bullets everywhere
> :)
> >
> > I am thinking this probably isn't the most efficient way of doing things
> but
> > thought that some of you would have some ideas.
> >
> > Cheers,
> >
> > Matt.
> >
> >
> --------------------------------------------------------------------------
> -
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> >
> --------------------------------------------------------------------------
> -
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> >
> >
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz