What's up, guys.
Basically my problem is that I don't know how to establish communication between my NetworkManager class and the other classes like Player, Object and so on.
The only two things NetworkManager does is to send and receive packets over the internet. That's why I need a way to somehow tell the other objects what I've received and then get some info from them in order to know what to send over the internet.
For now, I just pass all the other objects as arguments, but the code is getting pretty ugly and I need another way of doing this.
I was reading Game Programming Patterns by Robert Nystrom and I'm wondering, will it be ok if I use the Observer Pattern to do this?
I decided to ask here before I do it, because it's kind of a big architectural change and I don't want to spend my time doing the wrong thing.
If my NetworkManager communicated only with one type of objects, for example 'Player', I could just pass the Player as an argument and everything works, but now it's getting more complicated and I can't pass 100 arguments to every function.
I need a way of notifying other classes and sending them some info.(and receiving some info), without worrying about circular dependency and stuff
How to do it in a way that makes the code easy to read?