I’m working on a relatively complex AI that uses a game theory (weighted node) approach to decision making. I have the basic functionality working, but I am already noticing significant ‘hiccups’ whenever large calculations are performed.
For example, an AI might need to simulate all possible combinations of moving to and interacting with N objects. Doing this in the main thread greatly hurts performance. I thought I could somewhat easily dump the AI simulation logic into background threads, but I’m struggling with errors from the Unity Engine not being able to access components from outside the main thread.
Before I poke around any more, I want to back up and see if there is a better overall approach for this kind of thing.
Should I try to detach my AI logic entirely from Unity dependent objects? This would be quite tough since some of the plugins I’m using have built in Unity requirements.
Any kind of advice or thoughts would be appreciated. I’m a little lost on what to do at this point.