What I’m trying to accomplish:
A multiplayer spacesim for about 20-50 players, with in-game chat. Dedicated server program. For now assume I do it all with TCP.
Questions:
Should I make more then one socketchannel for each client? Like chat messages go on channel1, positiondata goes on channel2, otherstuff on channel3, etc…
Or is it better to seperate chat and gamedata by starting each message with an ID. (Like if the first byte is a 1, treat it as a chatmessage, if it’s a 2, treat it as a positionmessage etc…)
Is there a 3rd (better) option?
If the answer is only use 1 socketchannel per player, then what use is a selector on the client side? I can understand the use of a selector on the serverside, cause it manages multiple clients, but on the client side it seems needlessly complicated to use one.
I’ve also read about splitting read and write operations on seperate selectors. Is this a good idea? cause it seems to me it further complicates things.
I would like some advice on the best networking design for my goal please