Timeline for Making classes available to others
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 27, 2011 at 17:40 | comment | added | Olhovsky | Gajet: Actually you usually want more than one object pool (I have dozens typically), and having a singleton isn't really necessary for ensuring that you only have one graphical API. In fact, why do you need to ensure that at all? | |
May 27, 2011 at 15:06 | comment | added | Ali1S232 | @Andrew: but singletons have their own advantages like when you are creating a game you have to make sure you have only 1 object pool, only once graphic api is initialized, and any other thing that is in direct use with system resouces. | |
May 27, 2011 at 14:38 | comment | added | Andrew Russell | @Gajet: Your comment. Global accessibility and single-instance objects are really two separate issues. Global accessibility is fine. Single-instance is a very bad idea. Strictly speaking, a class that is "Singleton" is not necessarily globally accessible. (This is the basic thrust of my answer.) | |
May 27, 2011 at 13:10 | comment | added | Ali1S232 | @Andrew: are yuo talking about the answer I gave or are you talking about the comment i just put hear? and it's about my answer, it's true that they are global instances but they're not acceble from any where in code (it least they are some protected members of a class, only their children can use them. | |
May 27, 2011 at 13:05 | comment | added | Andrew Russell | @Gajet I would seriously avoid making your resource management classes singletons! (Global instances are fine.) | |
May 27, 2011 at 12:48 | comment | added | Ali1S232 | @DeadMg: Singletons and global variables aren't always somthing, for example when you are trying to write somthing you are just accessing some global data, or as far as I tested every game engine has singletons for resource managing, which can be sound bank, renderer, input Manager, physics controller, and some event have some class director which controls game's application flow. | |
May 27, 2011 at 12:33 | comment | added | Jonathan Connell | @DeadMG: I wouldn't call a class SoundBank if it did more than what would be 'expected' from a sound bank, any sort of data management or logic, such as with Sound Objects, and imho it becomes a manager. My question was initially to ask if there were better ways to handle my Managers, not wheter their existence or their names were justified, I believe that is another topic. Indeed I do NOT want to use global varaibles so I was wondering if there was a 'better' way that the ones I proposed in my question. In any case, this is so far off topic :P | |
May 27, 2011 at 12:33 | comment | added | DeadMG | @Olhovsky: No, it would be an instance, for which you would create an instance of it for a specific bank. | |
May 27, 2011 at 12:31 | comment | added | Olhovsky | DeadMG: So that SoundBank would expose public static methods? | |
May 27, 2011 at 12:23 | comment | added | DeadMG | @3nixios: So make a SoundBank class that holds a SoundBank, and have it create Sound objects from cues within that bank. There's still no need for global data- if you can't conceive of a manager-less design, then pass the managers as references. | |
May 27, 2011 at 12:19 | comment | added | Jonathan Connell | @Olhovsky This is the same sort of architecture I'm using. How do you manage these classes? As Singletons? Services? Gloabls? xD | |
May 27, 2011 at 12:19 | comment | added | Olhovsky | The sound manager also takes care of global sound and music effect volume, as chosen by the player. | |
May 27, 2011 at 12:18 | comment | added | Olhovsky |
The sound manager also allows you to "fire-and-forget" sounds, for sounds that are short, so there is no need to get a new sound instance from the object pool and release it when it's done playing. You can simply do SoundManager.Play(Sounds.Beep2); .
|
|
May 27, 2011 at 12:15 | comment | added | Olhovsky | I use both a sound manager and an input manager. The input manager takes care of the case where a user changes from one controller to another. It exposes methods that allow you to check which button is pressed, and these methods take care of the case where a different controller is suddenly being used. My sound manager manages sound resources (with an object pool) and automatically chooses appropriate sound fading between players in splitscreen. If you don't put this type of functionality in a "SoundManager", then where do you put it? | |
May 27, 2011 at 12:13 | comment | added | Jonathan Connell | @DeadMG: What I call 'InputManager' will keep the state of which controllers are connected, manage controller vibration, etc. My Sound manager simply loads the needed Sound Banks and allows cues to be played. I don't know if you'd qualify them as 'Managers' per se or even 'Helpers', but I find them helpful from a User point of view. Ofc, I'd be welcome for any better suggestions. | |
May 27, 2011 at 12:08 | comment | added | DeadMG | @3nixios: If you make a Sound object, then it is your responsibility to keep it around as long as you still need it. Sound-related code goes in the Sound class. What exact function are you hoping for your Manager to achieve? The same is true of Input. | |
May 27, 2011 at 11:56 | comment | added | Jonathan Connell | Why shouldn't I need an InputManager or SoundManager? I don't want all Input & Sound code directly in place whenever I need to check someting... Of course encapsulation would be easy if we only have a few classes... | |
May 27, 2011 at 11:49 | history | edited | DeadMG | CC BY-SA 3.0 |
added 85 characters in body; added 144 characters in body
|
May 27, 2011 at 11:44 | history | answered | DeadMG | CC BY-SA 3.0 |