Konichu Posted January 29, 2024 Author Posted January 29, 2024 I think i've fixed the thread race, what I did is: I looked for all the places Canyon uses Kernel.Services.Processor.Queue( and I added that to the same places in Comet-5197. One thing i've not yet done is splitting ai in its own project, processor. Do you think that would be mandatory, or allocating the ai related tasks in the correct map would be enough?Depends on how you handle AI. On Canyon I iterate through all agents even if they're not active, that's not a smart idea if you want to do AI checks.You need to queue anything that will change collections, and that's basically it.You of course must test, but I would do AI checks on a separate thread and then just queue actions (move, attack, heal, etc). Quote
Baloony Posted January 31, 2024 Posted January 31, 2024 Do you mean that:checking for nearby users happens on the AI threadif users are found we queue move or attack actions to the appropriate map partition.I tried running this source on a 2 vCore machine, and of course, it errored as we seem to need at least 6 vCore on our machine to have enough resources for the no map, pvp map and normal map partitions.count = Math.Max(1, count == 0 ? Environment.ProcessorCount / 2 : count);I said 6 not 3 because the count of cores for which we start a partition is our machine's vCores halved.The crazy question is, would having the no map, PVP map, and normal map partitions be the same one (0), make our source "single-threaded" (when it comes to packet processing at least), thus removing the chance of deadlocks and thread races all together? that of course at the cost of performance loss. Quote
Konichu Posted January 31, 2024 Author Posted January 31, 2024 I would always recommend at least 2 threads, separate PvP and PvE maps so monsters wouldn't lag event maps, but that was not an issue with many threads. No thread got stuck because of monster AI queueing actions, you can of course test it with 1 thread and it may work pretty well, games worked single threaded for ages with thousands players + mobs and for Conquer it ofc wont be an issue. I do local tests with 3 threads and someday I will do a stress test on this setting as well, my current stress test setting is with 3 to 6 threads. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.