4 ms·
When writing a game, I tend to have a singleton "Game" or "World" class (well, actually a static class, I don't bother with all the getInstance() crap), and fro
by DanHulton 18y ago
When writing a game, I tend to have a singleton "Game" or "World" class (well, actually a static class, I don't bother with all the getInstance() crap), and from there a bunch of proper classes all "owned" by Game. Now, I'm basically using static classes as a namespace here, but is this really that harmful? If so, what options do I have?
- Tichy 18y agoI guess it will fly in your face once you'll try to create multiplayer games and serve several games at the same time? What do you gain from making a game a singleton?
- DanHulton 18y agoWell in that case, I'd have a Server class and a Client class. One handles logic and the other handles display and input. And actually, for my last little prototype (now that I think about it), I didn't make it a singleton, I just had a single public instance of it. Question retracted.