Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Long Awaited Multi-Agent Update #32

Draft
wants to merge 67 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
a0ec173
initialized craftax marl
BaselOmari Mar 13, 2024
c5b954f
initialized marl craftax
BaselOmari Mar 13, 2024
e92f338
feat: modified world generation to initially support multi-agent setups
BaselOmari Apr 3, 2024
1dec85e
feat: modified symbolic renderer to support multi-agents
BaselOmari Apr 3, 2024
5d37c5d
feat: modified changing floors to support multi-agent setup
BaselOmari Apr 3, 2024
f62cf2a
feat: modified crafting to suit multi-agent setting
BaselOmari Apr 3, 2024
88aa37d
Merge branch 'main' into bassel/multi-agent
BaselOmari Apr 3, 2024
5fa2850
fix: removed unneeded rng split
BaselOmari Apr 4, 2024
3097954
feat: modified pixel renderer for multi-agent setting
BaselOmari Apr 15, 2024
c935d87
fix: moved marl to main directory
BaselOmari Apr 19, 2024
2c0d605
Merge branch 'MichaelTMatthews:main' into bassel/multi-agent
BaselOmari Apr 19, 2024
5071fae
feat: adjust world gen for marl setting
BaselOmari Jul 16, 2024
5f2b377
fix: adjust symbolic rendering for multiple players
BaselOmari Jul 16, 2024
2b535da
Merge branch 'MichaelTMatthews:main' into bassel/multi-agent
BaselOmari Jul 16, 2024
7e748d5
Merge branch 'bassel/multi-agent' of github.com:BaselOmari/Craftax in…
BaselOmari Jul 16, 2024
39dcf79
del: removed duplicate src files after pull
BaselOmari Jul 16, 2024
a719e7e
fix: removed unneeded floor change vmap
BaselOmari Jul 16, 2024
45729a6
fix: remove unneeded action selection vmap
BaselOmari Jul 16, 2024
6e1e7c3
fix: revert rendering changes
BaselOmari Jul 16, 2024
48603d7
feat: adjust crafting for marl implementation
BaselOmari Jul 16, 2024
e29cb1e
fix: change action to plural
BaselOmari Sep 12, 2024
5149ff8
fix: reroute environment bases and add autoreset
BaselOmari Sep 12, 2024
446cf5a
fix: move player
BaselOmari Oct 1, 2024
8c68d8d
fix: marl crafting
BaselOmari Oct 1, 2024
d416839
fix: black formatting
BaselOmari Oct 21, 2024
dcc471d
add potion drinking
BaselOmari Oct 21, 2024
8bdf413
fix: made book reading marl
BaselOmari Oct 22, 2024
1f83650
fix: enchant made marl
BaselOmari Oct 22, 2024
852e2a6
fix: bossed up marl
BaselOmari Oct 22, 2024
ed1702c
fix: marl'd up plant updates
BaselOmari Oct 22, 2024
28c173e
fix: marlybone style inventory achievements
BaselOmari Oct 22, 2024
1720e09
fix: update marl player intrinsics
BaselOmari Oct 24, 2024
d1758a1
marly projectiles
BaselOmari Oct 25, 2024
16f756e
marl spell casting
BaselOmari Oct 25, 2024
bee63ab
multi agent block placement
BaselOmari Nov 8, 2024
0367a6e
base add player alive
BaselOmari Nov 10, 2024
3dd2577
marl mob spawning
BaselOmari Nov 10, 2024
a3820c5
fix: replace jax.lax.select with jnp.where where applicable
BaselOmari Nov 10, 2024
bd2c4d1
fix: add projectile owners
BaselOmari Nov 11, 2024
3476826
marly mob updates + additional fixes
BaselOmari Nov 11, 2024
8422549
fix: scale mob count with player count
BaselOmari Nov 11, 2024
2354a42
modified reward for multi agent
BaselOmari Nov 11, 2024
b7d2eeb
fixed is near block
BaselOmari Nov 14, 2024
9041b0a
item->[0] fix + crafting achievement fix
BaselOmari Nov 14, 2024
b0451e9
change count of players to 4
BaselOmari Nov 14, 2024
8233133
fix moving into player
BaselOmari Nov 14, 2024
ae97bcc
fix ranged move attack bug
BaselOmari Nov 14, 2024
e9fa0db
multi-agent action doing
BaselOmari Nov 16, 2024
9565aa1
fix: pass in static_params
BaselOmari Nov 16, 2024
55de1f9
update player intrinsics only if alive
BaselOmari Nov 16, 2024
7fd1028
add player revive
BaselOmari Nov 16, 2024
0b9eee9
fix: achievement update based on player health
BaselOmari Nov 16, 2024
4946e8c
Add representation for players (dead or alive) in symbolic view
BaselOmari Nov 16, 2024
b89ad18
add dead player assets
BaselOmari Nov 16, 2024
313e3e6
fix: show player on screen even if dead
BaselOmari Nov 16, 2024
9bac129
stop players just revived from gaining health reward
BaselOmari Nov 17, 2024
f921341
minor terminal fix
BaselOmari Nov 17, 2024
ed5c1ec
add temporary simulator
BaselOmari Nov 17, 2024
3bb9f9b
[temp] player textures
BaselOmari Dec 9, 2024
5a95b5b
add other player textures
BaselOmari Dec 10, 2024
27a29ed
fix local_position in symbolic render
BaselOmari Dec 11, 2024
bc37a28
adding teammate direction in symbolic rendering
BaselOmari Dec 11, 2024
78e4d10
add teammate directions in pixel rendering
BaselOmari Dec 11, 2024
243ff47
render one hot encoding for multiple teammates in symbolic rendering
BaselOmari Dec 11, 2024
acd68df
add base direction pointer assets
BaselOmari Dec 12, 2024
92fb3d4
add player specific chests
BaselOmari Dec 12, 2024
953b69d
fix: remove "monsters killed to clear level" req on moving up
BaselOmari Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions craftax/craftax/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
pathlib.Path(__file__).parent.resolve(), "assets", "texture_cache.pbz2"
)


