I'm writing a very basic MMO with turn based combat. It's basically Pokemon Blue/Red online...
Anyways, I thought of two ways I can have the client listen for packets update moving entities (players, monsters) and I don't know which would be better to use.
Method A
GAME RENDER LOOP
Process any packets that have been recieved
update world based on changes from server
update client player(obvious)
send changes to server
render world
END LOOP
or
Method B
GAME RENDER LOOP
update client player (obvious)
send changes to server
render world
END LOOP
PACKET LISTENER THREAD WHILE ALIVE LOOP
Process any packets that have been recieved
update world based on changes from server
END LOOP
Method B would probably include concurrency issues, but I'm new with threads and I'm not sure what would be an issue.
The line Process any packets that have been recieved will NOT make the program hang while waiting for bytes in the stream.
I'm leaning more towards Method A because it's simpler, but I don't know if it will be fast enough.
Which method is best? If any...