Hey folks!
I'm trying to make games in TypeScript, and although I could probably make alot of small simple games withoout worrying about this, I have a desire to achieve skills in the architectural part as well. I'm a software developer in my day job (still fairly new to the craft though), and I strive to follow the SOLID principles for object oriented design, as well as generally trying to achieve best practices.
I'm however a bit stuck. I'm trying to figure out how the communication between different part of the engine should work, without trowing unnecesary data objects all around my code, and making every single data object public.
I'm thinking some sort of event system, but I can't figure out a good way to do it.
My GameObjects have components, which I think should be the building block of beavior. But as an example in my code, I want the MoveComponent to tell the CollisionDetector each time it's owner moves, so that the CollisionDetector can do it's job, and in case of collisions tell the components which care for it (in my example the BounceComponent of the same GameObject), that it happened.
So to my ears that sounds like an observer pattern, but is that a good way of doing this? Is there some other obvious way of structuring your game that I'm not aware of?
Link in case you are curious:
https://github.com/TcMikjaer/TypeGame
Thanks for your time.