mettagrid 0.1.6__tar.gz → 0.2.0.1__tar.gz
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 mettagrid might be problematic. Click here for more details.
- mettagrid-0.2.0.1/.bazelrc +65 -0
- mettagrid-0.2.0.1/BUILD.bazel +60 -0
- mettagrid-0.2.0.1/MANIFEST.in +7 -0
- mettagrid-0.2.0.1/MODULE.bazel +34 -0
- mettagrid-0.2.0.1/PKG-INFO +256 -0
- mettagrid-0.2.0.1/README.md +226 -0
- mettagrid-0.2.0.1/bazel_build.py +128 -0
- mettagrid-0.2.0.1/pyproject.toml +81 -0
- mettagrid-0.2.0.1/setup.cfg +4 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/__init__.py +61 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/action_handler.hpp +137 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/attack.hpp +235 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/change_color.hpp +40 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/change_glyph.hpp +54 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/get_output.hpp +58 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/move.hpp +80 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/noop.hpp +24 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/orientation.hpp +128 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/put_recipe_items.hpp +56 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/rotate.hpp +49 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/actions/swap.hpp +42 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/builder/__init__.py +7 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/builder/building.py +52 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/builder/empty_converters.py +85 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/builder/envs.py +207 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/char_encoder.py +55 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/config.py +106 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/core.py +291 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/episode_stats_db.py +157 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/event.hpp +87 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/grid.hpp +221 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/grid_object.hpp +84 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/grid_object_formatter.py +95 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/gym_env.py +127 -0
- {mettagrid-0.1.6 → mettagrid-0.2.0.1/src/metta}/mettagrid/gym_wrapper.py +0 -53
- mettagrid-0.2.0.1/src/metta/mettagrid/hash.hpp +130 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/map_builder/__init__.py +10 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/map_builder/ascii.py +38 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/map_builder/map_builder.py +147 -0
- {mettagrid-0.1.6/mettagrid/config/room → mettagrid-0.2.0.1/src/metta/mettagrid/map_builder}/maze.py +52 -31
- mettagrid-0.2.0.1/src/metta/mettagrid/map_builder/perimeter_incontext.py +101 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/map_builder/random.py +95 -0
- {mettagrid-0.1.6/mettagrid/config/room → mettagrid-0.2.0.1/src/metta/mettagrid/map_builder}/utils.py +7 -39
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/load.py +35 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/mapgen.py +322 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/mapgen_ascii.py +51 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/random/float.py +99 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/random/int.py +50 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scene.py +323 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/ascii.py +41 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/auto.py +149 -0
- {mettagrid-0.1.6/mettagrid/map → mettagrid-0.2.0.1/src/metta/mettagrid/mapgen}/scenes/bsp.py +40 -49
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/convchain.py +180 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/copy_grid.py +36 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/grid_altars.py +118 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/inline_ascii.py +42 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/layout.py +31 -0
- {mettagrid-0.1.6/mettagrid/map → mettagrid-0.2.0.1/src/metta/mettagrid/mapgen}/scenes/make_connected.py +19 -22
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/maze.py +212 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/mean_distance.py +48 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/mirror.py +120 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/multi_left_and_right.py +117 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/nop.py +15 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/radial_maze.py +50 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/random.py +65 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/random_dcss_scene.py +48 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/random_objects.py +35 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/random_scene.py +31 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/random_yaml_scene.py +32 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/remove_agents.py +26 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/room_grid.py +77 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/spiral.py +104 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/transplant_scene.py +42 -0
- {mettagrid-0.1.6/mettagrid/config/room → mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes}/varied_terrain.py +112 -150
- {mettagrid-0.1.6/mettagrid/map → mettagrid-0.2.0.1/src/metta/mettagrid/mapgen}/scenes/wfc.py +41 -48
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/scenes/yaml.py +22 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/tools/dcss_import.py +123 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/tools/gen.py +94 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/tools/gen_scene.py +51 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/tools/view.py +25 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/types.py +81 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/ascii_grid.py +55 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/draw.py +32 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/make_scene_config.py +36 -0
- {mettagrid-0.1.6/mettagrid/map → mettagrid-0.2.0.1/src/metta/mettagrid/mapgen}/utils/pattern.py +19 -21
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/s3utils.py +44 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/show.py +21 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/storable_map.py +117 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/storable_map_index.py +92 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mapgen/utils/thumbnail.py +360 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_c.cpp +944 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_c.hpp +179 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_c.pyi +232 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_c_config.py +245 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_config.hpp +126 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_config.py +207 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/mettagrid_env.py +308 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/agent.hpp +248 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/agent_config.hpp +99 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/constants.hpp +106 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/converter.hpp +218 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/converter_config.hpp +91 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/has_inventory.hpp +39 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/production_handler.hpp +40 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/objects/wall.hpp +58 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/observation_encoder.hpp +98 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/packed_coordinate.hpp +173 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/pettingzoo_env.py +213 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/profiling/__init__.py +1 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/profiling/memory_monitor.py +242 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/profiling/stopwatch.py +711 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/profiling/system_monitor.py +355 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/puffer_base.py +143 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/renderer/hermes.cpp +1242 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/renderer/hermes.hpp +50 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/renderer/hermes.py +13 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/renderer/miniscope.py +138 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/renderer/nethack.py +101 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/replay_writer.py +136 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/stats_tracker.hpp +165 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/stats_writer.py +55 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/test_support/__init__.py +7 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/test_support/actions.py +426 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/test_support/mapgen.py +77 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/test_support/observation_helper.py +50 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/test_support/orientation.py +100 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/test_support/token_types.py +18 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/types.hpp +62 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/util/debug.py +501 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/util/dict_utils.py +10 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/util/diversity.py +71 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/util/file.py +569 -0
- mettagrid-0.2.0.1/src/metta/mettagrid/util/module.py +12 -0
- mettagrid-0.2.0.1/src/mettagrid.egg-info/PKG-INFO +256 -0
- mettagrid-0.2.0.1/src/mettagrid.egg-info/SOURCES.txt +172 -0
- mettagrid-0.2.0.1/src/mettagrid.egg-info/dependency_links.txt +1 -0
- mettagrid-0.2.0.1/src/mettagrid.egg-info/requires.txt +16 -0
- mettagrid-0.2.0.1/src/mettagrid.egg-info/top_level.txt +1 -0
- mettagrid-0.2.0.1/tests/test_action_compatibility.py +466 -0
- mettagrid-0.2.0.1/tests/test_actions.py +362 -0
- mettagrid-0.2.0.1/tests/test_attack_resource_exception.py +104 -0
- mettagrid-0.2.0.1/tests/test_buffer_reuse.py +122 -0
- mettagrid-0.2.0.1/tests/test_buffers.py +458 -0
- mettagrid-0.2.0.1/tests/test_converter.py +176 -0
- mettagrid-0.2.0.1/tests/test_diversity.py +185 -0
- mettagrid-0.2.0.1/tests/test_env_config_serialization.py +97 -0
- mettagrid-0.2.0.1/tests/test_env_map.py +11 -0
- mettagrid-0.2.0.1/tests/test_forbidden_imports.py +68 -0
- mettagrid-0.2.0.1/tests/test_gdrive.py +64 -0
- mettagrid-0.2.0.1/tests/test_global_obs_config.py +156 -0
- mettagrid-0.2.0.1/tests/test_global_observations.py +15 -0
- mettagrid-0.2.0.1/tests/test_global_reward_observations.py +236 -0
- mettagrid-0.2.0.1/tests/test_gym_env.py +113 -0
- mettagrid-0.2.0.1/tests/test_interactive.py +244 -0
- mettagrid-0.2.0.1/tests/test_leaks.py +79 -0
- mettagrid-0.2.0.1/tests/test_mettagrid.py +141 -0
- mettagrid-0.2.0.1/tests/test_move.py +835 -0
- mettagrid-0.2.0.1/tests/test_new_env_hierarchy.py +219 -0
- mettagrid-0.2.0.1/tests/test_observations.py +778 -0
- mettagrid-0.2.0.1/tests/test_pettingzoo_env.py +357 -0
- mettagrid-0.2.0.1/tests/test_pufferlib_integration.py +136 -0
- mettagrid-0.2.0.1/tests/test_resource_loss.py +186 -0
- mettagrid-0.2.0.1/tests/test_rewards.py +208 -0
- mettagrid-0.2.0.1/tests/test_rotate.py +241 -0
- mettagrid-0.2.0.1/tests/test_stats_rewards.py +129 -0
- mettagrid-0.2.0.1/tests/test_stats_writer.py +113 -0
- mettagrid-0.2.0.1/tests/test_swap.py +302 -0
- mettagrid-0.2.0.1/tests/test_visitation_counts.py +292 -0
- mettagrid-0.1.6/PKG-INFO +0 -148
- mettagrid-0.1.6/README.md +0 -127
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/action_handler.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack_nearest.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/change_color.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/get_output.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/noop.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/put_recipe_items.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/swap.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/event.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/grid.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/grid_env.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/grid_object.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/agent.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/constants.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/converter.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/metta_object.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/production_handler.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/wall.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/observation_encoder.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build/lib.macosx-11.0-arm64-cpython-311/mettagrid/stats_tracker.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/build_debug/mettagrid/action_handler.cpp +0 -10456
- mettagrid-0.1.6/build_debug/mettagrid/actions/attack.cpp +0 -10055
- mettagrid-0.1.6/build_debug/mettagrid/actions/attack_nearest.cpp +0 -9024
- mettagrid-0.1.6/build_debug/mettagrid/actions/change_color.cpp +0 -9092
- mettagrid-0.1.6/build_debug/mettagrid/actions/get_output.cpp +0 -9289
- mettagrid-0.1.6/build_debug/mettagrid/actions/move.cpp +0 -8975
- mettagrid-0.1.6/build_debug/mettagrid/actions/noop.cpp +0 -8766
- mettagrid-0.1.6/build_debug/mettagrid/actions/put_recipe_items.cpp +0 -9263
- mettagrid-0.1.6/build_debug/mettagrid/actions/rotate.cpp +0 -8786
- mettagrid-0.1.6/build_debug/mettagrid/actions/swap.cpp +0 -8940
- mettagrid-0.1.6/build_debug/mettagrid/event.cpp +0 -4422
- mettagrid-0.1.6/build_debug/mettagrid/event.hpp +0 -96
- mettagrid-0.1.6/build_debug/mettagrid/grid.cpp +0 -1
- mettagrid-0.1.6/build_debug/mettagrid/grid.hpp +0 -191
- mettagrid-0.1.6/build_debug/mettagrid/grid_env.cpp +0 -44978
- mettagrid-0.1.6/build_debug/mettagrid/grid_object.cpp +0 -4351
- mettagrid-0.1.6/build_debug/mettagrid/grid_object.hpp +0 -58
- mettagrid-0.1.6/build_debug/mettagrid/mettagrid.cpp +0 -40707
- mettagrid-0.1.6/build_debug/mettagrid/objects/agent.cpp +0 -4433
- mettagrid-0.1.6/build_debug/mettagrid/objects/agent.hpp +0 -137
- mettagrid-0.1.6/build_debug/mettagrid/objects/constants.cpp +0 -4400
- mettagrid-0.1.6/build_debug/mettagrid/objects/constants.hpp +0 -107
- mettagrid-0.1.6/build_debug/mettagrid/objects/converter.cpp +0 -4464
- mettagrid-0.1.6/build_debug/mettagrid/objects/converter.hpp +0 -163
- mettagrid-0.1.6/build_debug/mettagrid/objects/has_inventory.hpp +0 -37
- mettagrid-0.1.6/build_debug/mettagrid/objects/metta_object.cpp +0 -4409
- mettagrid-0.1.6/build_debug/mettagrid/objects/metta_object.hpp +0 -27
- mettagrid-0.1.6/build_debug/mettagrid/objects/production_handler.cpp +0 -4431
- mettagrid-0.1.6/build_debug/mettagrid/objects/production_handler.hpp +0 -41
- mettagrid-0.1.6/build_debug/mettagrid/objects/wall.cpp +0 -4417
- mettagrid-0.1.6/build_debug/mettagrid/objects/wall.hpp +0 -39
- mettagrid-0.1.6/build_debug/mettagrid/observation_encoder.cpp +0 -33483
- mettagrid-0.1.6/build_debug/mettagrid/stats_tracker.cpp +0 -1
- mettagrid-0.1.6/build_debug/mettagrid/stats_tracker.hpp +0 -78
- mettagrid-0.1.6/mettagrid/__init__.py +0 -4
- mettagrid-0.1.6/mettagrid/action.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/action_handler.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/action_handler.pxd +0 -43
- mettagrid-0.1.6/mettagrid/action_handler.pyx +0 -61
- mettagrid-0.1.6/mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/attack.pxd +0 -14
- mettagrid-0.1.6/mettagrid/actions/attack.pyx +0 -112
- mettagrid-0.1.6/mettagrid/actions/attack_nearest.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/attack_nearest.pxd +0 -4
- mettagrid-0.1.6/mettagrid/actions/attack_nearest.pyx +0 -49
- mettagrid-0.1.6/mettagrid/actions/change_color.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/change_color.pxd +0 -8
- mettagrid-0.1.6/mettagrid/actions/change_color.pyx +0 -30
- mettagrid-0.1.6/mettagrid/actions/get_output.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/get_output.pxd +0 -5
- mettagrid-0.1.6/mettagrid/actions/get_output.pyx +0 -56
- mettagrid-0.1.6/mettagrid/actions/gift.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/metta_action_handler.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/move.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/move.pxd +0 -5
- mettagrid-0.1.6/mettagrid/actions/move.pyx +0 -46
- mettagrid-0.1.6/mettagrid/actions/noop.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/noop.pxd +0 -5
- mettagrid-0.1.6/mettagrid/actions/noop.pyx +0 -23
- mettagrid-0.1.6/mettagrid/actions/put_recipe_items.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/put_recipe_items.pxd +0 -5
- mettagrid-0.1.6/mettagrid/actions/put_recipe_items.pyx +0 -48
- mettagrid-0.1.6/mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/rotate.pxd +0 -5
- mettagrid-0.1.6/mettagrid/actions/rotate.pyx +0 -27
- mettagrid-0.1.6/mettagrid/actions/shield.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/swap.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/actions/swap.pxd +0 -5
- mettagrid-0.1.6/mettagrid/actions/swap.pyx +0 -46
- mettagrid-0.1.6/mettagrid/actions/use.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/base_encoder.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/config/room/ascii.py +0 -30
- mettagrid-0.1.6/mettagrid/config/room/cognitive_evals/barriermaze.py +0 -113
- mettagrid-0.1.6/mettagrid/config/room/cognitive_evals/corridor_maze.py +0 -91
- mettagrid-0.1.6/mettagrid/config/room/cognitive_evals/explore_exploit.py +0 -109
- mettagrid-0.1.6/mettagrid/config/room/cognitive_evals/labyrinth.py +0 -111
- mettagrid-0.1.6/mettagrid/config/room/cognitive_evals/radial_maze.py +0 -77
- mettagrid-0.1.6/mettagrid/config/room/cognitive_evals/room_within_room.py +0 -92
- mettagrid-0.1.6/mettagrid/config/room/mean_distance.py +0 -97
- mettagrid-0.1.6/mettagrid/config/room/multi_room.py +0 -10
- mettagrid-0.1.6/mettagrid/config/room/random.py +0 -56
- mettagrid-0.1.6/mettagrid/config/room/room.py +0 -27
- mettagrid-0.1.6/mettagrid/config/room/room_list.py +0 -55
- mettagrid-0.1.6/mettagrid/config/room/room_scene.py +0 -29
- mettagrid-0.1.6/mettagrid/event.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/event.hpp +0 -96
- mettagrid-0.1.6/mettagrid/event.pxd +0 -40
- mettagrid-0.1.6/mettagrid/grid.cpp +0 -1
- mettagrid-0.1.6/mettagrid/grid.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/grid.hpp +0 -191
- mettagrid-0.1.6/mettagrid/grid.pxd +0 -42
- mettagrid-0.1.6/mettagrid/grid_agent.pxd +0 -6
- mettagrid-0.1.6/mettagrid/grid_env.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/grid_env.pxd +0 -114
- mettagrid-0.1.6/mettagrid/grid_env.pyx +0 -322
- mettagrid-0.1.6/mettagrid/grid_object.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/grid_object.hpp +0 -58
- mettagrid-0.1.6/mettagrid/grid_object.pxd +0 -36
- mettagrid-0.1.6/mettagrid/grid_object.pyx +0 -0
- mettagrid-0.1.6/mettagrid/map/mapgen.py +0 -36
- mettagrid-0.1.6/mettagrid/map/node.py +0 -104
- mettagrid-0.1.6/mettagrid/map/scene.py +0 -79
- mettagrid-0.1.6/mettagrid/map/scenes/ascii.py +0 -22
- mettagrid-0.1.6/mettagrid/map/scenes/auto.py +0 -130
- mettagrid-0.1.6/mettagrid/map/scenes/convchain.py +0 -84
- mettagrid-0.1.6/mettagrid/map/scenes/inline_ascii.py +0 -40
- mettagrid-0.1.6/mettagrid/map/scenes/maze.py +0 -144
- mettagrid-0.1.6/mettagrid/map/scenes/mirror.py +0 -45
- mettagrid-0.1.6/mettagrid/map/scenes/random.py +0 -75
- mettagrid-0.1.6/mettagrid/map/scenes/random_objects.py +0 -45
- mettagrid-0.1.6/mettagrid/map/scenes/random_scene.py +0 -32
- mettagrid-0.1.6/mettagrid/map/scenes/room_grid.py +0 -53
- mettagrid-0.1.6/mettagrid/map/utils/random.py +0 -90
- mettagrid-0.1.6/mettagrid/mettagrid.pyx +0 -228
- mettagrid-0.1.6/mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/mettagrid_env.py +0 -229
- mettagrid-0.1.6/mettagrid/objects/agent.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/agent.hpp +0 -137
- mettagrid-0.1.6/mettagrid/objects/agent.pxd +0 -42
- mettagrid-0.1.6/mettagrid/objects/agent.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects/altar.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/armory.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/constants.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/constants.hpp +0 -107
- mettagrid-0.1.6/mettagrid/objects/constants.pxd +0 -43
- mettagrid-0.1.6/mettagrid/objects/constants.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects/converter.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/converter.hpp +0 -163
- mettagrid-0.1.6/mettagrid/objects/converter.pxd +0 -22
- mettagrid-0.1.6/mettagrid/objects/converter.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects/factory.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/generator.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/has_inventory.hpp +0 -37
- mettagrid-0.1.6/mettagrid/objects/has_inventory.pxd +0 -12
- mettagrid-0.1.6/mettagrid/objects/has_inventory.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects/lab.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/lasery.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/metta_object.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/metta_object.hpp +0 -27
- mettagrid-0.1.6/mettagrid/objects/metta_object.pxd +0 -12
- mettagrid-0.1.6/mettagrid/objects/metta_object.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects/mine.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/production_handler.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/production_handler.hpp +0 -41
- mettagrid-0.1.6/mettagrid/objects/production_handler.pxd +0 -13
- mettagrid-0.1.6/mettagrid/objects/production_handler.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects/reset_handler.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/usable.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/wall.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/objects/wall.hpp +0 -39
- mettagrid-0.1.6/mettagrid/objects/wall.pxd +0 -11
- mettagrid-0.1.6/mettagrid/objects/wall.pyx +0 -0
- mettagrid-0.1.6/mettagrid/objects.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/observation_encoder.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/observation_encoder.pxd +0 -22
- mettagrid-0.1.6/mettagrid/observation_encoder.pyx +0 -82
- mettagrid-0.1.6/mettagrid/renderer/assets/Inter-Regular.ttf +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/altar.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/converter.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/generator.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/items.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/monsters.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-0.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-1.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-2.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-3.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-4.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-5.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/ore-6.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/puffer_chars.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/assets/wall.png +0 -0
- mettagrid-0.1.6/mettagrid/renderer/json_renderer.py +0 -0
- mettagrid-0.1.6/mettagrid/renderer/raylib/camera_controller.py +0 -59
- mettagrid-0.1.6/mettagrid/renderer/raylib/font_renderer.py +0 -33
- mettagrid-0.1.6/mettagrid/renderer/raylib/object_render.py +0 -223
- mettagrid-0.1.6/mettagrid/renderer/raylib/raylib_renderer.py +0 -545
- mettagrid-0.1.6/mettagrid/renderer/render_code_example.py +0 -54
- mettagrid-0.1.6/mettagrid/resolvers.py +0 -131
- mettagrid-0.1.6/mettagrid/stats_tracker.cpp +0 -1
- mettagrid-0.1.6/mettagrid/stats_tracker.cpython-311-darwin.so +0 -0
- mettagrid-0.1.6/mettagrid/stats_tracker.hpp +0 -78
- mettagrid-0.1.6/mettagrid/stats_tracker.pxd +0 -26
- mettagrid-0.1.6/player/tests/test_z.py +0 -19
- mettagrid-0.1.6/player/tools/gen_atlas.py +0 -47
- mettagrid-0.1.6/pyproject.toml +0 -47
- mettagrid-0.1.6/setup.py +0 -93
- mettagrid-0.1.6/tests/benchmark_env_perf.py +0 -121
- mettagrid-0.1.6/tests/mapgen.py +0 -92
- mettagrid-0.1.6/tests/regen_env_trace.py +0 -134
- mettagrid-0.1.6/tests/regen_kinship_trace.py +0 -83
- mettagrid-0.1.6/tests/regen_track_last_action_trace.py +0 -64
- mettagrid-0.1.6/tests/test_basic.py +0 -121
- mettagrid-0.1.6/tests/test_kinship.py +0 -96
- mettagrid-0.1.6/tests/test_leaks.py +0 -22
- mettagrid-0.1.6/tests/test_pattern.py +0 -248
- mettagrid-0.1.6/tests/test_resolvers.py +0 -191
- {mettagrid-0.1.6 → mettagrid-0.2.0.1}/LICENSE +0 -0
- {mettagrid-0.1.6 → mettagrid-0.2.0.1/src/metta}/mettagrid/actions/__init__.py +0 -0
- {mettagrid-0.1.6/mettagrid/objects → mettagrid-0.2.0.1/src/metta/mettagrid/mapgen}/__init__.py +0 -0
- {mettagrid-0.1.6/tests → mettagrid-0.2.0.1/src/metta/mettagrid/objects}/__init__.py +0 -0
- /mettagrid-0.1.6/mettagrid/event.pyx → /mettagrid-0.2.0.1/src/metta/mettagrid/py.typed +0 -0
- /mettagrid-0.1.6/mettagrid/grid_agent.pyx → /mettagrid-0.2.0.1/src/metta/mettagrid/util/__init__.py +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Bazel configuration for mettagrid
|
|
2
|
+
|
|
3
|
+
# Common C++ build flags
|
|
4
|
+
build --cxxopt=-std=c++20
|
|
5
|
+
build --host_cxxopt=-std=c++20
|
|
6
|
+
|
|
7
|
+
# Use the current Python from environment
|
|
8
|
+
build --action_env=PYTHON_BIN_PATH
|
|
9
|
+
build --action_env=PYTHON_LIB_PATH
|
|
10
|
+
build --python_path=python
|
|
11
|
+
|
|
12
|
+
# Prod build mode. --compilation_mode=[opt|dbg] is a required Bazel field.
|
|
13
|
+
build:opt --compilation_mode=opt
|
|
14
|
+
build:opt --copt=-O3
|
|
15
|
+
build:opt --copt=-DNDEBUG
|
|
16
|
+
build:opt --strip=always
|
|
17
|
+
|
|
18
|
+
# Debug build mode. --compilation_mode=[opt|dbg] is a required Bazel field.
|
|
19
|
+
build:dbg --compilation_mode=dbg
|
|
20
|
+
build:dbg --copt=-O0
|
|
21
|
+
build:dbg --copt=-g
|
|
22
|
+
build:dbg --strip=never
|
|
23
|
+
|
|
24
|
+
# Test configuration
|
|
25
|
+
test --test_output=errors
|
|
26
|
+
test --test_summary=detailed
|
|
27
|
+
|
|
28
|
+
# Coverage configuration
|
|
29
|
+
coverage --combined_report=lcov
|
|
30
|
+
coverage --instrumentation_filter=//:mettagrid_lib,//:mettagrid_c
|
|
31
|
+
|
|
32
|
+
# Platform-specific settings for macOS
|
|
33
|
+
build:macos --copt=-fvisibility=hidden
|
|
34
|
+
build:macos --cxxopt=-stdlib=libc++
|
|
35
|
+
build:macos --linkopt=-stdlib=libc++
|
|
36
|
+
|
|
37
|
+
# Platform-specific settings for Linux
|
|
38
|
+
build:linux --copt=-fvisibility=hidden
|
|
39
|
+
|
|
40
|
+
# Detect and use platform config automatically
|
|
41
|
+
build --enable_platform_specific_config
|
|
42
|
+
|
|
43
|
+
# Silence some warnings in external dependencies
|
|
44
|
+
build --per_file_copt=external/.*@-w
|
|
45
|
+
|
|
46
|
+
# Enable colors in output
|
|
47
|
+
common --color=yes
|
|
48
|
+
|
|
49
|
+
# Show progress messages
|
|
50
|
+
common --show_progress_rate_limit=0.5
|
|
51
|
+
|
|
52
|
+
# Local disk cache configuration
|
|
53
|
+
build --disk_cache=~/.cache/bazel
|
|
54
|
+
build --repository_cache=~/.cache/bazel-repo
|
|
55
|
+
|
|
56
|
+
# Build execution optimization
|
|
57
|
+
build --jobs=auto
|
|
58
|
+
build --local_test_jobs=auto
|
|
59
|
+
|
|
60
|
+
# CI configuration - use system Python to avoid root user issues
|
|
61
|
+
# Remove BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN to allow toolchain detection
|
|
62
|
+
build:ci --repo_env=PYTHON_BIN_PATH=/usr/bin/python3
|
|
63
|
+
build:ci --python_path=/usr/bin/python3
|
|
64
|
+
# Skip hermetic Python toolchain in CI
|
|
65
|
+
build:ci --@rules_python//python/config_settings:bootstrap_impl=system
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# BUILD.bazel file for mettagrid C++ extension module
|
|
2
|
+
load("@pybind11_bazel//:build_defs.bzl", "pybind_extension", "pybind_library")
|
|
3
|
+
|
|
4
|
+
# Basic compiler flags
|
|
5
|
+
COPTS = [
|
|
6
|
+
"-std=c++20",
|
|
7
|
+
"-fvisibility=hidden",
|
|
8
|
+
"-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION",
|
|
9
|
+
"-O3",
|
|
10
|
+
"-DNDEBUG",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
# Library for tests - use pybind_library without hidden visibility
|
|
14
|
+
pybind_library(
|
|
15
|
+
name = "mettagrid_lib",
|
|
16
|
+
srcs = glob([
|
|
17
|
+
"src/metta/mettagrid/*.cpp",
|
|
18
|
+
"src/metta/mettagrid/**/*.cpp",
|
|
19
|
+
]),
|
|
20
|
+
hdrs = glob([
|
|
21
|
+
"src/metta/mettagrid/*.hpp",
|
|
22
|
+
"src/metta/mettagrid/**/*.hpp",
|
|
23
|
+
]),
|
|
24
|
+
copts = [
|
|
25
|
+
"-std=c++20",
|
|
26
|
+
"-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION",
|
|
27
|
+
"-O3",
|
|
28
|
+
"-DNDEBUG",
|
|
29
|
+
], # Removed -fvisibility=hidden
|
|
30
|
+
includes = ["src/metta", "src/metta/mettagrid"],
|
|
31
|
+
visibility = ["//visibility:public"],
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# Python extension module
|
|
35
|
+
pybind_extension(
|
|
36
|
+
name = "mettagrid_c",
|
|
37
|
+
srcs = glob([
|
|
38
|
+
"src/metta/mettagrid/*.cpp",
|
|
39
|
+
"src/metta/mettagrid/**/*.cpp",
|
|
40
|
+
"src/metta/mettagrid/*.hpp",
|
|
41
|
+
"src/metta/mettagrid/**/*.hpp",
|
|
42
|
+
]),
|
|
43
|
+
copts = COPTS,
|
|
44
|
+
includes = ["src/metta/mettagrid"],
|
|
45
|
+
visibility = ["//visibility:public"],
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# Export the .clang-tidy config file for use by the linter
|
|
49
|
+
exports_files([".clang-tidy"])
|
|
50
|
+
|
|
51
|
+
# Export source files for test_mettagrid
|
|
52
|
+
exports_files(
|
|
53
|
+
glob([
|
|
54
|
+
"src/metta/mettagrid/*.cpp",
|
|
55
|
+
"src/metta/mettagrid/**/*.cpp",
|
|
56
|
+
]),
|
|
57
|
+
visibility = ["//visibility:public"],
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# MODULE.bazel for mettagrid - using Bzlmod (modern Bazel module system)
|
|
2
|
+
module(name = "mettagrid", version = "0.1.6")
|
|
3
|
+
|
|
4
|
+
# Basic Bazel dependencies
|
|
5
|
+
bazel_dep(name = "platforms", version = "1.0.0")
|
|
6
|
+
bazel_dep(name = "bazel_skylib", version = "1.8.1")
|
|
7
|
+
|
|
8
|
+
# C++ rules and toolchain
|
|
9
|
+
bazel_dep(name = "rules_cc", version = "0.2.0")
|
|
10
|
+
|
|
11
|
+
# Python toolchain - use latest compatible version
|
|
12
|
+
bazel_dep(name = "rules_python", version = "1.5.3")
|
|
13
|
+
|
|
14
|
+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
|
|
15
|
+
python.toolchain(
|
|
16
|
+
python_version = "3.11",
|
|
17
|
+
is_default = True,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# pybind11 for Python bindings
|
|
21
|
+
bazel_dep(name = "pybind11_bazel", version = "2.13.6")
|
|
22
|
+
|
|
23
|
+
# Google Test for testing
|
|
24
|
+
bazel_dep(name = "googletest", version = "1.17.0")
|
|
25
|
+
|
|
26
|
+
# Google Benchmark for benchmarking
|
|
27
|
+
bazel_dep(name = "google_benchmark", version = "1.9.4")
|
|
28
|
+
|
|
29
|
+
# Abseil (dependency of some Google libraries)
|
|
30
|
+
bazel_dep(name = "abseil-cpp", version = "20250814.0")
|
|
31
|
+
|
|
32
|
+
# Linting and formatting with rules_lint
|
|
33
|
+
bazel_dep(name = "aspect_bazel_lib", version = "2.21.1")
|
|
34
|
+
bazel_dep(name = "aspect_rules_lint", version = "1.6.0")
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mettagrid
|
|
3
|
+
Version: 0.2.0.1
|
|
4
|
+
Summary: A fast grid-based open-ended MARL environment
|
|
5
|
+
Author-email: David Bloomin <daveey@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://daveey.github.io
|
|
8
|
+
Project-URL: Repository, https://github.com/Metta-AI/mettagrid
|
|
9
|
+
Keywords: gridworld,minigrid,rl,reinforcement-learning,environment,gym
|
|
10
|
+
Requires-Python: ==3.11.7
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: boto3>=1.38.32
|
|
14
|
+
Requires-Dist: botocore>=1.38.29
|
|
15
|
+
Requires-Dist: google-api-python-client>=2.0.0
|
|
16
|
+
Requires-Dist: google-auth>=2.0.0
|
|
17
|
+
Requires-Dist: google-auth-oauthlib>=1.0.0
|
|
18
|
+
Requires-Dist: gymnasium==0.29.1
|
|
19
|
+
Requires-Dist: matplotlib>=3.10.3
|
|
20
|
+
Requires-Dist: numpy<2,>=1.26.4
|
|
21
|
+
Requires-Dist: omegaconf>=2.3.0
|
|
22
|
+
Requires-Dist: duckdb>=1.3.0
|
|
23
|
+
Requires-Dist: pettingzoo<1.25,>=1.24.1
|
|
24
|
+
Requires-Dist: pufferlib<3.1.0,>=3.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.11.5
|
|
26
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
27
|
+
Requires-Dist: scipy>=1.15.3
|
|
28
|
+
Requires-Dist: wandb>=0.19.11
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# MettaGrid Environment
|
|
32
|
+
|
|
33
|
+
MettaGrid is a multi-agent gridworld environment for studying the emergence of cooperation and social behaviors in
|
|
34
|
+
reinforcement learning agents. The environment features a variety of objects and actions that agents can interact with
|
|
35
|
+
to manage resources, engage in combat, share with others, and optimize their rewards.
|
|
36
|
+
|
|
37
|
+
## Overview
|
|
38
|
+
|
|
39
|
+
In MettaGrid, agents navigate a gridworld and interact with various objects to manage their energy, harvest resources,
|
|
40
|
+
engage in combat, and cooperate with other agents. The key dynamics include:
|
|
41
|
+
|
|
42
|
+
- **Energy Management**: Agents must efficiently manage their energy, which is required for all actions. They can
|
|
43
|
+
harvest resources and convert them to energy at charger stations.
|
|
44
|
+
- **Resource Gathering**: Agents can gather resources from generator objects scattered throughout the environment.
|
|
45
|
+
- **Cooperation and Sharing**: Agents have the ability to share resources with other agents and use energy to power the
|
|
46
|
+
heart altar, which provides rewards.
|
|
47
|
+
- **Combat**: Agents can attack other agents to temporarily freeze them and steal their resources. They can also use
|
|
48
|
+
shields to defend against attacks.
|
|
49
|
+
|
|
50
|
+
The environment is highly configurable, allowing for experimentation with different world layouts, object placements,
|
|
51
|
+
and agent capabilities.
|
|
52
|
+
|
|
53
|
+
## Objects
|
|
54
|
+
|
|
55
|
+
### Agent
|
|
56
|
+
|
|
57
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_tiny_galaxy/tg_sliced/tg_monsters/tg_monsters_astronaut_u1.png?raw=true" width="32"/>
|
|
58
|
+
|
|
59
|
+
The `Agent` object represents an individual agent in the environment. Agents can move, rotate, attack, and interact with
|
|
60
|
+
other objects. Each agent has energy, resources, and shield properties that govern its abilities and interactions.
|
|
61
|
+
|
|
62
|
+
### Altar
|
|
63
|
+
|
|
64
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_tiny_galaxy/tg_sliced/tg_items/tg_items_heart_full.png?raw=true" width="32"/>
|
|
65
|
+
|
|
66
|
+
The `Altar` object allows agents to spend energy to gain rewards. Agents can power the altar by using the `use` action
|
|
67
|
+
when near it. The altar has a cooldown period between uses.
|
|
68
|
+
|
|
69
|
+
- Using the heart altar costs `altar.use_cost energy`. So, no matter how much energy you have, you are always dumping
|
|
70
|
+
the same amount of energy in it and getting the same amount of reward.
|
|
71
|
+
- After the heart altar is used, it is unable to be used for altar.cooldown timesteps.
|
|
72
|
+
- A single use of the heart altar gives you a single unit of reward: if
|
|
73
|
+
`target._type_id == ObjectType.AltarT: self.env._rewards[actor_id] += 1`
|
|
74
|
+
|
|
75
|
+
### Converter
|
|
76
|
+
|
|
77
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_tiny_galaxy/tg_sliced/tg_items/tg_items_pda_A.png?raw=true" width="32"/>
|
|
78
|
+
|
|
79
|
+
The `Converter` object allows agents to convert their harvested resources into energy. Agents can use converters by
|
|
80
|
+
moving to them and taking the `use` action. Each use of a converter provides a specified amount of energy and has a
|
|
81
|
+
cooldown period.
|
|
82
|
+
|
|
83
|
+
- Using the converter does not cost any energy.
|
|
84
|
+
- Using the converter outputs `converter.energy_output.r1` energy
|
|
85
|
+
- see `this.output_energy = cfg[b"energy_output.r1"]` in the Converter cppclass
|
|
86
|
+
- Using the converter increments resource 2 by one and decrements resource 1 by 1
|
|
87
|
+
- There is currently no use for `converter.energy_output.r2` and `converter.energy_output.r3`
|
|
88
|
+
- After the converter is used, it is unable to be used for `converter.cooldown` timesteps
|
|
89
|
+
|
|
90
|
+
### Generator
|
|
91
|
+
|
|
92
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_fantasy/ore-0.png?raw=true" width="32"/>
|
|
93
|
+
|
|
94
|
+
The `Generator` object produces resources that agents can harvest. Agents can gather resources from generators by moving
|
|
95
|
+
to them and taking the `use` action. Generators have a specified capacity and replenish resources over time.
|
|
96
|
+
|
|
97
|
+
- Using the generator once gives one resource 1
|
|
98
|
+
- After the generator is used, it is unable to be used for `generator.cooldown` timesteps
|
|
99
|
+
|
|
100
|
+
### Wall
|
|
101
|
+
|
|
102
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_fantasy/wall2-0.png?raw=true" width="32"/>
|
|
103
|
+
|
|
104
|
+
The `Wall` object acts as an impassable barrier in the environment, restricting agent movement.
|
|
105
|
+
|
|
106
|
+
### Cooldown
|
|
107
|
+
|
|
108
|
+
The `cooldown` property determines how long before objects can be used again.
|
|
109
|
+
|
|
110
|
+
## Actions
|
|
111
|
+
|
|
112
|
+
### Move / Rotate
|
|
113
|
+
|
|
114
|
+
The `move` action allows agents to move to an adjacent cell in the gridworld. The action has two modes: moving forward
|
|
115
|
+
and moving backward relative to the agent's current orientation.
|
|
116
|
+
|
|
117
|
+
The `rotate` action enables agents to change their orientation within the gridworld. Agents can rotate to face in four
|
|
118
|
+
directions: down, left, right, and up.
|
|
119
|
+
|
|
120
|
+
### Attack
|
|
121
|
+
|
|
122
|
+
The `attack` action allows agents to attack other agents or objects within their attack range. Successful attacks freeze
|
|
123
|
+
the target for `freeze_duration` timesteps and allow the attacker to steal resources. Further, the attacked agent's
|
|
124
|
+
energy is set to `0`. Attacks have a cost and inflict a damage value. The agent selects from one of nine coordinates
|
|
125
|
+
within its attack range.
|
|
126
|
+
|
|
127
|
+
### Shield (Toggle)
|
|
128
|
+
|
|
129
|
+
The `shield` action turns on a shield. When the shield is active, the agent is protected from attacks by other agents.
|
|
130
|
+
The shield consumes energy defined by `upkeep.shield` while active. Attack damage is subtracted from the agent's energy,
|
|
131
|
+
rather than freezing the agent.
|
|
132
|
+
|
|
133
|
+
### Transfer
|
|
134
|
+
|
|
135
|
+
The `transfer` action enables agents to share resources with other agents. Agents can choose to transfer specific
|
|
136
|
+
resources to another agent in an adjacent cell. It is currently not implemented.
|
|
137
|
+
|
|
138
|
+
### Use
|
|
139
|
+
|
|
140
|
+
The `use` action allows agents to interact with objects such as altars, converters, and generators. The specific effects
|
|
141
|
+
of the `use` action depend on the target object and can include converting resources to energy, powering the altar for
|
|
142
|
+
rewards, or harvesting resources from generators.
|
|
143
|
+
|
|
144
|
+
### Swap
|
|
145
|
+
|
|
146
|
+
The `swap` action allows agents to swap positions with other agents. It is currently not implemented.
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
The MettaGrid environment is highly configurable through the use of YAML configuration files. These files specify the
|
|
151
|
+
layout of the gridworld, the placement of objects, and various properties of the objects and agents.
|
|
152
|
+
|
|
153
|
+
**Current settings:**
|
|
154
|
+
|
|
155
|
+
1. Ore - Base resource obtained from mines. Mines produce one ore when used. No resource requirements for use. -
|
|
156
|
+
Reward value: 0.005 per unit (max 2) - Used to create batteries and lasers
|
|
157
|
+
2. Battery - Intermediate resource created from ore at a generator. Generator turns one ore into one battery. -
|
|
158
|
+
Reward value: 0.01 per unit (max 2) - Used to create hearts and lasers
|
|
159
|
+
3. Heart / heart altar - High value reward, requires 3 batteries to be converted into a heart at a heart altar.
|
|
160
|
+
4. Laser - Weapon resource created from ore and batteries. Requires 1 ore and 2 batteries. Created at the lasery.
|
|
161
|
+
|
|
162
|
+
- Consumed on use. When hitting an unarmored agent: freezes them and steals their whole inventory. When hitting an
|
|
163
|
+
armoured agent, destroys their armor. **Inventory System**
|
|
164
|
+
- Agents have limited inventory space (default max: 50 items)
|
|
165
|
+
- Resources provide rewards just by being in inventory (up to their max reward value)
|
|
166
|
+
- Resources can be stolen through attacks Objects Various buildings: Mine, Generator, Armory, Lasery, Altar, Lab,
|
|
167
|
+
Factory, Temple.
|
|
168
|
+
- HP — hitpoints, the number of times something can be hit before destruction.
|
|
169
|
+
- Cooldown between uses (varies by building)
|
|
170
|
+
- Can be damaged and destroyed by attacks
|
|
171
|
+
|
|
172
|
+
## Environment Architecture
|
|
173
|
+
|
|
174
|
+
MettaGrid uses a modular architecture designed primarily for the Softmax Studio ML project, with lightweight adapters to
|
|
175
|
+
maintain compatibility with external RL frameworks:
|
|
176
|
+
|
|
177
|
+
### Primary Training Environment
|
|
178
|
+
|
|
179
|
+
**`MettaGridEnv`** - The main environment actively developed for Softmax Studio training systems
|
|
180
|
+
|
|
181
|
+
- Full-featured environment with comprehensive stats collection, replay recording, and curriculum support
|
|
182
|
+
- Inherits from `MettaGridCore` for C++ environment implementation
|
|
183
|
+
- **Exclusively used** by `metta.rl.trainer` and `metta.sim.simulation`
|
|
184
|
+
- Continuously developed and optimized for Softmax Studio use cases
|
|
185
|
+
- Backward compatible with existing training code
|
|
186
|
+
|
|
187
|
+
### Core Infrastructure
|
|
188
|
+
|
|
189
|
+
**`MettaGridCore`** - Low-level C++ environment wrapper
|
|
190
|
+
|
|
191
|
+
- Foundation that provides the core game mechanics and performance
|
|
192
|
+
- **Not used directly** for training - serves as implementation detail for `MettaGridEnv`
|
|
193
|
+
- Provides the base functionality that external adapters wrap
|
|
194
|
+
|
|
195
|
+
### External Framework Compatibility Adapters
|
|
196
|
+
|
|
197
|
+
Lightweight wrappers around `MettaGridCore` to maintain compatibility with other training systems:
|
|
198
|
+
|
|
199
|
+
- **`MettaGridGymEnv`** - Gymnasium compatibility for research workflows
|
|
200
|
+
- **`MettaGridPettingZooEnv`** - PettingZoo compatibility for multi-agent research
|
|
201
|
+
- **`MettaGridPufferEnv`** - PufferLib compatibility for high-performance external training
|
|
202
|
+
|
|
203
|
+
**Important**: These adapters are **only used with their respective training systems**, not with the Metta trainer.
|
|
204
|
+
|
|
205
|
+
### Design Philosophy
|
|
206
|
+
|
|
207
|
+
- **Primary Focus**: `MettaGridEnv` receives active development and new features for Softmax Studio
|
|
208
|
+
- **Compatibility Maintenance**: External adapters ensure other frameworks continue working as the core evolves
|
|
209
|
+
- **Testing for Compatibility**: Demos verify external frameworks remain functional during core development
|
|
210
|
+
- **Clear Separation**: Each environment type serves its specific training system - no mixing between systems
|
|
211
|
+
|
|
212
|
+
### Compatibility Testing Demos
|
|
213
|
+
|
|
214
|
+
These demos ensure external framework adapters remain functional as the core environment evolves:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Verify PettingZoo compatibility
|
|
218
|
+
python -m mettagrid.demos.demo_train_pettingzoo
|
|
219
|
+
|
|
220
|
+
# Verify PufferLib compatibility
|
|
221
|
+
python -m mettagrid.demos.demo_train_puffer
|
|
222
|
+
|
|
223
|
+
# Verify Gymnasium compatibility
|
|
224
|
+
python -m mettagrid.demos.demo_train_gym
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
The demos serve as regression tests to catch compatibility issues during core development, ensuring external users can
|
|
228
|
+
continue using their preferred frameworks.
|
|
229
|
+
|
|
230
|
+
## Building and testing
|
|
231
|
+
|
|
232
|
+
For local development, refer to the top-level [README.md](../README.md) in this repository.
|
|
233
|
+
|
|
234
|
+
### Bazel
|
|
235
|
+
|
|
236
|
+
By default, `uv sync` will run the Bazel build automatically via the custom build backend. If you need to run C++ tests
|
|
237
|
+
and benchmarks directly, you'll need to invoke `bazel` directly.
|
|
238
|
+
|
|
239
|
+
Build C++ tests and benchmarks in debug mode:
|
|
240
|
+
|
|
241
|
+
```sh
|
|
242
|
+
# Build with debug flags
|
|
243
|
+
bazel build --config=dbg //:mettagrid_c
|
|
244
|
+
# Run all tests
|
|
245
|
+
bazel test //...
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
For benchmarks you might prefer to use the optimized build:
|
|
249
|
+
|
|
250
|
+
```sh
|
|
251
|
+
# Build with optimizations
|
|
252
|
+
bazel build --config=opt //:mettagrid_c
|
|
253
|
+
|
|
254
|
+
# Run benchmarks
|
|
255
|
+
./build-release/benchmarks/grid_object_benchmark
|
|
256
|
+
```
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# MettaGrid Environment
|
|
2
|
+
|
|
3
|
+
MettaGrid is a multi-agent gridworld environment for studying the emergence of cooperation and social behaviors in
|
|
4
|
+
reinforcement learning agents. The environment features a variety of objects and actions that agents can interact with
|
|
5
|
+
to manage resources, engage in combat, share with others, and optimize their rewards.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
In MettaGrid, agents navigate a gridworld and interact with various objects to manage their energy, harvest resources,
|
|
10
|
+
engage in combat, and cooperate with other agents. The key dynamics include:
|
|
11
|
+
|
|
12
|
+
- **Energy Management**: Agents must efficiently manage their energy, which is required for all actions. They can
|
|
13
|
+
harvest resources and convert them to energy at charger stations.
|
|
14
|
+
- **Resource Gathering**: Agents can gather resources from generator objects scattered throughout the environment.
|
|
15
|
+
- **Cooperation and Sharing**: Agents have the ability to share resources with other agents and use energy to power the
|
|
16
|
+
heart altar, which provides rewards.
|
|
17
|
+
- **Combat**: Agents can attack other agents to temporarily freeze them and steal their resources. They can also use
|
|
18
|
+
shields to defend against attacks.
|
|
19
|
+
|
|
20
|
+
The environment is highly configurable, allowing for experimentation with different world layouts, object placements,
|
|
21
|
+
and agent capabilities.
|
|
22
|
+
|
|
23
|
+
## Objects
|
|
24
|
+
|
|
25
|
+
### Agent
|
|
26
|
+
|
|
27
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_tiny_galaxy/tg_sliced/tg_monsters/tg_monsters_astronaut_u1.png?raw=true" width="32"/>
|
|
28
|
+
|
|
29
|
+
The `Agent` object represents an individual agent in the environment. Agents can move, rotate, attack, and interact with
|
|
30
|
+
other objects. Each agent has energy, resources, and shield properties that govern its abilities and interactions.
|
|
31
|
+
|
|
32
|
+
### Altar
|
|
33
|
+
|
|
34
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_tiny_galaxy/tg_sliced/tg_items/tg_items_heart_full.png?raw=true" width="32"/>
|
|
35
|
+
|
|
36
|
+
The `Altar` object allows agents to spend energy to gain rewards. Agents can power the altar by using the `use` action
|
|
37
|
+
when near it. The altar has a cooldown period between uses.
|
|
38
|
+
|
|
39
|
+
- Using the heart altar costs `altar.use_cost energy`. So, no matter how much energy you have, you are always dumping
|
|
40
|
+
the same amount of energy in it and getting the same amount of reward.
|
|
41
|
+
- After the heart altar is used, it is unable to be used for altar.cooldown timesteps.
|
|
42
|
+
- A single use of the heart altar gives you a single unit of reward: if
|
|
43
|
+
`target._type_id == ObjectType.AltarT: self.env._rewards[actor_id] += 1`
|
|
44
|
+
|
|
45
|
+
### Converter
|
|
46
|
+
|
|
47
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_tiny_galaxy/tg_sliced/tg_items/tg_items_pda_A.png?raw=true" width="32"/>
|
|
48
|
+
|
|
49
|
+
The `Converter` object allows agents to convert their harvested resources into energy. Agents can use converters by
|
|
50
|
+
moving to them and taking the `use` action. Each use of a converter provides a specified amount of energy and has a
|
|
51
|
+
cooldown period.
|
|
52
|
+
|
|
53
|
+
- Using the converter does not cost any energy.
|
|
54
|
+
- Using the converter outputs `converter.energy_output.r1` energy
|
|
55
|
+
- see `this.output_energy = cfg[b"energy_output.r1"]` in the Converter cppclass
|
|
56
|
+
- Using the converter increments resource 2 by one and decrements resource 1 by 1
|
|
57
|
+
- There is currently no use for `converter.energy_output.r2` and `converter.energy_output.r3`
|
|
58
|
+
- After the converter is used, it is unable to be used for `converter.cooldown` timesteps
|
|
59
|
+
|
|
60
|
+
### Generator
|
|
61
|
+
|
|
62
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_fantasy/ore-0.png?raw=true" width="32"/>
|
|
63
|
+
|
|
64
|
+
The `Generator` object produces resources that agents can harvest. Agents can gather resources from generators by moving
|
|
65
|
+
to them and taking the `use` action. Generators have a specified capacity and replenish resources over time.
|
|
66
|
+
|
|
67
|
+
- Using the generator once gives one resource 1
|
|
68
|
+
- After the generator is used, it is unable to be used for `generator.cooldown` timesteps
|
|
69
|
+
|
|
70
|
+
### Wall
|
|
71
|
+
|
|
72
|
+
<img src="https://github.com/daveey/Griddly/blob/develop/resources/images/oryx/oryx_fantasy/wall2-0.png?raw=true" width="32"/>
|
|
73
|
+
|
|
74
|
+
The `Wall` object acts as an impassable barrier in the environment, restricting agent movement.
|
|
75
|
+
|
|
76
|
+
### Cooldown
|
|
77
|
+
|
|
78
|
+
The `cooldown` property determines how long before objects can be used again.
|
|
79
|
+
|
|
80
|
+
## Actions
|
|
81
|
+
|
|
82
|
+
### Move / Rotate
|
|
83
|
+
|
|
84
|
+
The `move` action allows agents to move to an adjacent cell in the gridworld. The action has two modes: moving forward
|
|
85
|
+
and moving backward relative to the agent's current orientation.
|
|
86
|
+
|
|
87
|
+
The `rotate` action enables agents to change their orientation within the gridworld. Agents can rotate to face in four
|
|
88
|
+
directions: down, left, right, and up.
|
|
89
|
+
|
|
90
|
+
### Attack
|
|
91
|
+
|
|
92
|
+
The `attack` action allows agents to attack other agents or objects within their attack range. Successful attacks freeze
|
|
93
|
+
the target for `freeze_duration` timesteps and allow the attacker to steal resources. Further, the attacked agent's
|
|
94
|
+
energy is set to `0`. Attacks have a cost and inflict a damage value. The agent selects from one of nine coordinates
|
|
95
|
+
within its attack range.
|
|
96
|
+
|
|
97
|
+
### Shield (Toggle)
|
|
98
|
+
|
|
99
|
+
The `shield` action turns on a shield. When the shield is active, the agent is protected from attacks by other agents.
|
|
100
|
+
The shield consumes energy defined by `upkeep.shield` while active. Attack damage is subtracted from the agent's energy,
|
|
101
|
+
rather than freezing the agent.
|
|
102
|
+
|
|
103
|
+
### Transfer
|
|
104
|
+
|
|
105
|
+
The `transfer` action enables agents to share resources with other agents. Agents can choose to transfer specific
|
|
106
|
+
resources to another agent in an adjacent cell. It is currently not implemented.
|
|
107
|
+
|
|
108
|
+
### Use
|
|
109
|
+
|
|
110
|
+
The `use` action allows agents to interact with objects such as altars, converters, and generators. The specific effects
|
|
111
|
+
of the `use` action depend on the target object and can include converting resources to energy, powering the altar for
|
|
112
|
+
rewards, or harvesting resources from generators.
|
|
113
|
+
|
|
114
|
+
### Swap
|
|
115
|
+
|
|
116
|
+
The `swap` action allows agents to swap positions with other agents. It is currently not implemented.
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
The MettaGrid environment is highly configurable through the use of YAML configuration files. These files specify the
|
|
121
|
+
layout of the gridworld, the placement of objects, and various properties of the objects and agents.
|
|
122
|
+
|
|
123
|
+
**Current settings:**
|
|
124
|
+
|
|
125
|
+
1. Ore - Base resource obtained from mines. Mines produce one ore when used. No resource requirements for use. -
|
|
126
|
+
Reward value: 0.005 per unit (max 2) - Used to create batteries and lasers
|
|
127
|
+
2. Battery - Intermediate resource created from ore at a generator. Generator turns one ore into one battery. -
|
|
128
|
+
Reward value: 0.01 per unit (max 2) - Used to create hearts and lasers
|
|
129
|
+
3. Heart / heart altar - High value reward, requires 3 batteries to be converted into a heart at a heart altar.
|
|
130
|
+
4. Laser - Weapon resource created from ore and batteries. Requires 1 ore and 2 batteries. Created at the lasery.
|
|
131
|
+
|
|
132
|
+
- Consumed on use. When hitting an unarmored agent: freezes them and steals their whole inventory. When hitting an
|
|
133
|
+
armoured agent, destroys their armor. **Inventory System**
|
|
134
|
+
- Agents have limited inventory space (default max: 50 items)
|
|
135
|
+
- Resources provide rewards just by being in inventory (up to their max reward value)
|
|
136
|
+
- Resources can be stolen through attacks Objects Various buildings: Mine, Generator, Armory, Lasery, Altar, Lab,
|
|
137
|
+
Factory, Temple.
|
|
138
|
+
- HP — hitpoints, the number of times something can be hit before destruction.
|
|
139
|
+
- Cooldown between uses (varies by building)
|
|
140
|
+
- Can be damaged and destroyed by attacks
|
|
141
|
+
|
|
142
|
+
## Environment Architecture
|
|
143
|
+
|
|
144
|
+
MettaGrid uses a modular architecture designed primarily for the Softmax Studio ML project, with lightweight adapters to
|
|
145
|
+
maintain compatibility with external RL frameworks:
|
|
146
|
+
|
|
147
|
+
### Primary Training Environment
|
|
148
|
+
|
|
149
|
+
**`MettaGridEnv`** - The main environment actively developed for Softmax Studio training systems
|
|
150
|
+
|
|
151
|
+
- Full-featured environment with comprehensive stats collection, replay recording, and curriculum support
|
|
152
|
+
- Inherits from `MettaGridCore` for C++ environment implementation
|
|
153
|
+
- **Exclusively used** by `metta.rl.trainer` and `metta.sim.simulation`
|
|
154
|
+
- Continuously developed and optimized for Softmax Studio use cases
|
|
155
|
+
- Backward compatible with existing training code
|
|
156
|
+
|
|
157
|
+
### Core Infrastructure
|
|
158
|
+
|
|
159
|
+
**`MettaGridCore`** - Low-level C++ environment wrapper
|
|
160
|
+
|
|
161
|
+
- Foundation that provides the core game mechanics and performance
|
|
162
|
+
- **Not used directly** for training - serves as implementation detail for `MettaGridEnv`
|
|
163
|
+
- Provides the base functionality that external adapters wrap
|
|
164
|
+
|
|
165
|
+
### External Framework Compatibility Adapters
|
|
166
|
+
|
|
167
|
+
Lightweight wrappers around `MettaGridCore` to maintain compatibility with other training systems:
|
|
168
|
+
|
|
169
|
+
- **`MettaGridGymEnv`** - Gymnasium compatibility for research workflows
|
|
170
|
+
- **`MettaGridPettingZooEnv`** - PettingZoo compatibility for multi-agent research
|
|
171
|
+
- **`MettaGridPufferEnv`** - PufferLib compatibility for high-performance external training
|
|
172
|
+
|
|
173
|
+
**Important**: These adapters are **only used with their respective training systems**, not with the Metta trainer.
|
|
174
|
+
|
|
175
|
+
### Design Philosophy
|
|
176
|
+
|
|
177
|
+
- **Primary Focus**: `MettaGridEnv` receives active development and new features for Softmax Studio
|
|
178
|
+
- **Compatibility Maintenance**: External adapters ensure other frameworks continue working as the core evolves
|
|
179
|
+
- **Testing for Compatibility**: Demos verify external frameworks remain functional during core development
|
|
180
|
+
- **Clear Separation**: Each environment type serves its specific training system - no mixing between systems
|
|
181
|
+
|
|
182
|
+
### Compatibility Testing Demos
|
|
183
|
+
|
|
184
|
+
These demos ensure external framework adapters remain functional as the core environment evolves:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Verify PettingZoo compatibility
|
|
188
|
+
python -m mettagrid.demos.demo_train_pettingzoo
|
|
189
|
+
|
|
190
|
+
# Verify PufferLib compatibility
|
|
191
|
+
python -m mettagrid.demos.demo_train_puffer
|
|
192
|
+
|
|
193
|
+
# Verify Gymnasium compatibility
|
|
194
|
+
python -m mettagrid.demos.demo_train_gym
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The demos serve as regression tests to catch compatibility issues during core development, ensuring external users can
|
|
198
|
+
continue using their preferred frameworks.
|
|
199
|
+
|
|
200
|
+
## Building and testing
|
|
201
|
+
|
|
202
|
+
For local development, refer to the top-level [README.md](../README.md) in this repository.
|
|
203
|
+
|
|
204
|
+
### Bazel
|
|
205
|
+
|
|
206
|
+
By default, `uv sync` will run the Bazel build automatically via the custom build backend. If you need to run C++ tests
|
|
207
|
+
and benchmarks directly, you'll need to invoke `bazel` directly.
|
|
208
|
+
|
|
209
|
+
Build C++ tests and benchmarks in debug mode:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
# Build with debug flags
|
|
213
|
+
bazel build --config=dbg //:mettagrid_c
|
|
214
|
+
# Run all tests
|
|
215
|
+
bazel test //...
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
For benchmarks you might prefer to use the optimized build:
|
|
219
|
+
|
|
220
|
+
```sh
|
|
221
|
+
# Build with optimizations
|
|
222
|
+
bazel build --config=opt //:mettagrid_c
|
|
223
|
+
|
|
224
|
+
# Run benchmarks
|
|
225
|
+
./build-release/benchmarks/grid_object_benchmark
|
|
226
|
+
```
|