mbaske / grid-sensor

Grid Sensor Components for Unity ML-Agents
MIT License
134 stars 28 forks source link

Multiple environments in the same scene slow down the FPS #20

Closed zhangbaozhe closed 3 months ago

zhangbaozhe commented 3 months ago

Hi, I am using this repo for my RL training using mlagent. As the doc of mlagent recommends for parallelization, you can simply copy your environment in one scene multiple times and get a training speedup.

When I used grid-sensor and did this simple copy, I got a bad performance, e.g., the agent just did not move and the FPS is very low. I am wondering if this is a problem because you use tag to identify the Detectable GameObject and if you have multiple environments containing the same tag, then there's too much to process.

Thx.

mbaske commented 3 months ago

Hi, the tagging shouldn't be an issue with multiple environments. If you look at the example projects, https://github.com/mbaske/grid-sensor/tree/master/Assets/Examples - in Food Collector for example, you can easily stack a couple of platforms on top of each other without affecting performance too much. Each sensor should only process the Detectable GameObjects inside its respective detection area.