# ENUMS
class BlockType(Enum):
INVALID = 0
Expand Down
5 changes: 4 additions & 1 deletion craftax/craftax/world_gen/world_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,10 @@ def _add_path(carry, path_index):

rng, _rng = jax.random.split(rng)
included_rooms_mask = jnp.zeros(num_rooms, dtype=bool).at[-1].set(True)
(padded_map, _, _), _, = jax.lax.scan(
(
(padded_map, _, _),
_,
) = jax.lax.scan(
_add_path, (padded_map, included_rooms_mask, _rng), jnp.arange(0, num_rooms)
)

Expand Down
5 changes: 2 additions & 3 deletions craftax/craftax_classic/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
pathlib.Path(__file__).parent.resolve(), "assets", "texture_cache_classic.pbz2"
)


# ENUMS
class BlockType(Enum):
INVALID = 0
Expand Down Expand Up @@ -390,9 +391,7 @@ def apply_alpha(texture):
np.linspace(-1, 1, OBS_DIM[0] * block_pixel_size),
np.linspace(-1, 1, OBS_DIM[1] * block_pixel_size),
)
night_noise_intensity_texture = (
1 - np.exp(-0.5 * (xs**2 + ys**2) / (0.5**2)).T
)
night_noise_intensity_texture = 1 - np.exp(-0.5 * (xs**2 + ys**2) / (0.5**2)).T

night_noise_intensity_texture = jnp.expand_dims(
night_noise_intensity_texture, axis=-1
Expand Down
23 changes: 23 additions & 0 deletions craftax/craftax_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
CraftaxClassicSymbolicEnv,
CraftaxClassicSymbolicEnvNoAutoReset,
)
from craftax.craftax_marl.envs.craftax_symbolic_env import (
CraftaxMARLSymbolicEnv,
CraftaxMARLSymbolicEnvNoAutoReset,
)
from craftax.craftax_marl.envs.craftax_pixels_env import (
CraftaxMARLPixelsEnv,
CraftaxMARLPixelsEnvNoAutoReset,
)


def make_craftax_env_from_name(name: str, auto_reset: bool):
Expand All @@ -32,6 +40,17 @@ def make_craftax_env_from_name(name: str, auto_reset: bool):
or name == "Craftax-Classic-Pixels-AutoReset-v1"
):
return CraftaxClassicPixelsEnv()

