Yeah, thats what i meant im sorry. I've got my dynamic array working fairly fast for my animations. Thanks for the help and clarifications
Yeah, thats what i meant im sorry. I've got my dynamic array working fairly fast for my animations. Thanks for the help and clarifications
I have a 2005 CRF 250 so <^>(><<^>
<br />http://www.gtrpg.com/
Not relevant any more but
http://www.awitness.org/delphi_pasca...nked_list.html
has an example on creating linked lists the good old fashioned way
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
From you?¢_~re adding and removing question?¢_Ts it looks like you?¢_Tve got an incorrect view of how setlength works. It makes no sense to increment or decrement dynamic array size be one, because when resizing the array what happens is a new chunk of memory is allocated, then the old values get copied and the old array gets destroyed. It?¢_Ts a much better idea to keep a counter of how many items you have in the array, and if it?¢_Ts full make it larger by some (certainly bigger than one) value. When removing items from the array the fastest way if you do not care about item order is to copy the last item over the item you?¢_Tre deleting and decrement the item counter, but if you care about item order and don?¢_Tt have a lot of items a linked list will be faster.
If you are storing instances of a class in the Array you are effectivly only storing a pointer anyway. (So size allocation isn;t too relevant) but it is a good point that decreasing the array is going to be slow and it is more efficient to store the whole array all the time.
William Cairns
My Games: http://www.cairnsgames.co.za (Currently very inactive)
MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)
Bookmarks