miniworld-maze 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of miniworld-maze might be problematic. Click here for more details.
- miniworld_maze/__init__.py +37 -0
- miniworld_maze/core/__init__.py +8 -0
- miniworld_maze/core/constants.py +130 -0
- miniworld_maze/core/miniworld_gymnasium/README.md +1 -0
- miniworld_maze/core/miniworld_gymnasium/__init__.py +4 -0
- miniworld_maze/core/miniworld_gymnasium/base_env.py +52 -0
- miniworld_maze/core/miniworld_gymnasium/entities/__init__.py +7 -0
- miniworld_maze/core/miniworld_gymnasium/entities/agent.py +117 -0
- miniworld_maze/core/miniworld_gymnasium/entities/base_entity.py +135 -0
- miniworld_maze/core/miniworld_gymnasium/entities/objects.py +116 -0
- miniworld_maze/core/miniworld_gymnasium/entity_manager.py +358 -0
- miniworld_maze/core/miniworld_gymnasium/envs/__init__.py +3 -0
- miniworld_maze/core/miniworld_gymnasium/math.py +83 -0
- miniworld_maze/core/miniworld_gymnasium/objmesh.py +294 -0
- miniworld_maze/core/miniworld_gymnasium/occlusion_queries.py +97 -0
- miniworld_maze/core/miniworld_gymnasium/opengl.py +21 -0
- miniworld_maze/core/miniworld_gymnasium/params.py +128 -0
- miniworld_maze/core/miniworld_gymnasium/random.py +105 -0
- miniworld_maze/core/miniworld_gymnasium/rendering/__init__.py +7 -0
- miniworld_maze/core/miniworld_gymnasium/rendering/drawing.py +77 -0
- miniworld_maze/core/miniworld_gymnasium/rendering/framebuffer.py +260 -0
- miniworld_maze/core/miniworld_gymnasium/rendering/texture.py +101 -0
- miniworld_maze/core/miniworld_gymnasium/rendering_engine.py +293 -0
- miniworld_maze/core/miniworld_gymnasium/room.py +330 -0
- miniworld_maze/core/miniworld_gymnasium/texture_utils.py +64 -0
- miniworld_maze/core/miniworld_gymnasium/textures/airduct_grate_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/asphalt_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/beanpaste_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/beige_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/black_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/blueberry_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/brick_wall_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/cardboard_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/cardboard_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/cardboard_3.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/cardboard_4.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/ceiling_tile_noborder_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/ceiling_tiles_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/cinder_blocks_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/cobaltgreen_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/concrete_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/concrete_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/concrete_3.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/concrete_4.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/concrete_tiles_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/copperred_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/crimson_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_doom_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_doom_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_garage_red.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_garage_white.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_steel_brown.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_steel_grey.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/door_steel_red.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/drywall_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/floor_tiles_bw_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/floor_tiles_white.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/grass_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/grass_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lava_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lava_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lemongrass_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lightbeige_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lightcobaltgreen_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lightgray_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lightnavyblue_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lightskyblue_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/lime_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/logo_mila_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/magenta_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/marble_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/marble_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/metal_grill_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/metal_grill_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/morningglory_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/navyblue_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/oakbrown_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/orange_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/orchid_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/picket_fence_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/adelaide_hanscom1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/adelaide_hanscom1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alessandro_allori1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alessandro_allori1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alessandro_allori2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alessandro_allori2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alexandre_cabanel1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alexandre_cabanel1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alexei_harlamov1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alexei_harlamov1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alexey_petrovich_antropov1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alexey_petrovich_antropov1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alice_pike_barney1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/alice_pike_barney1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/aman_theodor1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/aman_theodor1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/antonello_messina1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/antonello_messina1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/antonio_herrera_toro1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/antonio_herrera_toro1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/benjamin-constant1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/benjamin-constant1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/benoist_marie-guillemine1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/benoist_marie-guillemine1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/bouguereau_william-adolphe1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/bouguereau_william-adolphe1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/byron1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/byron1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/carl_fredric_breda1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/carl_fredric_breda1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/carl_fredric_breda2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/carl_fredric_breda2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/cramacj_lucas1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/cramacj_lucas1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/cranach_lucas2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/cranach_lucas2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/cristobal_rojas1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/cristobal_rojas1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/delacroix_eugene_ferdinand_victor1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/delacroix_eugene_ferdinand_victor1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/domenikos_theotokopoulos1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/domenikos_theotokopoulos1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/edmund_blair_leighton1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/edmund_blair_leighton1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/edmund_blair_leighton2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/edmund_blair_leighton2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/edwin_longsden_long1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/edwin_longsden_long1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/falero_luis_ricardo1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/falero_luis_ricardo1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/felix_bonfils1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/felix_bonfils1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francesco_hayez1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francesco_hayez1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francisco_goya_lucientes1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francisco_goya_lucientes1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francisco_goya_lucientes2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francisco_goya_lucientes2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francisco_zurbaran1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/francisco_zurbaran1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/franz_von_defregger1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/franz_von_defregger1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/franz_von_defregger2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/franz_von_defregger2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/franz_von_defregger3.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/franz_von_defregger3.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/frederic_westin1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/frederic_westin1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/frederic_yates1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/frederic_yates1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/frederick_leighton1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/frederick_leighton1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/gaston_bussiere1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/gaston_bussiere1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/george_henry_hall1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/george_henry_hall1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/giovanni_battista_tiepolo1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/giovanni_battista_tiepolo1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/giovanni_bellini1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/giovanni_bellini1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/hans_holbein1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/hans_holbein1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/hayez_francesco1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/hayez_francesco1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/henryk_siemiradzki1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/henryk_siemiradzki1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/ilja_jefimowitsch_repin1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/ilja_jefimowitsch_repin1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/james_carrol_beckwith1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/james_carrol_beckwith1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-baptiste-camille_corot1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-baptiste-camille_corot1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-baptiste-camille_corot2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-baptiste-camille_corot2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome3.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome3.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome4.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/jean-leon_gerome4.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/john_william_godward1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/john_william_godward1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/john_william_godward2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/john_william_godward2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/john_william_godward3.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/john_william_godward3.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/julije_klovic1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/julije_klovic1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/juriaen_streek1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/juriaen_streek1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/kiprenskij_orest_adamovic1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/kiprenskij_orest_adamovic1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/konstantin_makovsky1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/konstantin_makovsky1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/lefebvre_jules_joseph1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/lefebvre_jules_joseph1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/leon-francois_comerre1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/leon-francois_comerre1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/leopold_loffler1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/leopold_loffler1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/lewis_john_frederick1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/lewis_john_frederick1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/madrazo_garreta_raimundo1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/madrazo_garreta_raimundo1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/marie_bashkirtseff1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/marie_bashkirtseff1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/moritz_kellerhoven1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/moritz_kellerhoven1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/nathaniel_jocelyn1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/nathaniel_jocelyn1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/nikolai_alexandrowitsch_jaroschenko1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/nikolai_alexandrowitsch_jaroschenko1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/nils_johan_olsson_blommer1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/nils_johan_olsson_blommer1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/paolo_veronese1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/paolo_veronese1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/parmigianino1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/parmigianino1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/paul_cesar_helleu1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/paul_cesar_helleu1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/regnault_henri1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/regnault_henri1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/richard_bergh1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/richard_bergh1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/richard_bergh2.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/richard_bergh2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/robert_dampier1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/robert_dampier1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/robert_lefevre1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/robert_lefevre1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/robert_leopold1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/robert_leopold1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/sichel_nathanael1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/sichel_nathanael1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/svetoslav_roerich1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/svetoslav_roerich1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/velazquez_diego1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/velazquez_diego1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/viktor_vasnetsov1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/viktor_vasnetsov1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/william-adolphe_bouguereau1.license +2 -0
- miniworld_maze/core/miniworld_gymnasium/textures/portraits/william-adolphe_bouguereau1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/realblueberry_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/redbean_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/rock_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/seablue_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/silver_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/skyblue_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/slime_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/stucco_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/sunnyyellow_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/turquoise_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/violet_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/water_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/water_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/water_3.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/white_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/wood_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/wood_2.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/textures/wood_planks_1.png +0 -0
- miniworld_maze/core/miniworld_gymnasium/unified_env.py +1364 -0
- miniworld_maze/core/miniworld_gymnasium/utils.py +37 -0
- miniworld_maze/core/miniworld_gymnasium/wrappers.py +2 -0
- miniworld_maze/core/observation_types.py +32 -0
- miniworld_maze/environments/__init__.py +16 -0
- miniworld_maze/environments/base_grid_rooms.py +204 -0
- miniworld_maze/environments/factory.py +155 -0
- miniworld_maze/environments/nine_rooms.py +74 -0
- miniworld_maze/environments/spiral_nine_rooms.py +70 -0
- miniworld_maze/environments/twenty_five_rooms.py +122 -0
- miniworld_maze/tools/__init__.py +5 -0
- miniworld_maze/tools/generate_observations.py +199 -0
- miniworld_maze/wrappers/__init__.py +5 -0
- miniworld_maze/wrappers/image_transforms.py +40 -0
- miniworld_maze-1.0.0.dist-info/METADATA +108 -0
- miniworld_maze-1.0.0.dist-info/RECORD +280 -0
- miniworld_maze-1.0.0.dist-info/WHEEL +4 -0
- miniworld_maze-1.0.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MiniWorld DrStrategy - Multi-Room Maze Environment Package
|
|
3
|
+
|
|
4
|
+
This package contains complete implementations of multi-room maze environment
|
|
5
|
+
variants used in the DrStrategy paper, along with tools for generating observations.
|
|
6
|
+
|
|
7
|
+
Available environment variants:
|
|
8
|
+
- NineRooms: Classic 3x3 grid of rooms (9 rooms total)
|
|
9
|
+
- SpiralNineRooms: 3x3 grid with spiral connections (9 rooms total)
|
|
10
|
+
- TwentyFiveRooms: Large 5x5 grid with 40 connections (25 rooms total)
|
|
11
|
+
|
|
12
|
+
Main modules:
|
|
13
|
+
- environments: Environment implementations
|
|
14
|
+
- wrappers: Gymnasium wrappers for PyTorch compatibility
|
|
15
|
+
- tools: Observation generation and utilities
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from .core import ObservationLevel
|
|
19
|
+
from .environments.factory import (
|
|
20
|
+
NineRoomsEnvironmentWrapper,
|
|
21
|
+
create_drstrategy_env,
|
|
22
|
+
create_nine_rooms_env,
|
|
23
|
+
)
|
|
24
|
+
from .environments.nine_rooms import NineRooms
|
|
25
|
+
from .environments.spiral_nine_rooms import SpiralNineRooms
|
|
26
|
+
from .environments.twenty_five_rooms import TwentyFiveRooms
|
|
27
|
+
|
|
28
|
+
__version__ = "1.0.0"
|
|
29
|
+
__all__ = [
|
|
30
|
+
"create_drstrategy_env",
|
|
31
|
+
"create_nine_rooms_env", # deprecated but kept for backward compatibility
|
|
32
|
+
"NineRoomsEnvironmentWrapper",
|
|
33
|
+
"NineRooms",
|
|
34
|
+
"SpiralNineRooms",
|
|
35
|
+
"TwentyFiveRooms",
|
|
36
|
+
"ObservationLevel",
|
|
37
|
+
]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Core MiniWorld implementation."""
|
|
2
|
+
|
|
3
|
+
from . import constants
|
|
4
|
+
from .miniworld_gymnasium.entities import COLORS, Box
|
|
5
|
+
from .miniworld_gymnasium.opengl import FrameBuffer
|
|
6
|
+
from .observation_types import ObservationLevel
|
|
7
|
+
|
|
8
|
+
__all__ = ["Box", "COLORS", "FrameBuffer", "ObservationLevel", "constants"]
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Constants for Nine Rooms environments to improve code readability."""
|
|
2
|
+
|
|
3
|
+
from typing import Final
|
|
4
|
+
|
|
5
|
+
# ========================
|
|
6
|
+
# ENVIRONMENT DIMENSIONS
|
|
7
|
+
# ========================
|
|
8
|
+
|
|
9
|
+
# Default room and door sizes
|
|
10
|
+
DEFAULT_ROOM_SIZE: Final[int] = 5
|
|
11
|
+
DEFAULT_DOOR_SIZE: Final[int] = 2
|
|
12
|
+
FACTORY_ROOM_SIZE: Final[int] = 15 # Used in factory for larger environments
|
|
13
|
+
FACTORY_DOOR_SIZE: Final[float] = 2.5
|
|
14
|
+
|
|
15
|
+
# Agent dimensions
|
|
16
|
+
AGENT_RADIUS: Final[float] = 0.5
|
|
17
|
+
AGENT_START_POSITION: Final[tuple[float, float, float]] = (2.5, 0.0, 2.5)
|
|
18
|
+
|
|
19
|
+
# ========================
|
|
20
|
+
# OBSERVATION SETTINGS
|
|
21
|
+
# ========================
|
|
22
|
+
|
|
23
|
+
# Default observation dimensions
|
|
24
|
+
DEFAULT_OBS_WIDTH: Final[int] = 80
|
|
25
|
+
DEFAULT_OBS_HEIGHT: Final[int] = 80
|
|
26
|
+
|
|
27
|
+
# POMDP view radius (units around agent)
|
|
28
|
+
POMDP_VIEW_RADIUS: Final[float] = 2.5
|
|
29
|
+
|
|
30
|
+
# Image color channels
|
|
31
|
+
RGB_CHANNELS: Final[int] = 3
|
|
32
|
+
PIXEL_VALUE_MAX: Final[int] = 255
|
|
33
|
+
|
|
34
|
+
# ========================
|
|
35
|
+
# ENVIRONMENT GENERATION
|
|
36
|
+
# ========================
|
|
37
|
+
|
|
38
|
+
# Box entity generation
|
|
39
|
+
BOXES_PER_ROOM: Final[int] = 9
|
|
40
|
+
BOX_GRID_SIZE: Final[int] = 3 # 3x3 grid of boxes per room
|
|
41
|
+
BOX_SIZE_FRACTION: Final[float] = 2.0 / 15.0 # Box size relative to room size
|
|
42
|
+
BOX_OFFSET_FRACTION: Final[float] = 0.16 # Offset from room edges
|
|
43
|
+
|
|
44
|
+
# Room positioning
|
|
45
|
+
ROOM_BOUNDARY_MARGIN: Final[float] = 0.05 # 95% of room size for boundaries
|
|
46
|
+
ROOM_CENTER_FRACTION: Final[float] = 1.0 / 3.0 # Division for box positioning
|
|
47
|
+
|
|
48
|
+
# ========================
|
|
49
|
+
# PERFORMANCE SETTINGS
|
|
50
|
+
# ========================
|
|
51
|
+
|
|
52
|
+
# Episode limits
|
|
53
|
+
MAX_EPISODE_STEPS: Final[int] = 1000
|
|
54
|
+
|
|
55
|
+
# Warmup and benchmark defaults
|
|
56
|
+
DEFAULT_BENCHMARK_STEPS: Final[int] = 100
|
|
57
|
+
DEFAULT_WARMUP_STEPS: Final[int] = 10
|
|
58
|
+
|
|
59
|
+
# ========================
|
|
60
|
+
# OBSERVATION TEST POSITIONS
|
|
61
|
+
# ========================
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# Convenient position calculations for standard room layouts
|
|
65
|
+
class RoomPositions:
|
|
66
|
+
"""Pre-calculated positions for standard room layouts."""
|
|
67
|
+
|
|
68
|
+
# NineRooms (3x3) strategic positions
|
|
69
|
+
NINE_ROOMS_CENTER: Final[tuple[float, float, float]] = (22.5, 0.0, 22.5)
|
|
70
|
+
NINE_ROOMS_TOP_LEFT: Final[tuple[float, float, float]] = (7.5, 0.0, 7.5)
|
|
71
|
+
NINE_ROOMS_BOTTOM_RIGHT: Final[tuple[float, float, float]] = (37.5, 0.0, 37.5)
|
|
72
|
+
|
|
73
|
+
# TwentyFiveRooms (5x5) strategic positions
|
|
74
|
+
TWENTY_FIVE_CENTER: Final[tuple[float, float, float]] = (75.0, 0.0, 75.0)
|
|
75
|
+
TWENTY_FIVE_CORNER: Final[tuple[float, float, float]] = (37.5, 0.0, 37.5)
|
|
76
|
+
TWENTY_FIVE_FAR_CORNER: Final[tuple[float, float, float]] = (112.5, 0.0, 112.5)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# ========================
|
|
80
|
+
# RENDERING CONSTANTS
|
|
81
|
+
# ========================
|
|
82
|
+
|
|
83
|
+
# Frame buffer settings
|
|
84
|
+
DEFAULT_FRAME_BUFFER_SIZE: Final[int] = 512
|
|
85
|
+
HIGH_RES_FRAME_BUFFER_SIZE: Final[int] = 512
|
|
86
|
+
DEPTH_BUFFER_BITS: Final[int] = 8
|
|
87
|
+
|
|
88
|
+
# Lighting
|
|
89
|
+
DEFAULT_LIGHT_HEIGHT: Final[float] = 2.5
|
|
90
|
+
AMBIENT_LIGHT_LEVEL: Final[float] = 0.45
|
|
91
|
+
|
|
92
|
+
# Memory calculations (for benchmarking)
|
|
93
|
+
FLOAT32_BYTES: Final[int] = 4
|
|
94
|
+
MB_TO_BYTES: Final[int] = 1024 * 1024
|
|
95
|
+
|
|
96
|
+
# ========================
|
|
97
|
+
# OPENGL RENDERING CONSTANTS
|
|
98
|
+
# ========================
|
|
99
|
+
|
|
100
|
+
# Framebuffer scaling
|
|
101
|
+
TOPDOWN_FRAMEBUFFER_SCALE: Final[int] = 20
|
|
102
|
+
|
|
103
|
+
# Physics and interaction constants
|
|
104
|
+
PICKUP_REACH_MULTIPLIER: Final[float] = 1.5
|
|
105
|
+
PICKUP_RADIUS_MULTIPLIER: Final[float] = 1.2
|
|
106
|
+
CARRY_POSITION_OFFSET: Final[float] = 1.05
|
|
107
|
+
INTERACTION_DISTANCE_MULTIPLIER: Final[float] = 1.1
|
|
108
|
+
|
|
109
|
+
# OpenGL clipping planes
|
|
110
|
+
NEAR_CLIPPING_PLANE: Final[float] = 0.04
|
|
111
|
+
FAR_CLIPPING_PLANE: Final[float] = 100.0
|
|
112
|
+
ORTHOGRAPHIC_DEPTH_RANGE: Final[float] = 100.0
|
|
113
|
+
|
|
114
|
+
# Occlusion query dimensions
|
|
115
|
+
OCCLUSION_QUERY_BOX_SIZE: Final[float] = 0.1
|
|
116
|
+
OCCLUSION_QUERY_BOX_HEIGHT: Final[float] = 0.2
|
|
117
|
+
|
|
118
|
+
# Rendering display constants
|
|
119
|
+
DEFAULT_DISPLAY_WIDTH: Final[int] = 256
|
|
120
|
+
DEFAULT_WINDOW_WIDTH: Final[int] = 800
|
|
121
|
+
DEFAULT_WINDOW_HEIGHT: Final[int] = 600
|
|
122
|
+
FONT_SIZE: Final[int] = 14
|
|
123
|
+
TEXT_LABEL_WIDTH: Final[int] = 400
|
|
124
|
+
TEXT_MARGIN_X: Final[int] = 5
|
|
125
|
+
TEXT_MARGIN_Y: Final[int] = 19
|
|
126
|
+
|
|
127
|
+
# Rendering thresholds and tolerances
|
|
128
|
+
EDGE_FACING_THRESHOLD: Final[float] = -0.9
|
|
129
|
+
EDGE_TOUCHING_THRESHOLD: Final[float] = 0.05
|
|
130
|
+
PORTAL_CONNECTION_TOLERANCE: Final[float] = 0.001
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Adapted from [MiniWorld](https://github.com/Farama-Foundation/Miniworld)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Base MiniWorld environment class."""
|
|
2
|
+
|
|
3
|
+
from .params import DEFAULT_PARAMS
|
|
4
|
+
from .unified_env import UnifiedMiniWorldEnv
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MiniWorldEnv(UnifiedMiniWorldEnv):
|
|
8
|
+
"""
|
|
9
|
+
Legacy base class for MiniWorld environments.
|
|
10
|
+
|
|
11
|
+
This class provides backward compatibility with the original MiniWorld
|
|
12
|
+
environment interface while leveraging the unified implementation.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
max_episode_steps=1500,
|
|
18
|
+
obs_width=80,
|
|
19
|
+
obs_height=80,
|
|
20
|
+
window_width=800,
|
|
21
|
+
window_height=600,
|
|
22
|
+
params=DEFAULT_PARAMS,
|
|
23
|
+
domain_rand=False,
|
|
24
|
+
):
|
|
25
|
+
"""
|
|
26
|
+
Initialize base MiniWorld environment.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
max_episode_steps: Maximum steps per episode
|
|
30
|
+
obs_width: Observation width in pixels
|
|
31
|
+
obs_height: Observation height in pixels
|
|
32
|
+
window_width: Window width for human rendering
|
|
33
|
+
window_height: Window height for human rendering
|
|
34
|
+
params: Environment parameters for domain randomization
|
|
35
|
+
domain_rand: Whether to enable domain randomization
|
|
36
|
+
"""
|
|
37
|
+
# Mark this as a base environment (not custom) for background color handling
|
|
38
|
+
self._is_custom_env = False
|
|
39
|
+
|
|
40
|
+
# Initialize using unified base with base environment defaults
|
|
41
|
+
super().__init__(
|
|
42
|
+
obs_level=3, # Default to FIRST_PERSON for base environments
|
|
43
|
+
continuous=False, # Base environments use discrete actions
|
|
44
|
+
agent_mode="circle", # Default agent mode
|
|
45
|
+
max_episode_steps=max_episode_steps,
|
|
46
|
+
obs_width=obs_width,
|
|
47
|
+
obs_height=obs_height,
|
|
48
|
+
window_width=window_width,
|
|
49
|
+
window_height=window_height,
|
|
50
|
+
params=params,
|
|
51
|
+
domain_rand=domain_rand,
|
|
52
|
+
)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""Entity classes for MiniWorld environments."""
|
|
2
|
+
|
|
3
|
+
from .agent import Agent
|
|
4
|
+
from .base_entity import COLOR_NAMES, COLORS, Entity, MeshEnt
|
|
5
|
+
from .objects import Ball, Box, Key
|
|
6
|
+
|
|
7
|
+
__all__ = ["Entity", "MeshEnt", "COLORS", "COLOR_NAMES", "Box", "Key", "Ball", "Agent"]
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""Agent entity for MiniWorld environments."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from pyglet.gl import *
|
|
7
|
+
|
|
8
|
+
from ..math import *
|
|
9
|
+
from .base_entity import Entity
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Agent(Entity):
|
|
13
|
+
"""The agent entity that represents the player/robot in the environment."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, mode="triangle"):
|
|
16
|
+
super().__init__()
|
|
17
|
+
self.mode = mode
|
|
18
|
+
self.trable = False
|
|
19
|
+
|
|
20
|
+
# Distance between the camera and the floor
|
|
21
|
+
self.cam_height = 1.5
|
|
22
|
+
|
|
23
|
+
# Camera up/down angles in degrees
|
|
24
|
+
# Positive angles tilt the camera upwards
|
|
25
|
+
self.cam_pitch = 0
|
|
26
|
+
|
|
27
|
+
# Vertical field of view in degrees
|
|
28
|
+
self.cam_fov_y = 60
|
|
29
|
+
|
|
30
|
+
# Bounding cylinder size for the agent
|
|
31
|
+
if self.mode == "circle":
|
|
32
|
+
self.radius = 0.5
|
|
33
|
+
else:
|
|
34
|
+
self.radius = 0.6
|
|
35
|
+
self.height = 1.6
|
|
36
|
+
|
|
37
|
+
# Object currently being carried by the agent
|
|
38
|
+
self.carrying = None
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def cam_pos(self):
|
|
42
|
+
"""Camera position in 3D space"""
|
|
43
|
+
rot_y = gen_rot_matrix(Y_VEC, self.dir)
|
|
44
|
+
cam_disp = np.array([self.cam_fwd_disp, self.cam_height, 0])
|
|
45
|
+
cam_disp = np.dot(cam_disp, rot_y)
|
|
46
|
+
|
|
47
|
+
return self.pos + cam_disp
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def cam_dir(self):
|
|
51
|
+
"""Camera direction (lookat) vector
|
|
52
|
+
|
|
53
|
+
Note: this is useful even if just for slight domain
|
|
54
|
+
randomization of camera angle
|
|
55
|
+
"""
|
|
56
|
+
rot_z = gen_rot_matrix(Z_VEC, self.cam_pitch * math.pi / 180)
|
|
57
|
+
rot_y = gen_rot_matrix(Y_VEC, self.dir)
|
|
58
|
+
|
|
59
|
+
dir = np.dot(X_VEC, rot_z)
|
|
60
|
+
dir = np.dot(dir, rot_y)
|
|
61
|
+
|
|
62
|
+
return dir
|
|
63
|
+
|
|
64
|
+
def randomize(self, params, rng):
|
|
65
|
+
params.sample_many(
|
|
66
|
+
rng,
|
|
67
|
+
self,
|
|
68
|
+
[
|
|
69
|
+
"cam_height",
|
|
70
|
+
"cam_fwd_disp",
|
|
71
|
+
"cam_pitch",
|
|
72
|
+
"cam_fov_y",
|
|
73
|
+
],
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
def render(self):
|
|
77
|
+
"""Draw the agent"""
|
|
78
|
+
# Note: this is currently only used in the top view
|
|
79
|
+
# Eventually, we will want a proper 3D model
|
|
80
|
+
|
|
81
|
+
if self.mode == "circle":
|
|
82
|
+
|
|
83
|
+
def draw_circle(pos, radius, num_segments):
|
|
84
|
+
glBegin(GL_LINE_STRIP)
|
|
85
|
+
glVertex3f(*pos) # Center vertex
|
|
86
|
+
for i in range(num_segments + 1):
|
|
87
|
+
angle = 2.0 * math.pi * i / num_segments
|
|
88
|
+
x = radius * math.cos(angle) + pos[0]
|
|
89
|
+
y = radius * math.sin(angle) + pos[2]
|
|
90
|
+
glVertex3f(*self.pos)
|
|
91
|
+
glVertex3f(x, 100.0, y)
|
|
92
|
+
glEnd()
|
|
93
|
+
|
|
94
|
+
glColor3f(1, 0, 0)
|
|
95
|
+
draw_circle(self.pos, self.radius, 1024)
|
|
96
|
+
|
|
97
|
+
elif self.mode == "triangle":
|
|
98
|
+
p = self.pos + Y_VEC * 100
|
|
99
|
+
dv = self.dir_vec * self.radius
|
|
100
|
+
rv = self.right_vec * self.radius
|
|
101
|
+
|
|
102
|
+
p0 = p + dv
|
|
103
|
+
p1 = p + 0.75 * (rv - dv)
|
|
104
|
+
p2 = p + 0.75 * (-rv - dv)
|
|
105
|
+
|
|
106
|
+
glColor3f(1, 0, 0)
|
|
107
|
+
glBegin(GL_TRIANGLES)
|
|
108
|
+
glVertex3f(*p0)
|
|
109
|
+
glVertex3f(*p2)
|
|
110
|
+
glVertex3f(*p1)
|
|
111
|
+
glEnd()
|
|
112
|
+
|
|
113
|
+
else:
|
|
114
|
+
pass
|
|
115
|
+
|
|
116
|
+
def step(self, delta_time):
|
|
117
|
+
pass
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""Base entity classes for MiniWorld environments."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from pyglet.gl import *
|
|
7
|
+
|
|
8
|
+
from ..math import *
|
|
9
|
+
from ..objmesh import ObjMesh
|
|
10
|
+
|
|
11
|
+
# Map of color names to RGB values
|
|
12
|
+
COLORS = {
|
|
13
|
+
"red": np.array([1.0, 0.0, 0.0]),
|
|
14
|
+
"green": np.array([0.0, 1.0, 0.0]),
|
|
15
|
+
"blue": np.array([0.0, 0.0, 1.0]),
|
|
16
|
+
"purple": np.array([0.44, 0.15, 0.76]),
|
|
17
|
+
"yellow": np.array([1.00, 1.00, 0.00]),
|
|
18
|
+
# 'grey' : np.array([0.39, 0.39, 0.39]),
|
|
19
|
+
"light_yellow": np.array([0.5, 0.00, 0.39]),
|
|
20
|
+
"color1": np.array([0.7, 0.9, 0.39]),
|
|
21
|
+
"color2": np.array([0.15, 0.3, 0.39]),
|
|
22
|
+
"color3": np.array([1.0, 0.5, 0.0]),
|
|
23
|
+
"color4": np.array([1.0, 0.0, 0.5]),
|
|
24
|
+
"color5": np.array([0.3, 0.7, 0.1]),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
# List of color names, sorted alphabetically
|
|
28
|
+
COLOR_NAMES = sorted(list(COLORS.keys()))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Entity:
|
|
32
|
+
"""Base class for all entities in the MiniWorld environment."""
|
|
33
|
+
|
|
34
|
+
def __init__(self):
|
|
35
|
+
# World position
|
|
36
|
+
# Note: for most entities, the position is at floor level
|
|
37
|
+
self.pos = None
|
|
38
|
+
|
|
39
|
+
# Direction/orientation angle in radians
|
|
40
|
+
self.dir = None
|
|
41
|
+
|
|
42
|
+
# Radius for bounding circle/cylinder
|
|
43
|
+
self.radius = 0
|
|
44
|
+
|
|
45
|
+
# Height of bounding cylinder
|
|
46
|
+
self.height = 0
|
|
47
|
+
|
|
48
|
+
def randomize(self, params, rng):
|
|
49
|
+
"""Set the domain randomization parameters"""
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
def render(self):
|
|
53
|
+
"""Draw the object"""
|
|
54
|
+
raise NotImplementedError
|
|
55
|
+
|
|
56
|
+
def step(self, delta_time):
|
|
57
|
+
"""Update the state of the object"""
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
def draw_bound(self):
|
|
61
|
+
"""Draw the bounding circle (used for debugging purposes)"""
|
|
62
|
+
x, _, z = self.pos
|
|
63
|
+
|
|
64
|
+
glColor3f(1, 0, 0)
|
|
65
|
+
glBegin(GL_LINES)
|
|
66
|
+
|
|
67
|
+
for i in range(60):
|
|
68
|
+
a = i * 2 * math.pi / 60
|
|
69
|
+
cx = x + self.radius * math.cos(a)
|
|
70
|
+
cz = z + self.radius * math.sin(a)
|
|
71
|
+
glVertex3f(cx, 0.01, cz)
|
|
72
|
+
|
|
73
|
+
glEnd()
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def dir_vec(self):
|
|
77
|
+
"""Vector pointing in the direction of forward movement"""
|
|
78
|
+
x = math.cos(self.dir)
|
|
79
|
+
z = -math.sin(self.dir)
|
|
80
|
+
return np.array([x, 0, z])
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def right_vec(self):
|
|
84
|
+
"""Vector pointing to the right of the agent"""
|
|
85
|
+
x = math.sin(self.dir)
|
|
86
|
+
z = math.cos(self.dir)
|
|
87
|
+
return np.array([x, 0, z])
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def is_static(self):
|
|
91
|
+
"""True for objects that cannot move or animate (can be rendered statically)"""
|
|
92
|
+
return False
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class MeshEnt(Entity):
|
|
96
|
+
"""Entity whose appearance is defined by a mesh file
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
mesh_name: Name of the mesh file
|
|
100
|
+
height: Scale the model to this height
|
|
101
|
+
static: Flag indicating this object cannot move
|
|
102
|
+
transparentable: Whether this entity can be made transparent
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
def __init__(self, mesh_name, height, static=True, transparentable=False):
|
|
106
|
+
super().__init__()
|
|
107
|
+
self.trable = transparentable
|
|
108
|
+
self.static = static
|
|
109
|
+
|
|
110
|
+
# Load the mesh
|
|
111
|
+
self.mesh = ObjMesh.get(mesh_name)
|
|
112
|
+
|
|
113
|
+
# Get the mesh extents
|
|
114
|
+
sx, sy, sz = self.mesh.max_coords
|
|
115
|
+
|
|
116
|
+
# Compute the mesh scaling factor
|
|
117
|
+
self.scale = height / sy
|
|
118
|
+
|
|
119
|
+
# Compute the radius and height
|
|
120
|
+
self.radius = math.sqrt(sx * sx + sz * sz) * self.scale
|
|
121
|
+
self.height = height
|
|
122
|
+
|
|
123
|
+
def render(self):
|
|
124
|
+
"""Draw the object"""
|
|
125
|
+
glPushMatrix()
|
|
126
|
+
glTranslatef(*self.pos)
|
|
127
|
+
glScalef(self.scale, self.scale, self.scale)
|
|
128
|
+
glRotatef(self.dir * 180 / math.pi, 0, 1, 0)
|
|
129
|
+
glColor3f(1, 1, 1)
|
|
130
|
+
self.mesh.render()
|
|
131
|
+
glPopMatrix()
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def is_static(self):
|
|
135
|
+
return self.static
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""Object entities for MiniWorld environments."""
|
|
2
|
+
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
from pyglet.gl import *
|
|
7
|
+
|
|
8
|
+
from ..opengl import drawBox
|
|
9
|
+
from .base_entity import COLOR_NAMES, COLORS, Entity, MeshEnt
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Box(Entity):
|
|
13
|
+
"""
|
|
14
|
+
Colored box object that can be placed in MiniWorld environments.
|
|
15
|
+
|
|
16
|
+
Boxes can be static (immovable) or dynamic (pickupable by the agent).
|
|
17
|
+
They support transparency effects and domain randomization of colors.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, color, size=0.8, transparentable=False, static=False):
|
|
21
|
+
"""
|
|
22
|
+
Initialize a box entity.
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
color: Color name (must be in COLORS dictionary)
|
|
26
|
+
size: Box size - scalar for cube, or 3-element array for [width, height, depth]
|
|
27
|
+
transparentable: Whether box can become transparent during rendering
|
|
28
|
+
static: Whether box is immovable (True) or pickupable (False)
|
|
29
|
+
"""
|
|
30
|
+
super().__init__()
|
|
31
|
+
|
|
32
|
+
# Store transparency and static properties with descriptive names
|
|
33
|
+
self.is_transparentable = transparentable
|
|
34
|
+
self.static_flag = static
|
|
35
|
+
|
|
36
|
+
# Convert size to 3D dimensions
|
|
37
|
+
if isinstance(size, (int, float)):
|
|
38
|
+
size = np.array([size, size, size])
|
|
39
|
+
size = np.array(size)
|
|
40
|
+
|
|
41
|
+
# Extract dimensions with clear names
|
|
42
|
+
size_x, size_y, size_z = size
|
|
43
|
+
|
|
44
|
+
self.color = color
|
|
45
|
+
self.size = size
|
|
46
|
+
|
|
47
|
+
# Calculate collision radius (distance from center to corner in XZ plane)
|
|
48
|
+
self.radius = math.sqrt(size_x * size_x + size_z * size_z) / 2
|
|
49
|
+
self.height = size_y
|
|
50
|
+
|
|
51
|
+
def randomize(self, params, rng):
|
|
52
|
+
"""
|
|
53
|
+
Apply domain randomization to box appearance.
|
|
54
|
+
|
|
55
|
+
This method randomizes the box color by adding a bias sampled from
|
|
56
|
+
the environment parameters, then clips to valid color range.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
params: Environment parameters containing randomization settings
|
|
60
|
+
rng: Random number generator for sampling
|
|
61
|
+
"""
|
|
62
|
+
base_color = COLORS[self.color]
|
|
63
|
+
color_bias = params.sample(rng, "obj_color_bias")
|
|
64
|
+
self.color_vec = base_color + color_bias
|
|
65
|
+
self.color_vec = np.clip(self.color_vec, 0, 1)
|
|
66
|
+
|
|
67
|
+
def render(self):
|
|
68
|
+
"""Render the box using OpenGL."""
|
|
69
|
+
size_x, size_y, size_z = self.size
|
|
70
|
+
|
|
71
|
+
# Set up OpenGL state for box rendering
|
|
72
|
+
glDisable(GL_TEXTURE_2D)
|
|
73
|
+
glColor3f(*self.color_vec)
|
|
74
|
+
|
|
75
|
+
# Apply transformations
|
|
76
|
+
glPushMatrix()
|
|
77
|
+
glTranslatef(*self.pos)
|
|
78
|
+
glRotatef(self.dir * (180 / math.pi), 0, 1, 0)
|
|
79
|
+
|
|
80
|
+
# Draw the box geometry
|
|
81
|
+
drawBox(
|
|
82
|
+
x_min=-size_x / 2,
|
|
83
|
+
x_max=+size_x / 2,
|
|
84
|
+
y_min=0,
|
|
85
|
+
y_max=size_y,
|
|
86
|
+
z_min=-size_z / 2,
|
|
87
|
+
z_max=+size_z / 2,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
glPopMatrix()
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def is_static(self):
|
|
94
|
+
"""Return whether this box is static (cannot move)."""
|
|
95
|
+
return self.static_flag
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def trable(self):
|
|
99
|
+
"""Legacy property for transparency - kept for backward compatibility."""
|
|
100
|
+
return self.is_transparentable
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class Key(MeshEnt):
|
|
104
|
+
"""Key the agent can pick up, carry, and use to open doors"""
|
|
105
|
+
|
|
106
|
+
def __init__(self, color):
|
|
107
|
+
assert color in COLOR_NAMES
|
|
108
|
+
super().__init__(mesh_name="key_{}".format(color), height=0.35, static=False)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class Ball(MeshEnt):
|
|
112
|
+
"""Ball (sphere) the agent can pick up and carry"""
|
|
113
|
+
|
|
114
|
+
def __init__(self, color, size=0.6):
|
|
115
|
+
assert color in COLOR_NAMES
|
|
116
|
+
super().__init__(mesh_name="ball_{}".format(color), height=size, static=False)
|