Item and vital calcs fully working!
For those who don't know... max hp as well as your character window stats are all calculated by the client. My calculations for dmg, def, hp, mana, etc server side are now identical.
-Coded avatar stuff (Npc fully works to change avy)
-New characters are given random hair color/style
-New Characters are given random avatar
-Avatars and mesh are now separate values.
-Ghost mesh now displays correct avatar
-Started on team (can create/dismiss, just need to handle inviting/joining)
-Added npc script item functionality (HasItem(S), AddItem(s), RemoveItem(s))
-Plus bonuses now calculating
-Item info +hp/+mana now calculating (bottle/gourd/etc)
-Vitals calculating properly for all professions regardless of values in stats
-Coded cure/advcure
This means pvp dmg should be basically perfect and shouldn't need to be worried about again for a while.
-Going to code magic skills and bows soon.
Bug Fixes:
-Added range check to melee/passive skills
-Fixed bug where sometimes in fb same coord would calculate twice (double hits)
-Sending client gears for items OTHER than those visible (Yay for me not structuring the whole packet)
-Added dragon gems, blessing and tort gems to dmg calculations.
-Coded spirit healing, meditation, cure and adv cure skills fully
Next Up:
-Team healing
-Improve server threading (packets are being processed on same thread as everything else which means if there is any intensive calculations going on (Ie: lots of players moving around being inserted/removed/updated from maps) then ping will suffer.
Question:
How would you handle threading issues such as this? Obviously I want to keep my threads limited but obviously packet receiving/processing/sending should be a main priority and put above other server needs such as distance calculations/spawning shit...
I can think of 2 main options but my threading knowledge is VERY limited so I'd appreciate advice if you have it.
Option 1:
Make a thread for dealing with packets. Thread runs through two queues. Receive and send. Receive queue will then be processed within the thread and sent ones will simply be sent to the required client.
EG: SendQueue.Enqeue(NewPacket(Data, From));
That way I can keep data associated with a client while it is in the queue and packets would be processed in order they are added without conflicts (assuming I code it properly..)
Option 2:
Map thread which would handle all the spawning/despawning/movement between maps. That's currently my most intensive process (Mostly walking as each step is a removal, insertion and query of local objects/despawn of former objects). While I plan to streamline my movement system eventually, I don't want these sorts of important yet processor intensive aspects of the server to interfere with other operations.
My thinking is that if I contain all of this side of the server to a single thread it leaves the main thread to handle everything else (it can't interfere with anything else at all as opposed to simply using the packets thread where this can still interfere with other server operations)
Obviously it's not a huge issue right now but we've already noticed that with significant movement packets are delayed slightly and ping is boosted. I REALLY don't want this to become a critical issue as more players are added into the equation (Ping may only increase slightly and fairly infrequently when it only 2-3 ppl... but what happens when there is 50... 100... 500?)