Couple of questions

12/04/2011 14:14 miketheking#1
1-What is the action taken by the server to send the client to character making or logging in other words what's the packet sent by the server to client that either sends client to character making or logging in game

2-should i make a recieve thread for each client like impulse does or there is a better way to do it i dont think its a good idea to use a recieve thread for each client since a char could go afk or so
12/04/2011 20:13 pro4never#2
1: Once the gameserver has finished setting up its connection with the client (including encryption) the client sends the login request packet (type 1052). The server then checks validation for this user (if they've been approved by the login server) and then sends a talk packet to control if they get to log into the game or if they get sent to character creation (type 1004)

The options are...
Normal login: "ANSWER_OK"
Character creation: "NEW_ROLE"
12/04/2011 22:17 BaussHacker#3
Quote:
Originally Posted by pro4never View Post
1: Once the gameserver has finished setting up its connection with the client (including encryption) the client sends the login request packet (type 1052). The server then checks validation for this user (if they've been approved by the login server) and then sends a talk packet to control if they get to log into the game or if they get sent to character creation (type 1004)

The options are...
Normal login: "ANSWER_OK"
Character creation: "NEW_ROLE"
And any other message with be thrown as a dialog in the login.

Ex.

Ban: "FUCK OFF"
12/04/2011 23:08 miketheking#4
thnx guys i got that figured out a while ago anyway but the thread question still stands and btw bauss u read my mind
12/04/2011 23:33 BaussHacker#5
And to your threading question:
[Only registered and activated users can see links. Click Here To Register...]
12/05/2011 00:03 Korvacs#6
Quote:
Originally Posted by miketheking View Post
thnx guys i got that figured out a while ago anyway but the thread question still stands and btw bauss u read my mind
No you shouldnt use 1 thread per character, it becomes unscaleable very rapidly.
12/05/2011 03:27 pro4never#7
Sorry I intended to reply to your second question but I guess I ran to work :S


As korv said... thread per players is a very poor way of handling things.


There's lots of ways you could handle your threading and I don't think anyone here can make the claim that there's one absolute best way to deal with it in every situation but here's some of my oppinions.


Use an async socket system so that you don't need to have threads blocked off for receiving from client (eliminates the need for thread per client). From there I would tell the threadpool to process the received information. This allows for packets to be processed concurrently while at the same time not needing you to hard code a specific number of threads to switch between. From there I'd most likely just create a couple server threads to run through specific functions (monster AI thread, slow updates, fast updates is my general advice but I'm sure others would disagree)

If you write a threading system and you find certain things are really not running the way you would expect them to (such as monsters slowing down/freezing while the server runs) then I'd suggest using the stopwatch class to time how long each thread loop takes to execute. It really helps you track down issues. I know I was having an issue with my monster thread once where monsters were not being removed from the active collection so as players logged in/monsters re spawned the thread was slowing down more and more till it appeared almost frozen.
12/05/2011 20:52 miketheking#8
i added an asynch socket system successfully while in the process i noticed an auth packet of length 80 that the client sends what's that