« Return to Thread: suggestions on c++ game design with openAL most welcome

Re: suggestions on c++ game design with openAL most welcome

by Space Ship Traveller :: Rate this Message:

Reply to Author | View in Thread


Maybe I should clarify a few things.

By Method 2, I mean encapsulating the audio class. I think whatever solution you end up with, having this encapsulated will make things easier in the long run - regardless if you use a controlling class.

I think that having a controlling class is one solution depending on the complexity, but in terms of design Method 2 was probably in the "right direction". It is very simple and will be easy for you to get up and running quickly. It won't be good for millions of objects though, sorry I missed that part. Using a controller class to optimise things is going to be required, and I would recommend you look at using a oct-tree for your space partitioning requirements, it is by far the simplest solution with regards to the kind of functionality you are looking for.

An alternative option is to use a sparse array of some sort - i.e. it looks like it has x, y, z dimensions but doesn't allocate all the memory up front. Another option is a sphere tree, which can be slightly better for moving objects (or so I've heard).

Kind regards,
Samuel

On 3/06/2009, at 1:53 PM, Pingwah Leronz wrote:

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





_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal

 « Return to Thread: suggestions on c++ game design with openAL most welcome