Discussion about game socket

1
I have a lot of questions in mind!
And important is why does Ara everyone use QueuePackets?
I think so he can Handle all player packets if he gets to a lot of connection , but I think that will affect performance and speed.

Also, if you use direct witout queue, overlapped will occur when constantly pressing the socket.

i'm trying to make a good sockets But I feel distracted. cuz i try to make sockets by queue but i can't got a goog preformance and speed like the dircect ,
if any one have idea to can fix the overlapped data in direct send sockets i just give me hint or somthing like this <3

i'm sorry for my english lang i know it's bad <3

Discussion about game socket

2
Phoenix wrote: Sun Dec 24, 2023 8:04 pm I have a lot of questions in mind!
And important is why does Ara everyone use QueuePackets?
I think so he can Handle all player packets if he gets to a lot of connection , but I think that will affect performance and speed.

Also, if you use direct witout queue, overlapped will occur when constantly pressing the socket.

i'm trying to make a good sockets But I feel distracted. cuz i try to make sockets by queue but i can't got a goog preformance and speed like the dircect ,
if any one have idea to can fix the overlapped data in direct send sockets i just give me hint or somthing like this <3

i'm sorry for my english lang i know it's bad <3
Conquer probably wont demand much processing if things are done correctly.
Even concurrent things must be done in queue, at least in a map or world level otherwise you'll have thread race and deadlock issues (which ones you probably will never meet in a local test environment unless you have a multi account bot to do a lot of actions all the time).

If you use Canyon as reference, it does have the packet processors and their responsability is simply send, receive and decrypt/encrypt packets. After this it will queue the packet processing to the World Processor, this is done judging the account state or location. So, if the packet processor is stuck, something happened in an specific area of the code. If packets are being sent/received but the server is stuck, then the world processor is stuck.
If an account does not have a map, it will process packet in the login/logout thread, this one is the only one which must change the global dictionaries. Any action related to a map MUST be queued into the region processors.

Basically Canyon has processors divided by 3 categories:
0. Login/Logout actions (or actions not held by maps)
1. PvP Maps (this way an event with hundred players will probably not handle monsters unless the event requires)
2-3-4... PvE Maps

Basically Canyon is designed to run in an environment with at least 4 cores, since you may use only one processor for packet processing and 3 for map actions. This is done because you don't want your socket processing a packet in a separated thread, where the packet is a MsgInteract requesting a Scatter and somebody else is leaving the map right at the same time. It may lead to a thread race issue, since you need to query the players in the map region and also the player is requesting to be removed from that map.

Again using Canyon as reference, if you're changing maps it will check if they're in different regions. The teleport action will start in the current map, so this will be safely removed in the world processor, but if the new map is in the same region then it will just finish the action immediatly, but if the map is in another region we queue the Enter Map action into the map region processor, so it will just change the map state when allowed.

Must public sources just don't break all the time because of the queue (also they break all the time because of the queue but w/e)

In the other hand we have World Conquer v1 and v2, which at that time I believed that ConcurrentDictionary (and other collections) would handle concurrency for me, but they do not. Packets are handled in their own threads, which may not be a problem to 20 or 30 accounts but as the server scales you'll see dead locks everywhere. (and I didn't use locks as well, so it turned into a big problem).
Image

Don't PM me, I won't give Canyon 6192 complete lua or database.