« Return to Thread: suggestions on c++ game design with openAL most welcome
Thanks Samuel,
As for the bad class design /lack of encapsulation, oh yes definitely - I'd just posted up dummy classes like this, going public for simplicity's sake.
I've also gone with the multimap as the program's main data store as I need to access objects by their position - the gameworld is a 3 dimensional grid, with objects having absolute positions. Initially I used a 3d array - AbstractObject[x][y][z] , but given i'm working with a large number of potential objects, using a predefined array like this eats up a *lot* of memory.
A multimap using one of my Coords classes , which contains x,y,z as the key allows me to quickly access members, by position, in a dynamically sized manner, and given multimaps are sorted by key, and the .find(key) func is a fairly quick Binary search, this method seems to suit. I'm not sure you can do this with vectors? that is, quickly access a member based on one of its atributes, without iterating through them all to check?
The boost shared pointer gives me some ideas, ta. I didn't know about it.
>Out of the methods you listed below, Method 2 is probably more in the right direction.
...do you mean Method 1? If im reading your sample code correctly, it's more like a global container of some structure which links a pointer to the object, with its associated sound source, or list of sources?
Thanks,
Pingwah
« Return to Thread: suggestions on c++ game design with openAL most welcome
| Free embeddable forum powered by Nabble | Forum Help |