simoninithomas / the_mayan_adventure

The Mayan Adventure is an open-source reinforcement learning environment for Unity ML-Agents. In this environment, you train your agent (Indie) to find the golden statue in this dangerous environment full of traps.
MIT License
36 stars 8 forks source link

Which versions of Unity and MLAgents Unity package should be used? #1

Closed mbalesni closed 3 years ago

mbalesni commented 3 years ago

I am setting up the environment using the Unity ML Installation docs, as suggested in the Readme, and am running into issues of what I think is version mismatch between the environment's MayanAdventureAgent.cs script and the Agent class from MLAgents Unity package.

As seen in the screenshot below, the script is failing when tries to inherit the Agent class and override some of its methods. image

What I tried so far:

  1. I tried versions of MLAgents from 1.5.0-preview (local from the repository) to 0.16.0-preview (from Unity registry). Older versions resolve the "namespace not found" issues, but still have the "no suitable method to override" errors.

  2. I tried to manually resolve the version mismatch by modifying the MayanAdventureAgent.cs script. I solved the "namespace not found" issues by replacing using MLAgents; with using Unity.MLAgents;, as I saw used by the package itself. I also fixed InitializeAgent and AgentAction "no suitable method to override" errors by renaming them to their up-to-date names Initialize and OnActionReceived. However, I couldn't solve the issues with CollectObservations, Heuristic and AgentReset methods that way, and I think there's a bigger difference there than a name change.

Unity versions tried

The question: Is there a known setup that can run the environment without problems?

simoninithomas commented 3 years ago

Hello, I've made this environment using the version of ML-Agents of December 2019. But I'm confused I can't find what version it was. In the packages file there is no indication of the ML-Agent version. It was the version published between november and december 2019.

"I tried versions of MLAgents from 1.5.0-preview (local from the repository) to 0.16.0-preview (from Unity registry). Older versions resolve the "namespace not found" issues, but still have the "no suitable method to override" errors." However, you shouldn't use an older version of ML-Agents to use this environment since a lot of things have changed.

This environment is not suitable anymore for new ML-Agents versions.

"methods that way, and I think there's a bigger difference there than a name change.": The only solution I have for you, is that you can update the environment by using another environment (such as Pyramids) and looking at PyramidsArea.cs and PyramidsAgent.cs code to see the difference between MayanAdventure code and new Unity ML-Agents version code (most of the differences will be I think in Action and Initialize methods). I don't think there are tons of modifications to make but the best way to update it is really to see the differences in terms of functions between a working environment (such as Pyramids) and this one.

Have a nice day,

mbalesni commented 3 years ago

Hey @simoninithomas, thanks for the suggestion, the Pyramids example did help me figure out the necessary updates and everything works now. Thank you!

markbugeja commented 3 years ago

@nick-baliesnyi can you please share the changes?

I have looked at the file from pyramid agent and there is no indication of how to change the CollectObservations, Heuristic and AgentReset methods. Thanks!

mbalesni commented 3 years ago

@markbugeja sure! You can see the changes I made here. This works for me with MLAgents Release 10, Unity 2019.4.15f1.

I should probably create a pull request with the changes later this week.

markbugeja commented 3 years ago

@nick-baliesnyi thanks! I will take a look 👍