> HI guys,
> 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.

Part of the limitations of the basic incarnation of the TList is that it provides no
lookup method with knowledge about the contents... Since there is no knowledge
about the list contents available it cannot sort the list and therefore cannot do any
indexed searching -- So TList is fine as long as sequentially retrieving items will
only ever be your application of the list structure

> 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 :)

A List I made based on TList (but not inherited from) implements searching strategies
and does do recycling of space (Turning AutoPack to False leaves space for adding
items into deleted spaces) and pre-allocation of space (Through a virtual GrowthFactor
function that can return the contents of a property or a calculation on current size if
necessary).

> I am thinking this probably isn't the most efficient way of doing things but
> thought that some of you would have some ideas.

although I've not done so I believe it's possible to replace the memory allocation 
scheme
for object creation as well to allocate a block of memory for several objects at 
once... This
will likely incur some considerable complexity in managing your instance memory though.

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to