I started a component based, networked game (so far only working on the server). I know why singletons can be bad, but I can't think of another way to implement the same thing. So far I have:
A GameState singleton (for managing the global state of the game, i.e. pre-game, running, exiting).
A World singleton, which is the root entity for my entity graph
An EntityFactory
A ComponentFactory
I'm thinking about adding a "MessageDispatcher" so individual components can subscribe to network messages.
The factories do not have state, so I suppose they aren't so bad. However, the others do have global state, which is asking for trouble. How can I refactor my code so it uses fewer singletons?