Original Post
Ok I have revised my thread some to make it easier on everyone. If you would like to read everything on this issue, I have created an article here. Otherwise I will just sum up some key points.
My question for all you you game developers is what type of system would you need employed to track objects throughout your game. If you are not sure, can you tell me your 'dream system' (realisticaly speaking in C++). I have though up of a little design that I think could prove quite useful, but I would need to test it out in a game first. However the main concept is this: 1. Have some std::map of pointers to your class/base class that you want to track. 2. To add to this list, a format of the following is used:
My question for all you you game developers is what type of system would you need employed to track objects throughout your game. If you are not sure, can you tell me your 'dream system' (realisticaly speaking in C++). I have though up of a little design that I think could prove quite useful, but I would need to test it out in a game first. However the main concept is this: 1. Have some std::map of pointers to your class/base class that you want to track. 2. To add to this list, a format of the following is used:
// First entity
if( g_List.find( "Entity 1" ) != g_List.end() )
abort();
g_List["Entity 1"] = new Entity;
if( !g_List["Entity 1"]->Add("Entity 1") )
abort();
All we do is check to make sure the object is not already in the list, then create new memory for the class, and finally add it to the list. All of the underlying details are handled by the class that you dervive from. However a little action on your part is needed to tie it together with the object list. 3. Finally when an object is no longer used, call the Remove function and it is removed from the list and memory is deallocated. You can call RemoveAll to remove everything. The overall goal is to be able to track any object that you want. Each object knows all of the other objects, so no central system is needed to communicate between the objects. This can be adventageous in many ways. Any impressions/questions/comments/suggestions on this? Thank you for your time and patience. [Edited by - Drew_Benton on March 23, 2005 9:50:50 PM]