mettagrid 0.0.2__py3-none-any.whl → 0.0.3__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.
- README.md +75 -2
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/gift.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/noop.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/shield.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/use.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects.cpython-311-darwin.so +0 -0
- build/mettagrid/actions/actions.cpp +706 -593
- build/mettagrid/actions/attack.cpp +1589 -1185
- build/mettagrid/actions/gift.cpp +550 -515
- build/mettagrid/actions/move.cpp +739 -638
- build/mettagrid/actions/noop.cpp +32376 -0
- build/mettagrid/actions/rotate.cpp +550 -545
- build/mettagrid/actions/shield.cpp +594 -531
- build/mettagrid/actions/use.cpp +654 -589
- build/mettagrid/mettagrid.cpp +4011 -1495
- build/mettagrid/objects.cpp +1449 -824
- mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- mettagrid/actions/actions.pxd +2 -2
- mettagrid/actions/actions.pyx +19 -5
- mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- mettagrid/actions/attack.pyx +12 -3
- mettagrid/actions/gift.cpython-311-darwin.so +0 -0
- mettagrid/actions/gift.pyx +4 -1
- mettagrid/actions/move.cpython-311-darwin.so +0 -0
- mettagrid/actions/move.pyx +16 -6
- mettagrid/actions/noop.cpython-311-darwin.so +0 -0
- mettagrid/actions/noop.pxd +4 -0
- mettagrid/actions/noop.pyx +25 -0
- mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- mettagrid/actions/rotate.pyx +5 -3
- mettagrid/actions/shield.cpython-311-darwin.so +0 -0
- mettagrid/actions/shield.pyx +10 -3
- mettagrid/actions/use.cpython-311-darwin.so +0 -0
- mettagrid/actions/use.pyx +9 -4
- mettagrid/mettagrid.pyx +35 -1
- mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- mettagrid/mettagrid_env.py +44 -72
- mettagrid/objects.cpython-311-darwin.so +0 -0
- mettagrid/objects.pxd +25 -12
- mettagrid/objects.pyx +19 -21
- mettagrid/renderer/assets/agent.png +0 -0
- mettagrid/renderer/assets/altar.png +0 -0
- mettagrid/renderer/assets/arial.ttf +0 -0
- mettagrid/renderer/assets/converter.png +0 -0
- mettagrid/renderer/assets/generator.png +0 -0
- mettagrid/renderer/json_renderer.py +0 -0
- mettagrid/renderer/raylib_renderer.py +410 -0
- mettagrid/renderer/render_code_example.py +56 -0
- mettagrid-0.0.3.dist-info/METADATA +96 -0
- mettagrid-0.0.3.dist-info/RECORD +81 -0
- setup.py +1 -0
- test_perf.py +2 -2
- mettagrid/actions.cpython-311-darwin.so +0 -0
- mettagrid/renderer/raylib_client.py +0 -180
- mettagrid-0.0.2.dist-info/METADATA +0 -23
- mettagrid-0.0.2.dist-info/RECORD +0 -70
- /mettagrid/renderer/assets/{tiny_galaxy_items.png → items.png} +0 -0
- /mettagrid/renderer/assets/{tiny_galaxy_monsters.png → monsters.png} +0 -0
- /mettagrid/renderer/assets/{wall1-0.png → wall.png} +0 -0
- {mettagrid-0.0.2.dist-info → mettagrid-0.0.3.dist-info}/LICENSE +0 -0
- {mettagrid-0.0.2.dist-info → mettagrid-0.0.3.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
2
|
+
README.md,sha256=464FGzZirXWaYNrQe7SlyD2gmOHmJktRnNJ9Tro2Nek,4680
|
|
3
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so,sha256=ZSQxWXe3SlkA_QYOeBCzvrj4IivyWvDwjYEE_Q2osAE,218336
|
|
4
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so,sha256=LdsKoO8hdXrmtYXrV3ax_rnVljTQg5HEUM_bvH9EHB8,217696
|
|
5
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/gift.cpython-311-darwin.so,sha256=xwvpz-lM9z6_GIxrphR2TNXNEM10Y4kxw5-ZRppfPBs,217064
|
|
6
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so,sha256=zLNYBMHescRTGANyqueyI7FoihpFRG2sSuVwCg6OIAg,217064
|
|
7
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/noop.cpython-311-darwin.so,sha256=YRWcWJ4s_841bPxvmKhb8C_Gx7xHTWY9GK_lnHe6KPA,217064
|
|
8
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so,sha256=bXV286F_B1oGEl1qBB7x-uMaciZ4en_p97Gh5cjat7Y,217152
|
|
9
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/shield.cpython-311-darwin.so,sha256=sB9KwHQANcqozw6RFhzTz1MHsrs869TVa4SL5dPtcHY,217152
|
|
10
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/use.cpython-311-darwin.so,sha256=OLTTen8vVonsh7Z55SlmNt6wGQp-h6tbOd_NdVxvz88,217224
|
|
11
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so,sha256=qKkjft1j7TYrux1XKr29j17gtdsUJavqTy4V3ZqKyuk,277600
|
|
12
|
+
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects.cpython-311-darwin.so,sha256=RFWTbLIn5QNIjxCVG6Z7jBYNbsecsXEOsyuxXnHGNk4,257136
|
|
13
|
+
build/mettagrid/actions/actions.cpp,sha256=o1Y5QWJNQdSVbUU5JYzEIm_QrY608gyjKzE2PwYwBuw,1277005
|
|
14
|
+
build/mettagrid/actions/attack.cpp,sha256=6VNZJxBwxj7B2_5hhaAX3FZWMbv0Up-EhCkVgbcoFb8,1274448
|
|
15
|
+
build/mettagrid/actions/gift.cpp,sha256=jWvdEHgX5NVLXjtRg4t6-qJBvuloT3jzUqXVD7tisY4,1226668
|
|
16
|
+
build/mettagrid/actions/move.cpp,sha256=xzlDbe5TMSNULthlE4H2oQXr7uVD1-NEtrwiNimnrB8,1233507
|
|
17
|
+
build/mettagrid/actions/noop.cpp,sha256=WDCzGjmi7VnBFO6Z4aix6YQYBiq8eDX_BCFoqvUTNcc,1226691
|
|
18
|
+
build/mettagrid/actions/rotate.cpp,sha256=O6QSCSn5POQxYP-73d0f7iWj6vkeKJIK0-FbBYYtmY0,1227751
|
|
19
|
+
build/mettagrid/actions/shield.cpp,sha256=kT7DNr4LqUNhNC5UnNvIOYhXhmG8EW6prVMhAyNIM84,1228950
|
|
20
|
+
build/mettagrid/actions/use.cpp,sha256=KRV2sE00e4m-rPOgfhfe8hkZijL-WG18TiJ_o16tK8I,1247620
|
|
21
|
+
build/mettagrid/mettagrid.cpp,sha256=fBtYYDaJbdZp6uKO_gNWxdAIA2etMiKAIZT87cKc1Wg,1464344
|
|
22
|
+
build/mettagrid/objects.cpp,sha256=H0FZERGFMfDZuTbU43Y_YvcpgAqhMJRBihreXBNC0jI,1395699
|
|
23
|
+
mettagrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
mettagrid/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
+
mettagrid/actions/actions.cpython-311-darwin.so,sha256=ZSQxWXe3SlkA_QYOeBCzvrj4IivyWvDwjYEE_Q2osAE,218336
|
|
26
|
+
mettagrid/actions/actions.pxd,sha256=R7F4wL8T8EMcmsNgUvUE_YHhSCQoC2RwzDDzmT7tSXE,765
|
|
27
|
+
mettagrid/actions/actions.pyx,sha256=EUOWA7UZ78e0IwRyvIWVqxyVLp1C6RHAuB-w2SGgDzU,2182
|
|
28
|
+
mettagrid/actions/attack.cpython-311-darwin.so,sha256=LdsKoO8hdXrmtYXrV3ax_rnVljTQg5HEUM_bvH9EHB8,217696
|
|
29
|
+
mettagrid/actions/attack.pxd,sha256=2VQADMYLj7-EhzVoK1_4w_rJFTnj7l7-5fMHseBqGP8,135
|
|
30
|
+
mettagrid/actions/attack.pyx,sha256=dFbQkpyemfKAAVf7eMuMTAz9EmrJo4CTKHJU29iy8vw,3090
|
|
31
|
+
mettagrid/actions/gift.cpython-311-darwin.so,sha256=xwvpz-lM9z6_GIxrphR2TNXNEM10Y4kxw5-ZRppfPBs,217064
|
|
32
|
+
mettagrid/actions/gift.pxd,sha256=f4Y8mQtBhBlD0z_auZQrRs3StYO54TV2fUw5WSDFnG4,105
|
|
33
|
+
mettagrid/actions/gift.pyx,sha256=7s-nQPpuMxBvG5rrcReB9eho7_3FxebBUEhb26tXpRM,804
|
|
34
|
+
mettagrid/actions/move.cpython-311-darwin.so,sha256=zLNYBMHescRTGANyqueyI7FoihpFRG2sSuVwCg6OIAg,217064
|
|
35
|
+
mettagrid/actions/move.pxd,sha256=GN_4ieZrI6RoY92igO4PmayRIS9O-zQl1oeOfImneeE,105
|
|
36
|
+
mettagrid/actions/move.pyx,sha256=Ucq05-gUooU4zia6a5C_4qrlirbPQYxTAVmfkuhZbV0,1595
|
|
37
|
+
mettagrid/actions/noop.cpython-311-darwin.so,sha256=YRWcWJ4s_841bPxvmKhb8C_Gx7xHTWY9GK_lnHe6KPA,217064
|
|
38
|
+
mettagrid/actions/noop.pxd,sha256=KiEvVu-SsvTa3WZ6guNCWvFf12tJEb3GnjzmmpZJB-o,105
|
|
39
|
+
mettagrid/actions/noop.pyx,sha256=6uy8lsnMl7k_sNwJfA10eXcYy9BcGOBeVZ2KSLSv9z0,798
|
|
40
|
+
mettagrid/actions/rotate.cpython-311-darwin.so,sha256=bXV286F_B1oGEl1qBB7x-uMaciZ4en_p97Gh5cjat7Y,217152
|
|
41
|
+
mettagrid/actions/rotate.pxd,sha256=z2D17nFORP9lw2eZLZB96KE18sy_d914x0pe854O7MU,107
|
|
42
|
+
mettagrid/actions/rotate.pyx,sha256=nHwovy43-n-LTq5lTm3a2Aa7LQmo5rMHwwoSc5JeWHs,894
|
|
43
|
+
mettagrid/actions/shield.cpython-311-darwin.so,sha256=sB9KwHQANcqozw6RFhzTz1MHsrs869TVa4SL5dPtcHY,217152
|
|
44
|
+
mettagrid/actions/shield.pxd,sha256=9lf9UOWml8koteofGGTTUyLR20dhE8YTFtZZlMAI7hA,107
|
|
45
|
+
mettagrid/actions/shield.pyx,sha256=YX_oLCrP2rF_nQZSslNbAwq8pGLK1BPkWDmiUg6IAyU,949
|
|
46
|
+
mettagrid/actions/use.cpython-311-darwin.so,sha256=OLTTen8vVonsh7Z55SlmNt6wGQp-h6tbOd_NdVxvz88,217224
|
|
47
|
+
mettagrid/actions/use.pxd,sha256=bFx5IlWzX8mZemv1A5tAg6h97Vt6ev9SSJXewqK33CQ,104
|
|
48
|
+
mettagrid/actions/use.pyx,sha256=LbQKaEkNChFE9Y8KDXKfRygWGRLb49xQL4x-19TEyEw,2786
|
|
49
|
+
mettagrid/config/game_builder.py,sha256=f9fS38WaXepiwL9qlWqMBI4aMRjKN11P18Q6mFl2yAM,3360
|
|
50
|
+
mettagrid/config/sample_config.py,sha256=BbRqT5hrPY5VKGIC7bVbEjwd_G59defru573KxvCtEA,822
|
|
51
|
+
mettagrid/mettagrid.pyx,sha256=kobCT-gjBhRjyzy0Lq9ss7M3wCA4JdIw0TFZw2ep8jM,3971
|
|
52
|
+
mettagrid/mettagrid_c.cpython-311-darwin.so,sha256=qKkjft1j7TYrux1XKr29j17gtdsUJavqTy4V3ZqKyuk,277600
|
|
53
|
+
mettagrid/mettagrid_env.py,sha256=hJ2lRkGl2dztLAQlZqgW9xOBYLrz1_KflIvT-BZ6gn8,5192
|
|
54
|
+
mettagrid/objects.cpython-311-darwin.so,sha256=RFWTbLIn5QNIjxCVG6Z7jBYNbsecsXEOsyuxXnHGNk4,257136
|
|
55
|
+
mettagrid/objects.pxd,sha256=wt53DlwO2TqjJrdjcp9JA8b_-LZRzpU40jlSVrUDI7w,6464
|
|
56
|
+
mettagrid/objects.pyx,sha256=ZjaanEUZ9vfc9i5uVrRj-HqYWQkRO2o_j4LW4lZAhgg,2319
|
|
57
|
+
mettagrid/renderer/assets/agent.png,sha256=-Lt-cyIxZMDX_I7vG6w20MInah8CEorE5WGN0rmVP_k,427
|
|
58
|
+
mettagrid/renderer/assets/altar.png,sha256=Nhn_6IEmPuq9t0rDaCvyPCvpdzX3vZB-X1EoMSpvNvc,425
|
|
59
|
+
mettagrid/renderer/assets/arial.ttf,sha256=NcDzVZ2NtWnjbDEJW4pg1EFkPZX1kTneQOI_ragZuDM,275572
|
|
60
|
+
mettagrid/renderer/assets/converter.png,sha256=HT--nGPU05Wdk1JKNP1rmBYttPbOkWKOI6J-VDs3jwk,384
|
|
61
|
+
mettagrid/renderer/assets/generator.png,sha256=_vHlTbCy_NZYzYnkLxdRwF-zp1D2H4Md3yI8-ZX8QGA,376
|
|
62
|
+
mettagrid/renderer/assets/items.png,sha256=zRfEkwGZ-BnzzCqyse6wyWIGTcteVt_eJVRkTlS4XBA,24116
|
|
63
|
+
mettagrid/renderer/assets/monsters.png,sha256=Aw2Ktj-1BtugmjMI9Wnyb4xxAxq6rzD0mgk9IBdkCyM,32763
|
|
64
|
+
mettagrid/renderer/assets/ore-0.png,sha256=_vHlTbCy_NZYzYnkLxdRwF-zp1D2H4Md3yI8-ZX8QGA,376
|
|
65
|
+
mettagrid/renderer/assets/ore-1.png,sha256=HT--nGPU05Wdk1JKNP1rmBYttPbOkWKOI6J-VDs3jwk,384
|
|
66
|
+
mettagrid/renderer/assets/ore-2.png,sha256=Nhn_6IEmPuq9t0rDaCvyPCvpdzX3vZB-X1EoMSpvNvc,425
|
|
67
|
+
mettagrid/renderer/assets/ore-3.png,sha256=-Lt-cyIxZMDX_I7vG6w20MInah8CEorE5WGN0rmVP_k,427
|
|
68
|
+
mettagrid/renderer/assets/ore-4.png,sha256=vySYN37jPtFeTXXmpyJCCalkR0K2RfutIHp8CXgImjg,410
|
|
69
|
+
mettagrid/renderer/assets/ore-5.png,sha256=KSvduI7HnGD4ky3Cq27FwbwHe9pO4-WY1yFoh7mAzCM,410
|
|
70
|
+
mettagrid/renderer/assets/ore-6.png,sha256=6GWdbQJ4P5WLsTz8rWpGtXbc6P7JJ-bO7ze3qHQ4bH0,418
|
|
71
|
+
mettagrid/renderer/assets/puffer_chars.png,sha256=6FaTd_z6JkMldwlYAW94BajgaaGz30ScWBTmUggxu78,71193
|
|
72
|
+
mettagrid/renderer/assets/wall.png,sha256=MONt_xbscHfODf9T9hiy8poHX_TkMXbk_dC6T0ora7I,1155
|
|
73
|
+
mettagrid/renderer/json_renderer.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
|
+
mettagrid/renderer/raylib_renderer.py,sha256=MaCT7R_9IG8zPcQkWjdO0-2QFFguTwt60o6iwanx79M,14977
|
|
75
|
+
mettagrid/renderer/render_code_example.py,sha256=eQJyOK9j-hBiIfQnmyPRSw1n9sDZ2dIQNGzV3m_j_WY,2350
|
|
76
|
+
setup.py,sha256=KBVLqjWKFh_5AiG8GNbn7oXBSGA2cCXQqc_nTStNnPY,2527
|
|
77
|
+
test_perf.py,sha256=GiLNt7eyM3NNyXdx2DZ9CI0LrwRAS_cKU8aV3bt7yiA,3221
|
|
78
|
+
mettagrid-0.0.3.dist-info/LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
79
|
+
mettagrid-0.0.3.dist-info/METADATA,sha256=8pFkU72N4n3B6qUXA-Hq4YwXrIy8OSihPOrYQvzoBoc,5437
|
|
80
|
+
mettagrid-0.0.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
81
|
+
mettagrid-0.0.3.dist-info/RECORD,,
|
setup.py
CHANGED
|
@@ -22,6 +22,7 @@ ext_modules = [
|
|
|
22
22
|
build_ext(["mettagrid/actions/attack.pyx"]),
|
|
23
23
|
build_ext(["mettagrid/actions/gift.pyx"]),
|
|
24
24
|
build_ext(["mettagrid/actions/move.pyx"]),
|
|
25
|
+
build_ext(["mettagrid/actions/noop.pyx"]),
|
|
25
26
|
build_ext(["mettagrid/actions/rotate.pyx"]),
|
|
26
27
|
build_ext(["mettagrid/actions/shield.pyx"]),
|
|
27
28
|
build_ext(["mettagrid/actions/use.pyx"]),
|
test_perf.py
CHANGED
|
@@ -53,10 +53,10 @@ def main(cfg):
|
|
|
53
53
|
|
|
54
54
|
def print_stats(stats):
|
|
55
55
|
# Extract game_stats
|
|
56
|
-
game_stats = stats["
|
|
56
|
+
game_stats = stats["game"]
|
|
57
57
|
|
|
58
58
|
# Extract agent_stats
|
|
59
|
-
agent_stats = stats["
|
|
59
|
+
agent_stats = stats["agent"]
|
|
60
60
|
|
|
61
61
|
# Calculate total, average, min, and max for each agent stat
|
|
62
62
|
total_agent_stats = {}
|
|
Binary file
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
from pdb import set_trace as T
|
|
2
|
-
import numpy as np
|
|
3
|
-
import os
|
|
4
|
-
|
|
5
|
-
import pettingzoo
|
|
6
|
-
import gymnasium
|
|
7
|
-
|
|
8
|
-
import pufferlib
|
|
9
|
-
from pufferlib.environments.ocean import render
|
|
10
|
-
|
|
11
|
-
class MettaRaylibClient:
|
|
12
|
-
def __init__(self, width, height, tile_size=32):
|
|
13
|
-
self.width = width
|
|
14
|
-
self.height = height
|
|
15
|
-
self.tile_size = tile_size
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
sprite_sheet_path = os.path.join(
|
|
19
|
-
*self.__module__.split('.')[:-1], './puffer_chars.png')
|
|
20
|
-
self.asset_map = {
|
|
21
|
-
1: (0, 0, 128, 128),
|
|
22
|
-
3: (128, 0, 128, 128),
|
|
23
|
-
4: (256, 0, 128, 128),
|
|
24
|
-
# 5: (384, 0, 128, 128),
|
|
25
|
-
5: (512, 0, 128, 128), #star
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
from raylib import rl, colors
|
|
29
|
-
rl.InitWindow(width*tile_size, height*tile_size,
|
|
30
|
-
"PufferLib Ray Grid".encode())
|
|
31
|
-
rl.SetTargetFPS(10)
|
|
32
|
-
self.puffer = rl.LoadTexture(sprite_sheet_path.encode())
|
|
33
|
-
self.rl = rl
|
|
34
|
-
self.colors = colors
|
|
35
|
-
|
|
36
|
-
import pyray as ray
|
|
37
|
-
camera = ray.Camera2D()
|
|
38
|
-
camera.target = ray.Vector2(0.0, 0.0)
|
|
39
|
-
camera.rotation = 0.0
|
|
40
|
-
camera.zoom = 1.0
|
|
41
|
-
self.camera = camera
|
|
42
|
-
|
|
43
|
-
from cffi import FFI
|
|
44
|
-
self.ffi = FFI()
|
|
45
|
-
|
|
46
|
-
def _cdata_to_numpy(self):
|
|
47
|
-
image = self.rl.LoadImageFromScreen()
|
|
48
|
-
width, height, channels = image.width, image.height, 4
|
|
49
|
-
cdata = self.ffi.buffer(image.data, width*height*channels)
|
|
50
|
-
return np.frombuffer(cdata, dtype=np.uint8
|
|
51
|
-
).reshape((height, width, channels))[:, :, :3]
|
|
52
|
-
|
|
53
|
-
def render(self, grid):
|
|
54
|
-
rl = self.rl
|
|
55
|
-
colors = self.colors
|
|
56
|
-
ay, ax = None, None
|
|
57
|
-
|
|
58
|
-
ts = self.tile_size
|
|
59
|
-
|
|
60
|
-
pos = rl.GetMousePosition()
|
|
61
|
-
raw_mouse_x = pos.x
|
|
62
|
-
raw_mouse_y = pos.y
|
|
63
|
-
mouse_x = int(raw_mouse_x // ts)
|
|
64
|
-
mouse_y = int(raw_mouse_y // ts)
|
|
65
|
-
ay = int(np.clip((pos.y - ts*self.height//2) / 50, -3, 3)) + 3
|
|
66
|
-
ax = int(np.clip((pos.x - ts*self.width//2) / 50, -3, 3)) + 3
|
|
67
|
-
|
|
68
|
-
if rl.IsKeyDown(rl.KEY_ESCAPE):
|
|
69
|
-
exit(0)
|
|
70
|
-
|
|
71
|
-
action_id = 0
|
|
72
|
-
action_arg = 0
|
|
73
|
-
|
|
74
|
-
if rl.IsKeyDown(rl.KEY_E):
|
|
75
|
-
action_id = 0
|
|
76
|
-
action_arg = 0
|
|
77
|
-
elif rl.IsKeyDown(rl.KEY_Q):
|
|
78
|
-
action_id = 0
|
|
79
|
-
action_arg = 1
|
|
80
|
-
|
|
81
|
-
elif rl.IsKeyDown(rl.KEY_W):
|
|
82
|
-
action_id = 1
|
|
83
|
-
action_arg = 0
|
|
84
|
-
elif rl.IsKeyDown(rl.KEY_S):
|
|
85
|
-
action_id = 1
|
|
86
|
-
action_arg = 1
|
|
87
|
-
elif rl.IsKeyDown(rl.KEY_A):
|
|
88
|
-
action_id = 1
|
|
89
|
-
action_arg = 2
|
|
90
|
-
elif rl.IsKeyDown(rl.KEY_R):
|
|
91
|
-
action_id = 1
|
|
92
|
-
action_arg = 3
|
|
93
|
-
|
|
94
|
-
# if rl.IsKeyDown(rl.KEY_LEFT_SHIFT):
|
|
95
|
-
# target_heros = 2
|
|
96
|
-
|
|
97
|
-
action = (action_id, action_arg)
|
|
98
|
-
|
|
99
|
-
rl.BeginDrawing()
|
|
100
|
-
rl.BeginMode2D(self.camera)
|
|
101
|
-
rl.ClearBackground([6, 24, 24, 255])
|
|
102
|
-
for y in range(self.height):
|
|
103
|
-
for x in range(self.width):
|
|
104
|
-
tile = grid[y, x]
|
|
105
|
-
tx = x*ts
|
|
106
|
-
ty = y*ts
|
|
107
|
-
if tile == 0:
|
|
108
|
-
continue
|
|
109
|
-
elif tile == 2:
|
|
110
|
-
# Wall
|
|
111
|
-
rl.DrawRectangle(x*ts, y*ts, ts, ts, [0, 0, 0, 255])
|
|
112
|
-
continue
|
|
113
|
-
else:
|
|
114
|
-
# Player
|
|
115
|
-
source_rect = self.asset_map[tile]
|
|
116
|
-
dest_rect = (tx, ty, ts, ts)
|
|
117
|
-
rl.DrawTexturePro(self.puffer, source_rect, dest_rect,
|
|
118
|
-
(0, 0), 0, colors.WHITE)
|
|
119
|
-
|
|
120
|
-
# Draw circle at mouse x, y
|
|
121
|
-
rl.DrawCircle(ts*mouse_x + ts//2, ts*mouse_y + ts//8, ts//8, [255, 0, 0, 255])
|
|
122
|
-
|
|
123
|
-
rl.EndMode2D()
|
|
124
|
-
|
|
125
|
-
# Draw HUD
|
|
126
|
-
# player = entities[0]
|
|
127
|
-
# hud_y = self.height*ts - 2*ts
|
|
128
|
-
# draw_bars(rl, player, 2*ts, hud_y, 10*ts, 24, draw_text=True)
|
|
129
|
-
|
|
130
|
-
# off_color = [255, 255, 255, 255]
|
|
131
|
-
# on_color = [0, 255, 0, 255]
|
|
132
|
-
|
|
133
|
-
# q_color = on_color if skill_q else off_color
|
|
134
|
-
# w_color = on_color if skill_w else off_color
|
|
135
|
-
# e_color = on_color if skill_e else off_color
|
|
136
|
-
|
|
137
|
-
# q_cd = player.q_timer
|
|
138
|
-
# w_cd = player.w_timer
|
|
139
|
-
# e_cd = player.e_timer
|
|
140
|
-
|
|
141
|
-
# rl.DrawText(f'Q: {q_cd}'.encode(), 13*ts, hud_y - 20, 40, q_color)
|
|
142
|
-
# rl.DrawText(f'W: {w_cd}'.encode(), 17*ts, hud_y - 20, 40, w_color)
|
|
143
|
-
# rl.DrawText(f'E: {e_cd}'.encode(), 21*ts, hud_y - 20, 40, e_color)
|
|
144
|
-
# rl.DrawText(f'Stun: {player.stun_timer}'.encode(), 25*ts, hud_y - 20, 20, e_color)
|
|
145
|
-
# rl.DrawText(f'Move: {player.move_timer}'.encode(), 25*ts, hud_y, 20, e_color)
|
|
146
|
-
|
|
147
|
-
rl.EndDrawing()
|
|
148
|
-
return self._cdata_to_numpy(), action
|
|
149
|
-
|
|
150
|
-
def draw_bars(rl, entity, x, y, width, height=4, draw_text=False):
|
|
151
|
-
health_bar = entity.health / entity.max_health
|
|
152
|
-
mana_bar = entity.mana / entity.max_mana
|
|
153
|
-
if entity.max_health == 0:
|
|
154
|
-
health_bar = 2
|
|
155
|
-
if entity.max_mana == 0:
|
|
156
|
-
mana_bar = 2
|
|
157
|
-
rl.DrawRectangle(x, y, width, height, [255, 0, 0, 255])
|
|
158
|
-
rl.DrawRectangle(x, y, int(width*health_bar), height, [0, 255, 0, 255])
|
|
159
|
-
|
|
160
|
-
if entity.entity_type == 0:
|
|
161
|
-
rl.DrawRectangle(x, y - height - 2, width, height, [255, 0, 0, 255])
|
|
162
|
-
rl.DrawRectangle(x, y - height - 2, int(width*mana_bar), height, [0, 255, 255, 255])
|
|
163
|
-
|
|
164
|
-
if draw_text:
|
|
165
|
-
health = int(entity.health)
|
|
166
|
-
mana = int(entity.mana)
|
|
167
|
-
max_health = int(entity.max_health)
|
|
168
|
-
max_mana = int(entity.max_mana)
|
|
169
|
-
rl.DrawText(f'Health: {health}/{max_health}'.encode(),
|
|
170
|
-
x+8, y+2, 20, [255, 255, 255, 255])
|
|
171
|
-
rl.DrawText(f'Mana: {mana}/{max_mana}'.encode(),
|
|
172
|
-
x+8, y+2 - height - 2, 20, [255, 255, 255, 255])
|
|
173
|
-
|
|
174
|
-
#rl.DrawRectangle(x, y - 2*height - 4, int(width*mana_bar), height, [255, 255, 0, 255])
|
|
175
|
-
rl.DrawText(f'Experience: {entity.xp}'.encode(),
|
|
176
|
-
x+8, y - 2*height - 4, 20, [255, 255, 255, 255])
|
|
177
|
-
|
|
178
|
-
elif entity.entity_type == 0:
|
|
179
|
-
rl.DrawText(f'Level: {entity.level}'.encode(),
|
|
180
|
-
x+4, y -2*height - 12, 12, [255, 255, 255, 255])
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: mettagrid
|
|
3
|
-
Version: 0.0.2
|
|
4
|
-
Summary: A fast grid-based open-ended MARL environment
|
|
5
|
-
Home-page: https://daveey.github.io
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: puffergrid,gridworld,minigrid,rl,reinforcement-learning,environment,gym
|
|
8
|
-
Author: David Bloomin
|
|
9
|
-
Author-email: daveey@gmail.com
|
|
10
|
-
Requires-Python: >=3.10,<4.0
|
|
11
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Requires-Dist: cython (>=3.0.11,<4.0.0)
|
|
17
|
-
Requires-Dist: numpy (>=1.21.0,<2.0.0)
|
|
18
|
-
Project-URL: Repository, https://github.com/Metta-AI/mettagrid
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
|
|
21
|
-
# mettagrid
|
|
22
|
-
A fast grid-based open-ended MARL environment
|
|
23
|
-
|
mettagrid-0.0.2.dist-info/RECORD
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
2
|
-
README.md,sha256=IZPe0D8-9bjNS7FkmKHiGWgR5UIvLsAwIknisM63vLY,58
|
|
3
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so,sha256=1lmcaoqbEbeeaIpfXPwhn31QvxBfzbNB0tUTrBrQ56M,218304
|
|
4
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so,sha256=1JG53b5UX4Dl4Jofa0z5_iYgjiHbq-jO1jkjoIwutAQ,217296
|
|
5
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/gift.cpython-311-darwin.so,sha256=aHYeQ_F-VZgn5BHpYRdzqfep5-t-TUai3LVqi4I5qDk,216872
|
|
6
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so,sha256=lGL4fng87SmWEg2haer2svO8HGra4rsNx3luPHCMogQ,216872
|
|
7
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so,sha256=l9fT5qxqFzU83vBa2b0KvN3vKACZsFG6aCX1GP8PTC4,216944
|
|
8
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/shield.cpython-311-darwin.so,sha256=xWcwjFA8RfVTROGcChwr_Uyj_pZIGoPAGmt8zEYNr0Q,216944
|
|
9
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/use.cpython-311-darwin.so,sha256=_He274Fdg3yOIOJ9qfVmHyiaS4ZysFaWzxT2Z9c3wTs,217032
|
|
10
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so,sha256=9GqMtAnIlwjrpQ4aG5y0Apw6VvnNKy17gll94u9AlQw,257024
|
|
11
|
-
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects.cpython-311-darwin.so,sha256=5RgBmm284S3qjzcgINFr4ZdPtEn5UvvrI_ByEXj8USE,238144
|
|
12
|
-
build/mettagrid/actions/actions.cpp,sha256=6PiIfE-eBgZyQP-A9BXKQdzBXtKlRNGrePgBQQNqTDY,1271012
|
|
13
|
-
build/mettagrid/actions/attack.cpp,sha256=A9St0cO7fM-yP-wwfWS-T7ZiqiM7a2LJcVaDdGVwe-A,1248679
|
|
14
|
-
build/mettagrid/actions/gift.cpp,sha256=-0a_xZnO4I3-US0tjFlSRzyvPbPB9F-rhDTSGmVQ5KY,1224492
|
|
15
|
-
build/mettagrid/actions/move.cpp,sha256=FOctJgCVEp4KbRI0oHhOOdVLeYHZA6na0h8GOiye_-E,1228772
|
|
16
|
-
build/mettagrid/actions/rotate.cpp,sha256=0KlTUxyiGOTxtZsnK3uhOxAYvQlkB-6XGP70XC8GnG0,1226329
|
|
17
|
-
build/mettagrid/actions/shield.cpp,sha256=6fY0F-XBnn1PtT7dJ_rlQWelBPwflQ3HvKiTe98LDsM,1225924
|
|
18
|
-
build/mettagrid/actions/use.cpp,sha256=5tSHyx0KFxMF-tcsGVAVd56ykoLNOwDTeYLYHA2AVeA,1244286
|
|
19
|
-
build/mettagrid/mettagrid.cpp,sha256=dZRZkwwEB19HpEzwhttaZZukk5P5Ha5CRAA8BknlsFg,1356096
|
|
20
|
-
build/mettagrid/objects.cpp,sha256=xtKS2bnBsonMgz0Rrj_fA-L7MtiWCu_Qbh-CpE6e4pA,1363437
|
|
21
|
-
mettagrid/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
mettagrid/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
mettagrid/actions/actions.cpython-311-darwin.so,sha256=1lmcaoqbEbeeaIpfXPwhn31QvxBfzbNB0tUTrBrQ56M,218304
|
|
24
|
-
mettagrid/actions/actions.pxd,sha256=Zd9CpuIEWytp1z-KCcuAUoev7dgR16kgea92p8yodps,765
|
|
25
|
-
mettagrid/actions/actions.pyx,sha256=wRg4-3lANoUAIWo6cIAB33AOiPNFg8-EfdCwn-riGP0,1622
|
|
26
|
-
mettagrid/actions/attack.cpython-311-darwin.so,sha256=1JG53b5UX4Dl4Jofa0z5_iYgjiHbq-jO1jkjoIwutAQ,217296
|
|
27
|
-
mettagrid/actions/attack.pxd,sha256=2VQADMYLj7-EhzVoK1_4w_rJFTnj7l7-5fMHseBqGP8,135
|
|
28
|
-
mettagrid/actions/attack.pyx,sha256=dnYTMqNEDa5QX6Btz2shPzW3DBB6Y91Uehr_IbfNQP8,2561
|
|
29
|
-
mettagrid/actions/gift.cpython-311-darwin.so,sha256=aHYeQ_F-VZgn5BHpYRdzqfep5-t-TUai3LVqi4I5qDk,216872
|
|
30
|
-
mettagrid/actions/gift.pxd,sha256=f4Y8mQtBhBlD0z_auZQrRs3StYO54TV2fUw5WSDFnG4,105
|
|
31
|
-
mettagrid/actions/gift.pyx,sha256=YXRCP3dYATIWVYDroRjVip1wGyi4ZQx1f9Jfr9k6uZQ,748
|
|
32
|
-
mettagrid/actions/move.cpython-311-darwin.so,sha256=lGL4fng87SmWEg2haer2svO8HGra4rsNx3luPHCMogQ,216872
|
|
33
|
-
mettagrid/actions/move.pxd,sha256=GN_4ieZrI6RoY92igO4PmayRIS9O-zQl1oeOfImneeE,105
|
|
34
|
-
mettagrid/actions/move.pyx,sha256=8onrsk0jplTOe6OykYw0OdQM9aWzffVyv3pw1Wb2HCg,1206
|
|
35
|
-
mettagrid/actions/rotate.cpython-311-darwin.so,sha256=l9fT5qxqFzU83vBa2b0KvN3vKACZsFG6aCX1GP8PTC4,216944
|
|
36
|
-
mettagrid/actions/rotate.pxd,sha256=z2D17nFORP9lw2eZLZB96KE18sy_d914x0pe854O7MU,107
|
|
37
|
-
mettagrid/actions/rotate.pyx,sha256=fUaWcLnw0s_utXGfmPWg-SzUDw27ma_tsUso23fpayQ,891
|
|
38
|
-
mettagrid/actions/shield.cpython-311-darwin.so,sha256=xWcwjFA8RfVTROGcChwr_Uyj_pZIGoPAGmt8zEYNr0Q,216944
|
|
39
|
-
mettagrid/actions/shield.pxd,sha256=9lf9UOWml8koteofGGTTUyLR20dhE8YTFtZZlMAI7hA,107
|
|
40
|
-
mettagrid/actions/shield.pyx,sha256=D4h-vsbVNbG87n5eiIYs2BsXIKQIWgZe3geKEd7j-ZA,834
|
|
41
|
-
mettagrid/actions/use.cpython-311-darwin.so,sha256=_He274Fdg3yOIOJ9qfVmHyiaS4ZysFaWzxT2Z9c3wTs,217032
|
|
42
|
-
mettagrid/actions/use.pxd,sha256=bFx5IlWzX8mZemv1A5tAg6h97Vt6ev9SSJXewqK33CQ,104
|
|
43
|
-
mettagrid/actions/use.pyx,sha256=tHuNx4JdTf3-50_0S_A4Walgo2PZnRaEBuy9CTYA5YY,2623
|
|
44
|
-
mettagrid/actions.cpython-311-darwin.so,sha256=sXn_0Envaw15TqmGSfSvLE8TKEDI0sUrNbDbfIJU2KQ,238368
|
|
45
|
-
mettagrid/config/game_builder.py,sha256=f9fS38WaXepiwL9qlWqMBI4aMRjKN11P18Q6mFl2yAM,3360
|
|
46
|
-
mettagrid/config/sample_config.py,sha256=BbRqT5hrPY5VKGIC7bVbEjwd_G59defru573KxvCtEA,822
|
|
47
|
-
mettagrid/mettagrid.pyx,sha256=jgzXf6cO7IjHsDn2d_0Za9rgn_SngQNGmOwk7FzMyYE,2667
|
|
48
|
-
mettagrid/mettagrid_c.cpython-311-darwin.so,sha256=9GqMtAnIlwjrpQ4aG5y0Apw6VvnNKy17gll94u9AlQw,257024
|
|
49
|
-
mettagrid/mettagrid_env.py,sha256=NrP8ZuX75JDO-UMa_BOdNKvdz-lqPogEbICRO30Ru4Q,6677
|
|
50
|
-
mettagrid/objects.cpython-311-darwin.so,sha256=5RgBmm284S3qjzcgINFr4ZdPtEn5UvvrI_ByEXj8USE,238144
|
|
51
|
-
mettagrid/objects.pxd,sha256=_71dLM1W9K5WtwMZj35XpzzjDWZkMCiZep75EOAoXbc,5842
|
|
52
|
-
mettagrid/objects.pyx,sha256=CTfc4CQ_NeXkO0LjH_OY8mC4FAluyThKfzn0wzmIHvQ,2197
|
|
53
|
-
mettagrid/renderer/assets/ore-0.png,sha256=_vHlTbCy_NZYzYnkLxdRwF-zp1D2H4Md3yI8-ZX8QGA,376
|
|
54
|
-
mettagrid/renderer/assets/ore-1.png,sha256=HT--nGPU05Wdk1JKNP1rmBYttPbOkWKOI6J-VDs3jwk,384
|
|
55
|
-
mettagrid/renderer/assets/ore-2.png,sha256=Nhn_6IEmPuq9t0rDaCvyPCvpdzX3vZB-X1EoMSpvNvc,425
|
|
56
|
-
mettagrid/renderer/assets/ore-3.png,sha256=-Lt-cyIxZMDX_I7vG6w20MInah8CEorE5WGN0rmVP_k,427
|
|
57
|
-
mettagrid/renderer/assets/ore-4.png,sha256=vySYN37jPtFeTXXmpyJCCalkR0K2RfutIHp8CXgImjg,410
|
|
58
|
-
mettagrid/renderer/assets/ore-5.png,sha256=KSvduI7HnGD4ky3Cq27FwbwHe9pO4-WY1yFoh7mAzCM,410
|
|
59
|
-
mettagrid/renderer/assets/ore-6.png,sha256=6GWdbQJ4P5WLsTz8rWpGtXbc6P7JJ-bO7ze3qHQ4bH0,418
|
|
60
|
-
mettagrid/renderer/assets/puffer_chars.png,sha256=6FaTd_z6JkMldwlYAW94BajgaaGz30ScWBTmUggxu78,71193
|
|
61
|
-
mettagrid/renderer/assets/tiny_galaxy_items.png,sha256=zRfEkwGZ-BnzzCqyse6wyWIGTcteVt_eJVRkTlS4XBA,24116
|
|
62
|
-
mettagrid/renderer/assets/tiny_galaxy_monsters.png,sha256=Aw2Ktj-1BtugmjMI9Wnyb4xxAxq6rzD0mgk9IBdkCyM,32763
|
|
63
|
-
mettagrid/renderer/assets/wall1-0.png,sha256=MONt_xbscHfODf9T9hiy8poHX_TkMXbk_dC6T0ora7I,1155
|
|
64
|
-
mettagrid/renderer/raylib_client.py,sha256=LVZVwHUFlFzDBty2FSWHe5RmR0FPFm-MqA49yTgx81M,6011
|
|
65
|
-
setup.py,sha256=rbuphBIxMYONF0eHq3OaidEoWt86BhX2-XUOm4YWJjE,2480
|
|
66
|
-
test_perf.py,sha256=b4NA2hEpHkxb6s9ijD2mhHtjMYBI0eFYBC5H-R3AqhQ,3233
|
|
67
|
-
mettagrid-0.0.2.dist-info/LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
|
|
68
|
-
mettagrid-0.0.2.dist-info/METADATA,sha256=dorBaDiXY9jHggX9GXjCOKxJu0Gz_jLzNerMqZD8GFo,815
|
|
69
|
-
mettagrid-0.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
70
|
-
mettagrid-0.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|