Threading

11/18/2011 09:27 BaussHacker#1
What should I do?

A thread for every map that's used by players, a global thread for all players or a single thread for every player.
11/18/2011 10:06 { Angelius }#2
a thread pool with a max of 3/4 threads for all players
11/18/2011 11:54 Korvacs#3
In terms of what exactly?
11/18/2011 18:09 BaussHacker#4
Quote:
Originally Posted by Korvacs View Post
In terms of what exactly?
Handling players.
11/18/2011 18:10 Sp!!ke#5
global thread for all players.
11/18/2011 18:12 _DreadNought_#6
Dont even think about thread per player.

Because I will personally delete your entire source. <3
11/18/2011 18:15 BaussHacker#7
Quote:
Originally Posted by _DreadNought_ View Post
Dont even think about thread per player.

Because I will personally delete your entire source. <3
I wasn't going to do that anyways, it sounds shit IMO. Just want to know if I should assign a thread for the maps in use by players or just one global, but it's just it sounds like the global one will make delays, because it will handle one player and then another player after, where a thread for the single maps would be faster, instead it loop through maybe 500 players, then only 50 or 100 etc. I'm a bit clueless at this, but want whatever that's best.
11/18/2011 18:18 _DreadNought_#8
Wait for VS2012(or 2011) Does parallel code execution
11/18/2011 18:20 BaussHacker#9
I will switch to that then, but what about now?
11/18/2011 18:36 pro4never#10
You need to think about this in terms of function rather then collections.

You say threads to deal with players but deal with WHAT exactly?

Stamina/xp bar? Auto attack? etc.

I'd have threads for each FUNCTION personally but that's just me and then make sure my player collection was going to be threadsafe to make sure it works properly (IE: ConcurrentDictionary).

As for packet handling I'd use a threadpool to deal with that and then a few threads to deal with basic server actions.
11/18/2011 22:03 Korvacs#11
pro kinda summed up what i was getting at, handling players could mean anything..