Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Neural MMO
neural-mmo-starter-kit
Commits
33c78bec
Commit
33c78bec
authored
Nov 10, 2021
by
Siddhartha Laghuvarapu
Browse files
resolve merge conflicts
parents
9fce0a0d
895dbaed
Changes
2
Hide whitespace changes
Inline
Side-by-side
agents/__init__.py
View file @
33c78bec
from
agents.neural_baseline_agent
import
NeuralBaselineAgent
from
agents.random_agent
import
RandomNeuralMMOAgent
from
agents.scripted_baseline_agent
import
BaselineForageAgent
,
BaselineCombatAgent
,
BaselineRandomAgent
from
agents.neural_baseline_agent
import
NeuralBaselineAgent
,
NeuralBaselineMultiAgent
#
from agents.random_agent import RandomNeuralMMOAgent
from
agents.scripted_baseline_agent
import
BaselineForageAgent
,
BaselineCombatAgent
,
BaselineRandomAgent
,
ScriptedBaselineMultiAgent
__all__
=
[
"NeuralBaselineAgent"
,
"RandomNeuralMMOAgent"
,
"BaselineRandomAgent"
,
"BaselineCombatAgent"
,
"BaselineForageAgent"
,
"NeuralBaselineMultiAgent"
,
"ScriptedBaselineMultiAgent"
,
]
evaluator/rollout.py
View file @
33c78bec
...
...
@@ -66,8 +66,6 @@ class ProxyEnv(Env):
def
assign_agents
(
player_agent
,
opponent_agents
):
player_index
=
0
if
len
(
opponent_agents
)
!=
127
:
raise
Exception
(
"Number of opponent agents should add up to exactly 127"
)
random
.
shuffle
(
opponent_agents
)
player_index
=
random
.
randint
(
0
,
7
)
agents
=
copy
.
deepcopy
(
opponent_agents
)
...
...
@@ -93,7 +91,7 @@ def run_episode(player_index, agents, N_TIME_STEPS):
"agent"
:
agents
[
agent_idx
],
"agent_idx"
:
agent_idx
,
"player_idx"
:
player_idx
,
"agent_type"
:
agents
[
agent_idx
].
agent_type
[
player_idx
]
"agent_type"
:
agents
[
agent_idx
].
agent_type
s
[
player_idx
]
}
)
...
...
@@ -111,12 +109,12 @@ def run_episode(player_index, agents, N_TIME_STEPS):
individual_meta_map
=
{
x
[
"player_idx"
]:
x
[
"agent_idx"
]
for
x
in
individual_agents
}
for
idx
,
agent
in
enumerate
(
individual_agents
):
if
agent
[
idx
][
"agent_type"
]
==
"neural"
:
if
agent
[
"agent_type"
]
==
"neural"
:
neural_agents
.
add
(
agent_entid_map
[
idx
])
actions
=
{}
for
entid
in
entids
:
agent
=
individual_agents
[
entid_agent_map
[
entid
][
"agent"
]
]
agent
=
individual_agents
[
entid_agent_map
[
entid
]
]
[
"agent"
]
player_idx
=
individual_agents
[
entid_agent_map
[
entid
][
"player_idx"
]]
meta_agent
=
individual_meta_map
[
player_idx
]
meta_entids
=
[[
idx
,
agent_entid_map
[
idx
]]
for
idx
in
meta_individual_map
[
meta_agent
]]
...
...
@@ -150,7 +148,7 @@ def run_episode(player_index, agents, N_TIME_STEPS):
if
entid
in
dead_agents
:
continue
agent
=
individual_agents
[
entid_agent_map
[
entid
][
"agent"
]
]
agent
=
individual_agents
[
entid_agent_map
[
entid
]
]
[
"agent"
]
player_idx
=
individual_agents
[
entid_agent_map
[
entid
][
"player_idx"
]]
meta_agent
=
individual_meta_map
[
player_idx
]
meta_entids
=
[[
idx
,
agent_entid_map
[
idx
]]
for
idx
in
meta_individual_map
[
meta_agent
]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment