Hello everyone,
I'm struggling with some infrastructural logic hopefully you guys can give me a hand.
Given a single thread approach to networking, the sending and receiving is happening in the same loop. ( I'm using ENet ). The idea is I have a game thread that pulls from a message queue pushed by receive events and a loop inside of my network thread that pulls messages out of a queue pushed by my game thread.
Psuedo code:
NetworkThread()
{
Messages[] messagesToSend;
while(true)
{
Poll(event);
if(event type == Receive)
Game.Messages.Enqueue(event);
//this loop is going to block my …