I am using multithreading in many areas of our game so I am starting to think when and whether this will create any kinds of conflict. Should ideally split a*'s threads to the rest of the project or should I just leave it at max and it’ll work itself out. I don’t have any issues at the moment whilst all are in max but I’ve removed some of the other multithreading code just to be on the safe side ( since it’s not that intensive ) but if I can have them all and a* won’t be compromised then I could just use all of it.
Thread use memory. Each thread needs a small bit of data for each node in the graph.
I’d recommend using one of the “Automatic …” options which will dynamically change the number of threads depending on the machine you are running on.
Maybe I need to explain it a bit better. My other processes aren’t as important as the pathfinding ones, but I use max threads based on the system’s hardware for each part of my project. So say pathfinding uses 28 threads ( max on my pc ), another system uses another 28 threads ( since it’s the max ) and a third system another 28 threads. So I wonder whether I can put priority on yours and whether having more threads running than the hardware’s total threads could cause any issues to your system
Any ideas on this? I still haven’t found an answer although I have seen no issues so far
If all the pathfinding threads are active (i.e. calculating paths all the time) and your other system is also fully active then that may cause slowdowns. However in most other cases the operating system’s thread scheduler will take care of things nicely.
I really doubt you are going to need 28 threads for pathfinding though.
Having more pathfinding threads than the computer has cores is a bad idea though. That will only cause increased memory usage and may slow things down slightly (especially under high load).