I fell like I am torn between doing some meaningful game AI in an actual game and advancing my research on it. Everybody who worked on games probably knows how long it takes to get some good progress done which is visible to other. If not, then its only me being slow ;)
After some time the nice guys over at UnityVS got back to me and I am finally able to run a decent debugger in Unity. My Pro license helped a lot as well.
After completing the demo for AIGameDev conference, as mentioned in my last post, I felt that I need to find out how much my system---POSH#--- really costs in terms of performance.
I increased the number of bots in my demo and got horrible results which totally shocked me. 70% CPU time is impossible for an i5 running only 6 agents in a super small Unity demo. I used the Pro profiler to have a closer and found that 68% of time went into the Unity NavMeshAgent. It took a second to understand was this meant:
- too many paths planned
- too intricated NavMesh
- too much calls to update navigation
After 5 odd minutes I
- reduced the calls for planning and updating in the POSH plan which is just reducing the frequency for behaviours so its done within two clicks :) ... so that was quick and had a huge impact as each agent now only checks if it needs to re-plan a path every 500ms
- this is an obvious mistake for someone who is not used to think in CPU costs when using a real-time arbitrator
- re-calculated the NavMesh again using a high width and height inaccuracy. This results in a less fine grained mesh with larger areas. That's totally fine for a map like this. Performance of the demo went up to running at 250fps on my laptop which is decent still NavMesh is expensive. I was able to roughly estimate the overhead my cognitive planner has on the game and its with the current action plan around 2% of the CPU time.
I think this is decent enough to get in tough with people and see if anybody wants to give a try. Due to my current implementation its able to run on mobile and I tested it on my Samsung One S. Its running but the level and the MavMesh are still super tough for my mobile I need to have a closer look of skimming the level down at some point.
I am now picking up the GP work again and got funky stuff planned of bringing sematic GP into Unity and derive agent plans which are based on player traces.