As the title says I'm having a lot of problems with the architecture of my game engine.
Every time I write a game engine all different components (Graphics, Audio, Input) get really messy.
Input needs to have access to Graphics in case for example the player shoots, and the Graphics might need access to Audio because clicking a button should play a audio file, and so on.
I can't find a good way to do this without everything looking like spaghetti.
I've considered these things, but I don't know if any of them are actually good ways to do it :
- Making every single component of the engine global, and putting them in a globals.h.
- Event/Messeging system (this one seems pretty good but I can't wrap my head around on how to implement it)
- Declaring pointers to components in each class that needs it.
- Passing the components to each function that uses it (I dislike this one since if a function needs several of the components it looks really messy)
Basically I want my engine parts (Graphics, Audio, Input, GUI, MapManagers, Debugging Classes and so on) to be able to access eachother without having to create a sphagetti mess everywhere.