From f381adc4d56728b541fbf2e77cc031397b6195f3 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Sun, 24 Mar 2024 15:12:21 -0700 Subject: [PATCH 1/5] updated MP Environment example to include using trained model --- .../examples/multiPlayerEnv/_index.en.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md index 7d81cf67..e534df2f 100644 --- a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md +++ b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md @@ -1,5 +1,5 @@ --- -date: 2016-04-09T16:50:16+02:00 +date: 2024-03-24T21:57:00 title: Multi Player Environment weight: 20 --- @@ -15,4 +15,14 @@ This example focuses on: A dedicated section describing environment settings is presented here. {{% /notice %}} -{{< github_code "https://raw.githubusercontent.com/diambra/arena/main/examples/multi_player_env.py" >}} \ No newline at end of file +{{< github_code "https://raw.githubusercontent.com/diambra/arena/main/examples/multi_player_env.py" >}} + +{{% notice note %}} +You can employ a single trained agent to play against itself in a two-player game setting. To do this effectively, you must separate the observations for each player, ensuring they are formatted correctly according to the model's training configuration. Additionally, actions generated by the model for each player need to be handled distinctly to maintain the integrity of the game's mechanics. +

+The following example demonstrates utilizing a single model for self-play within a two-player environment. It emphasizes the importance of correctly segregating observations and actions for both players: +

+This illustration assumes that the model was trained with both flatten and role_relative options set to True. Should your model's training settings differ, adjustments to the handling of observations and actions will be necessary to align with those specific configurations. +{{% /notice %}} + +{{< github_code "https://raw.githubusercontent.com/diambra/arena/main/examples/mp_with_trained_agent_env.py" >}} \ No newline at end of file From e6f858fc9e359fc2aaa888aa2b0242a50a88119a Mon Sep 17 00:00:00 2001 From: mscrnt Date: Sun, 24 Mar 2024 19:25:26 -0700 Subject: [PATCH 2/5] updated github_code url --- content/gettingStarted/examples/multiPlayerEnv/_index.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md index e534df2f..44f36cdc 100644 --- a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md +++ b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md @@ -25,4 +25,4 @@ The following example demonstrates utilizing a single model for self-play within This illustration assumes that the model was trained with both flatten and role_relative options set to True. Should your model's training settings differ, adjustments to the handling of observations and actions will be necessary to align with those specific configurations. {{% /notice %}} -{{< github_code "https://raw.githubusercontent.com/diambra/arena/main/examples/mp_with_trained_agent_env.py" >}} \ No newline at end of file +{{< github_code "https://raw.githubusercontent.com/diambra/arena/main/examples/multi_player_trained_agent_selfplay_env.py" >}} \ No newline at end of file From de60551532a3937b6eb157a2362bddca6b375ade Mon Sep 17 00:00:00 2001 From: mscrnt Date: Sun, 24 Mar 2024 19:59:05 -0700 Subject: [PATCH 3/5] formatting changes --- .../examples/multiPlayerEnv/_index.en.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md index 44f36cdc..ac416b44 100644 --- a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md +++ b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md @@ -17,12 +17,12 @@ A dedicated section describing environment settings is presented }} -{{% notice note %}} +# Trained Agent SelfPlay + You can employ a single trained agent to play against itself in a two-player game setting. To do this effectively, you must separate the observations for each player, ensuring they are formatted correctly according to the model's training configuration. Additionally, actions generated by the model for each player need to be handled distinctly to maintain the integrity of the game's mechanics. -

-The following example demonstrates utilizing a single model for self-play within a two-player environment. It emphasizes the importance of correctly segregating observations and actions for both players: -

-This illustration assumes that the model was trained with both flatten and role_relative options set to True. Should your model's training settings differ, adjustments to the handling of observations and actions will be necessary to align with those specific configurations. -{{% /notice %}} + +The following example demonstrates utilizing a single model for self-play within a two-player environment. It emphasizes the importance of correctly segregating observations and actions for both players. + +This illustration assumes that the model was trained with both `flatten` and `role_relative` options set to `True`. Should your model's training settings differ, adjustments to the handling of observations and actions will be necessary to align with those specific configurations. {{< github_code "https://raw.githubusercontent.com/diambra/arena/main/examples/multi_player_trained_agent_selfplay_env.py" >}} \ No newline at end of file From 65d994b939d69067a26e1b9c0ef81884db64496d Mon Sep 17 00:00:00 2001 From: mscrnt Date: Sun, 24 Mar 2024 20:25:56 -0700 Subject: [PATCH 4/5] Corrected paragraph header --- content/gettingStarted/examples/multiPlayerEnv/_index.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md index ac416b44..264c8eca 100644 --- a/content/gettingStarted/examples/multiPlayerEnv/_index.en.md +++ b/content/gettingStarted/examples/multiPlayerEnv/_index.en.md @@ -17,7 +17,7 @@ A dedicated section describing environment settings is presented
}} -# Trained Agent SelfPlay +### Trained Agent SelfPlay You can employ a single trained agent to play against itself in a two-player game setting. To do this effectively, you must separate the observations for each player, ensuring they are formatted correctly according to the model's training configuration. Additionally, actions generated by the model for each player need to be handled distinctly to maintain the integrity of the game's mechanics. From 6fdb9be783745daf0bb97b1aaf652c58490d3aa5 Mon Sep 17 00:00:00 2001 From: mscrnt Date: Tue, 14 Jan 2025 08:53:38 -0800 Subject: [PATCH 5/5] Update Docker run command to include port mapping for engine in windows. --- content/gettingStarted/_index.en.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/gettingStarted/_index.en.md b/content/gettingStarted/_index.en.md index 148f460f..227dea4d 100755 --- a/content/gettingStarted/_index.en.md +++ b/content/gettingStarted/_index.en.md @@ -216,7 +216,8 @@ echo > %userprofile%/.diambra/credentials docker run --rm -ti --name engine ^ -v %userprofile%/.diambra/credentials:/tmp/.diambra/credentials ^ -v %userprofile%/.diambra/roms:/opt/diambraArena/roms ^ - --net=host docker.io/diambra/engine:latest + -p 127.0.0.1:50051:50051 ^ + docker.io/diambra/engine:latest ``` {{% /tab %}}