Post

 Resources 

Console


Storing objects in memory... Rag on a Stick (14 replies, 0 views) (2000-Dec-30)
-
Ok, probably all games have a similar problem to this, in that you need to store different objects (such as bullets, NPCs, cars etc) in memory, and during the course of the game, the number of these objects is likely to change. So what do you do? The methods I know of are: Set a maximum number of objects each with an "Exists" property Have a collection of objects and use Add and Remove to handle the changing sizes. Have a dictionary of objects. For this, adding and removing is a bit clumsier than with collections (at least the way I do it :) A linked list of objects. This would probably be fairly fast especially since most of the time, it is just cycling through each and every object which linked lists are quite good at. Dynamic array of objects (can't believe I almost forgot this one), similar to the first method except with a dynamic array so there is no maximum objects. This can be slow when resizing the array, so it would probably be best to do it in jumps of 100 objects when resizing and keep the "Exists" property. So my question is, what do you use, and what do you think would be the fastest method say with the example game being a RTS such as Starcraft and you are keeping track of all the units. So it has to be fast, ugly code is no problem :)


-
Back to Forum

I use a dynamic array and a pool system Jack Hoxley (13 replies) (2000-Dec-30)
Re: I use a dynamic array and a pool system Almar (2 replies) (2000-Dec-30)
Public vs. Global Lucky (1 reply) (2000-Dec-30)
Public is for non-global objects (forms and classe Jack Hoxley (0 replies) (2000-Dec-30)
I do it just the same as Jack Lucky (7 replies) (2000-Dec-30)
At least I'm not too different.... :) Jack Hoxley (6 replies) (2000-Dec-30)
Another Q... Rag on a Stick (5 replies) (2001-Jan-1)
I just have a Walkable value... Jack Hoxley (4 replies) (2001-Jan-1)
But what if... Rag on a Stick (3 replies) (2001-Jan-1)
Re: But what if... Jack Hoxley (0 replies) (2001-Jan-2)
Re: But what if... Philipp (1 reply) (2001-Jan-5)
Seems good Jack Hoxley (0 replies) (2001-Jan-6)
Do you do this?... Rag on a Stick (1 reply) (2000-Dec-31)
Yes I do Jack Hoxley (0 replies) (2000-Dec-31)

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.
There have been 56 visitors within the last 20 minutes
RSS News Feed