I want to keep game logic decoupled from networking, so I have a net class that listens to game events that should be send to the remote peer.
When an event is received, I send this info to the remote peer.
When a packet is received, I generate an event and send to the game logic...loop!
Im producing and consuming forever, and the only way I see to stop this is making the game logic aware of both events and "remote events"..I dont like this..
How would you solve this?
The game logic is really raw right now, I dont have the concept of a "player 2" yet, Im just treating inputs and core mechanics..Input is also decoupled. I was expecting to have just an above layer treating players / scores stuff, and let the logic only with core stuff, trying to keep the concept of players out of the core mechanics, dunno if I will be able to do that, or if I should..
Perhaps I should include in the event data a player ID (or even a bool bRemote) instead of having another event? Then my net class checks if player ID is local or remote before generating an event, the game logic dont need to know about it..
Another thing Im thinking about, is not generating any even on the net class, instead, when I receive a packet Id call the game logic handler method that is called when the event is received...kinda intrusive, but I dont know if this is a problem.