I am trying to solve a problem I always run into when developing engines. I am writing an iPhone game. I have a bunch of classes (EnemyManager, Weapon Manager, Player Manager). These are all game objects in my scene. As I put more logic into the game, these classes need access to eachother's data (i.e. the weapon manager which shoots a bullet needs to have access to projectiles in the weapon manager and the enemies location in the enemy manager). My solution was to include class object pointers. The weapon manager includes a pointer to the enemy manager class object in the scene. This works quite well but it seems a bit messy and after a while, the number of forward declarations start to show. Furthermore, I start to get weird errors of redefinition and such. Obviously, this design patten cannot continue but I need to find a way for the various classes to talk to eachother. This pattern is okay for smaller projects but looks like it will be unsustainable in the long run. I also want to avoid global objects (bad practices) - which in my case would solve the problem as well.https://xender.vip/
Another idea I had was to simply use the managers as holders of data and then in the main scene I could write the logic with the interaction between the classes. But I run the risk of seriously bloating the main game scene with functions. Any advice is greatly appreciated.https://nox.tips/