Hi guys, I’m developing an mmorpg and my question is: what is the better way to store all the connected players in the server and how can I rapidly find them? I’m using kryonet so I have and ID and I’m storing them in a LinkedList at the moment. So any time I receive something like a movement update I have to use a
for (Player p : connectedPlayers)
but I guess this is not the better solution.
And I have one more question, when I receive a packet, like a movement update, I’m looping between players in the same thread, this probably makes my server slower, is it a good idea to make a little thread that expires each time his little task has been handled? Or is it better to have something like a thread specialized on movement handling and each time a player moves it handles the data?
Let me know if you have any better approach, thanks.