creating-custom-gym-environment---my-experiences

Creating custom env for own project in gym can be tidious, well, at least was for me. Here are brief descriptions of steps I used and finally created working custom gym environment.

  1. Structure of project environment is one of the major issue:

![image] file:///home/bibek/Pictures/1.pngimage

  1. Assuming we are creating customEnv as custom gym environment, and so in the setup.py:

![image] file:///home/bibek/Pictures/Screenshot%20from%202021-04-09%2014-57-11.pngimage

  1. The 1st init.py, should be like:

![image] file:///home/bibek/Pictures/Screenshot%20from%202021-04-09%2014-59-40.pngimage

  1. Then in the envs folder, the init.py should be like:

![image]file:///home/bibek/Pictures/Screenshot%20from%202021-04-09%2015-01-26.pngimage

  1. Finally the customEnv.py file should have following structure:

![image] file:///home/bibek/Pictures/Screenshot%20from%202021-04-09%2015-04-29.pngimage

  • these 'render' and 'close' are optional.
  1. To complete the setup need to go back to the origin folder and run: pip3 install -e . and following should happen:

![image] file:///home/bibek/Pictures/Screenshot%20from%202021-04-09%2015-30-20.pngimage

Yeah! we made it, aparently! Now you update the customEnv.py as per your project to work on.