if (
name == "Craftax-MARL-Symbolic-v1"
or name == "Craftax-MARL-Symbolic-AutoReset-v1"
):
return CraftaxMARLSymbolicEnv()
elif (
name == "Craftax-MARL-Pixels-v1"
or name == "Craftax-MARL-Pixels-AutoReset-v1"
):
return CraftaxMARLPixelsEnv()
else:
if name == "Craftax-Symbolic-v1":
return CraftaxSymbolicEnvNoAutoReset()
Expand All @@ -41,6 +60,10 @@ def make_craftax_env_from_name(name: str, auto_reset: bool):
return CraftaxClassicSymbolicEnvNoAutoReset()
elif name == "Craftax-Classic-Pixels-v1":
return CraftaxClassicPixelsEnvNoAutoReset()
elif name == "Craftax-MARL-Symbolic-v1":
return CraftaxMARLSymbolicEnvNoAutoReset()
elif name == "Craftax-MARL-Pixels-v1":
return CraftaxMARLPixelsEnvNoAutoReset()

raise ValueError(f"Unknown craftax environment: {name}")

Expand Down
Empty file.
Binary file added craftax/craftax_marl/assets/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/arrow-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/arrow-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/arrow-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/arrow-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/bat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/bow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/chest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/coal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added craftax/craftax_marl/assets/cow.png
Binary file added craftax/craftax_marl/assets/dagger.png
Binary file added craftax/craftax_marl/assets/debug-2.png
Binary file added craftax/craftax_marl/assets/debug-3.png
Binary file added craftax/craftax_marl/assets/debug.png
Binary file added craftax/craftax_marl/assets/debug_tile.png
Binary file added craftax/craftax_marl/assets/deep_thing.png
Binary file added craftax/craftax_marl/assets/dexterity.png
Binary file added craftax/craftax_marl/assets/diamond.png
Binary file added craftax/craftax_marl/assets/diamond_boots.png
Binary file added craftax/craftax_marl/assets/diamond_chestplate.png
Binary file added craftax/craftax_marl/assets/diamond_helmet.png
Binary file added craftax/craftax_marl/assets/diamond_pants.png
Binary file added craftax/craftax_marl/assets/diamond_pickaxe.png
Binary file added craftax/craftax_marl/assets/diamond_sword.png
Binary file added craftax/craftax_marl/assets/drink.png
Binary file added craftax/craftax_marl/assets/energy.png
Binary file added craftax/craftax_marl/assets/fence.png
Binary file added craftax/craftax_marl/assets/fire_elemental.png
Binary file added craftax/craftax_marl/assets/fire_grass.png
Binary file added craftax/craftax_marl/assets/fire_stone.png
Binary file added craftax/craftax_marl/assets/fire_tree.png
Binary file added craftax/craftax_marl/assets/fireball.png
Binary file added craftax/craftax_marl/assets/food.png
Binary file added craftax/craftax_marl/assets/fountain.png
Binary file added craftax/craftax_marl/assets/frost_troll.png
Binary file added craftax/craftax_marl/assets/furnace.png
Binary file added craftax/craftax_marl/assets/gnome_archer.png
Binary file added craftax/craftax_marl/assets/gnome_warrior.png
Binary file added craftax/craftax_marl/assets/grass.png
Binary file added craftax/craftax_marl/assets/grave.png
Binary file added craftax/craftax_marl/assets/grave2.png
Binary file added craftax/craftax_marl/assets/grave3.png
Binary file added craftax/craftax_marl/assets/gravel.png
Binary file added craftax/craftax_marl/assets/health.png
Binary file added craftax/craftax_marl/assets/ice_elemental.png
Binary file added craftax/craftax_marl/assets/ice_grass.png
Binary file added craftax/craftax_marl/assets/ice_shrub.png
Binary file added craftax/craftax_marl/assets/iceball.png
Binary file added craftax/craftax_marl/assets/intelligence.png
Binary file added craftax/craftax_marl/assets/iron.png
Binary file added craftax/craftax_marl/assets/iron_boots.png
Binary file added craftax/craftax_marl/assets/iron_chestplate.png
Binary file added craftax/craftax_marl/assets/iron_helmet.png
Binary file added craftax/craftax_marl/assets/iron_pants.png
Binary file added craftax/craftax_marl/assets/iron_pickaxe.png
Binary file added craftax/craftax_marl/assets/iron_sword.png
Binary file added craftax/craftax_marl/assets/knight.png
Binary file added craftax/craftax_marl/assets/knight_archer.png
Binary file added craftax/craftax_marl/assets/kobold.png
Binary file added craftax/craftax_marl/assets/ladder_down.png
Binary file added craftax/craftax_marl/assets/ladder_down_blocked.png
Binary file added craftax/craftax_marl/assets/ladder_up.png
Binary file added craftax/craftax_marl/assets/lava.png
Binary file added craftax/craftax_marl/assets/leaves.png
Binary file added craftax/craftax_marl/assets/lizard.png
Binary file added craftax/craftax_marl/assets/log.png
Binary file added craftax/craftax_marl/assets/mana.png
Binary file added craftax/craftax_marl/assets/necromancer.png
Binary file added craftax/craftax_marl/assets/orc_mage.png
Binary file added craftax/craftax_marl/assets/orc_soldier.png
Binary file added craftax/craftax_marl/assets/path.png
Binary file added craftax/craftax_marl/assets/path_moss.png
Binary file added craftax/craftax_marl/assets/pigman.png
Binary file added craftax/craftax_marl/assets/plant-ripe.png
Binary file added craftax/craftax_marl/assets/plant-young.png
Binary file added craftax/craftax_marl/assets/plant.png
Binary file added craftax/craftax_marl/assets/plant_on_grass.png
Binary file added craftax/craftax_marl/assets/player-dead.png
Binary file added craftax/craftax_marl/assets/player-down.png
Binary file added craftax/craftax_marl/assets/player-left.png
Binary file added craftax/craftax_marl/assets/player-right.png
Binary file added craftax/craftax_marl/assets/player-sleep.png
Binary file added craftax/craftax_marl/assets/player-up.png
Binary file added craftax/craftax_marl/assets/player.png
Binary file added craftax/craftax_marl/assets/pointer-right.png
Binary file added craftax/craftax_marl/assets/pointer-top-right.png
Binary file added craftax/craftax_marl/assets/potion_blue.png
Binary file added craftax/craftax_marl/assets/potion_cyan.png
Binary file added craftax/craftax_marl/assets/potion_green.png
Binary file added craftax/craftax_marl/assets/potion_pink.png
Binary file added craftax/craftax_marl/assets/potion_red.png
Binary file added craftax/craftax_marl/assets/potion_yellow.png
Binary file added craftax/craftax_marl/assets/ripe_plant_on_grass.png
Binary file added craftax/craftax_marl/assets/ruby.png
Binary file added craftax/craftax_marl/assets/sand.png
Binary file added craftax/craftax_marl/assets/sapling.png
Binary file added craftax/craftax_marl/assets/sapphire.png
Binary file added craftax/craftax_marl/assets/skeleton.png
Binary file added craftax/craftax_marl/assets/slimeball.png
Binary file added craftax/craftax_marl/assets/snail.png
Binary file added craftax/craftax_marl/assets/spider.png
Binary file added craftax/craftax_marl/assets/stalagmite.png
Binary file added craftax/craftax_marl/assets/stone.png
Binary file added craftax/craftax_marl/assets/stone_pickaxe.png
Binary file added craftax/craftax_marl/assets/stone_sword.png
Binary file added craftax/craftax_marl/assets/strength.png
Binary file added craftax/craftax_marl/assets/table.png
Binary file added craftax/craftax_marl/assets/torch_in_inventory.png
Binary file added craftax/craftax_marl/assets/torch_on_path.png
Binary file added craftax/craftax_marl/assets/tree.png
Binary file added craftax/craftax_marl/assets/troll.png
Binary file added craftax/craftax_marl/assets/unknown.png
Binary file added craftax/craftax_marl/assets/wall.png
Binary file added craftax/craftax_marl/assets/wall2.png
Binary file added craftax/craftax_marl/assets/wall_moss.png
Binary file added craftax/craftax_marl/assets/water.png
Binary file added craftax/craftax_marl/assets/wood.png
Binary file added craftax/craftax_marl/assets/wood_pickaxe.png
Binary file added craftax/craftax_marl/assets/wood_sword.png
Binary file added craftax/craftax_marl/assets/xp.png
Binary file added craftax/craftax_marl/assets/zombie.png
Loading