Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
651abbd
log scores
AndKram Aug 9, 2018
a0e60db
parse score log
AndKram Aug 10, 2018
452cbe8
convert log to csv
AndKram Aug 10, 2018
8596458
Revert "convert log to csv"
AndKram Aug 13, 2018
1fb0b7c
Revert "Revert "convert log to csv""
AndKram Aug 13, 2018
c2c7039
chnagelog scoring
AndKram Aug 13, 2018
46800cc
custom score logging
AndKram Aug 14, 2018
adf36c7
fix timeLimitInMS
AndKram Sep 5, 2018
e83ccd8
prototype
AndKram Sep 5, 2018
9aa7eb4
clean up
AndKram Sep 6, 2018
e6f1c9c
mission init from mission xml
AndKram Sep 6, 2018
518e4f1
single agent testing
AndKram Sep 7, 2018
218f4fb
turn based
AndKram Sep 7, 2018
48088ee
commands
AndKram Sep 10, 2018
7821184
close and more careful step
AndKram Sep 11, 2018
17e8b9f
minor readme tweek
AndKram Sep 12, 2018
6bdbec0
make more package like
AndKram Sep 12, 2018
4c42c50
Merge branch 'master' of https://github.com/Microsoft/malmo
AndKram Sep 13, 2018
d541aaf
merge master
AndKram Sep 13, 2018
8aa7117
rework turn taking
AndKram Sep 13, 2018
dd244a7
resync
AndKram Sep 14, 2018
4576286
simpler run multi example
AndKram Sep 17, 2018
b90a306
early resets
AndKram Sep 18, 2018
bd6bd1b
three agents
AndKram Sep 18, 2018
965ad04
Update README.md
AndKram Sep 18, 2018
e3324bd
Update README.md
AndKram Sep 18, 2018
18ff463
Update README.md
AndKram Sep 19, 2018
de6e7b8
add two example missions
AndKram Sep 19, 2018
a57c15a
Merge remote-tracking branch 'refs/remotes/origin/malmoenv' into malm…
AndKram Sep 19, 2018
a4cb128
test obs is image
AndKram Sep 19, 2018
6289f31
install dependencies
AndKram Sep 19, 2018
a269783
first demo
AndKram Sep 20, 2018
b22d51f
download from git
AndKram Sep 20, 2018
f8b73ad
options on step for timing
AndKram Sep 21, 2018
914f4c8
simpler client launch
AndKram Sep 21, 2018
1c519c6
update README
AndKram Sep 21, 2018
4e47972
make top level
AndKram Sep 25, 2018
f69e2d7
verbage
AndKram Sep 25, 2018
09d8dd4
arena first test
AndKram Sep 25, 2018
5f8a3a2
fix disconnect
AndKram Sep 26, 2018
4b3f2a5
use indexing to look up actions
AndKram Sep 26, 2018
354ad54
marlo first cut
AndKram Sep 27, 2018
a79c3e3
fix debug print
AndKram Sep 27, 2018
d29cd80
simpler turn result and version protocol
AndKram Sep 28, 2018
e6fbd18
Update README.md
AndKram Oct 2, 2018
0799a29
use common version
AndKram Oct 3, 2018
741a309
Merge branch 'malmoenv' of https://github.com/Microsoft/malmo into ma…
AndKram Oct 3, 2018
c7b7dee
tidy
AndKram Oct 3, 2018
4f66cea
tidy code
AndKram Oct 3, 2018
7bb93e5
remove TODO
AndKram Oct 3, 2018
72818b8
allow multiple commands per step
AndKram Oct 3, 2018
4014540
withinfo wait
AndKram Oct 4, 2018
55a8cff
let's have a version file in git
AndKram Oct 4, 2018
38a3727
args for server/server2
AndKram Oct 8, 2018
4a0f53f
initial observ
AndKram Oct 9, 2018
acce1eb
consitent h x w (for marlo)
AndKram Oct 9, 2018
c5af7b0
fix peek obs
AndKram Oct 9, 2018
cb0bcc8
tidy
AndKram Oct 9, 2018
515c43a
separate out setup from download
AndKram Oct 10, 2018
597d902
fix resync
AndKram Oct 10, 2018
96b1353
not a TODO
AndKram Oct 12, 2018
a8ccba5
build & run exisiting tests
AndKram Oct 12, 2018
06b2b0e
infer with turnkey
AndKram Oct 15, 2018
5c83eed
tidy
AndKram Oct 16, 2018
967537c
don't wait if done
AndKram Oct 16, 2018
938610b
0.37
AndKram Oct 16, 2018
e2b0179
merge score
AndKram Oct 16, 2018
f7a4403
Merge branch 'compass' into prep37
AndKram Oct 16, 2018
348c585
update License.txt
AndKram Oct 16, 2018
1956c41
merge malmoenv
AndKram Oct 16, 2018
b6164b5
version fix
AndKram Oct 16, 2018
9f1b9f7
readmes
AndKram Oct 17, 2018
38798b8
tidy readmes
AndKram Oct 17, 2018
bf4df37
Update README.md
AndKram Oct 17, 2018
5a26cb6
Update README.md
AndKram Oct 17, 2018
ab4e6a5
add setup doc str
AndKram Oct 17, 2018
79ef129
test quit
AndKram Oct 17, 2018
438d5da
minor pylint
AndKram Oct 25, 2018
6a41a51
make exit_resync non hidden
AndKram Oct 26, 2018
aa6835f
null world exception
AndKram Oct 26, 2018
3ea3ff1
fix peek forever
AndKram Oct 29, 2018
3e4d628
timeout on find
AndKram Oct 31, 2018
e1da80f
remove spurious package decl from comment
AndKram Oct 31, 2018
977fb50
don't fail on close fail
AndKram Oct 31, 2018
8b65204
fix README.md
AndKram Nov 5, 2018
e79632b
Merge pull request #764 from Microsoft/prep37
AndKram Nov 5, 2018
05bd29f
remove entry point - scripted in k8 yaml
AndKram Nov 6, 2018
02132af
Merge pull request #769 from Microsoft/dockerfix1
AndKram Nov 6, 2018
88091ad
Update README.md
AndKram Nov 6, 2018
998c01c
manylinux py36
AndKram Nov 6, 2018
0ab7082
Merge pull request #771 from Microsoft/dockerfix1
AndKram Nov 6, 2018
3531e7f
side step deadlock
AndKram Nov 8, 2018
68d9e36
version xsds
AndKram Nov 8, 2018
f2ac003
Revert "side step deadlock"
AndKram Nov 8, 2018
b249cee
Merge pull request #773 from Microsoft/xsd37
AndKram Nov 8, 2018
2760540
version
AndKram Nov 8, 2018
412fd24
restart was timing out
AndKram Nov 9, 2018
ee8c765
fix close NoneType
AndKram Nov 16, 2018
8b7e467
sticter with turns
AndKram Nov 23, 2018
8afbf02
side step shutdown hangs
AndKram Nov 30, 2018
f820df5
Revert "side step shutdown hangs"
AndKram Nov 30, 2018
f9b0a6a
Revert "Revert "side step shutdown hangs""
AndKram Nov 30, 2018
3b90b4e
Merge pull request #779 from Microsoft/statelock
AndKram Nov 30, 2018
170eb61
BUSY on start mission
AndKram Dec 6, 2018
03a2708
wait for close
AndKram Dec 7, 2018
82f188b
fix missing handle Interupt Exc
AndKram Dec 7, 2018
e6287c5
Use master branch
AndKram Dec 11, 2018
950b273
Fix version.properties creation command
AndKram Dec 11, 2018
3d72e1b
Update README.md
AndKram Dec 11, 2018
6991d82
current dir not on exec path
AndKram Dec 11, 2018
78ebc6e
ensure TCP servers closed
AndKram Jan 2, 2019
be325b8
MacOS seg fault on destruct
AndKram Jan 3, 2019
aa6aec4
Merge branch 'master' into statelock
AndKram Jan 4, 2019
7da334c
tidy
AndKram Jan 4, 2019
5abf4ed
lifetime of StringServers
AndKram Jan 4, 2019
de02c59
stringserver tests
AndKram Jan 4, 2019
b334fdf
Update README.md
AndKram Jan 7, 2019
867c51c
Update README.md
AndKram Jan 7, 2019
d0be629
Fixing pip installation for MalmoEnv
filangelos Jan 21, 2019
e7cc696
Merge pull request #789 from filangel/patch-1
AndKram Jan 22, 2019
9aa76f7
typo
AndKram Jan 22, 2019
a5e5292
Merge pull request #785 from Microsoft/statelock
AndKram Jan 22, 2019
5577ded
openjdk
AndKram Jan 22, 2019
3265a51
imporve windows install note
AndKram Jan 23, 2019
08cad2f
Merge pull request #790 from Microsoft/openjdk
AndKram Jan 25, 2019
aec4e81
malmoenv fixes
AndKram Jan 29, 2019
a45c746
malmoenv bugs
AndKram Jan 29, 2019
3d77537
wait longer than Minecraft start up
AndKram Jan 30, 2019
91b1a7a
Merge pull request #791 from Microsoft/malmoenvbugs
AndKram Jan 30, 2019
945f74c
Merge branch 'master' of https://github.com/Microsoft/malmo
AndKram Mar 18, 2019
50451a6
change path for doxygen download
AndKram Mar 18, 2019
7058103
code changes
AndKram Mar 20, 2019
d9f54a2
Merge branch 'master' into inventory
AndKram Mar 20, 2019
fcda7c0
schema changes
AndKram Mar 20, 2019
8f5a19c
add mission.xsd changes; get sample to run
AndKram Mar 25, 2019
3cd2b88
amount should be 1
AndKram Mar 25, 2019
b69ee55
Merge pull request #800 from Microsoft/doxygen_link
AndKram Apr 8, 2019
902d852
Fix minor type
AndKram Apr 17, 2019
4139cd6
Say to use a second shell or Terminal sesion to run agent.
AndKram Apr 23, 2019
c72e466
Implement better Boost::Python finding routine in CMake
kirillbobyrev Apr 30, 2019
bbd5b56
Address PR review comments
kirillbobyrev May 3, 2019
4c4f789
Merge pull request #813 from kirillbobyrev/cleanup
AndKram May 3, 2019
a20590d
regain backwards compatibility
AndKram May 13, 2019
565762f
code review comment
AndKram May 13, 2019
0d15b32
Update to available version of JDK8
Crissman May 29, 2019
bab1e22
upgrade boost
AndKram Jul 8, 2019
78157c8
Merge pull request #817 from Crissman/patch-1
AndKram Jul 8, 2019
f68e43d
Update Malmo/src/PythonWrapper/CMakeLists.txt
Jul 10, 2019
2e0e2f4
malmoenv version
AndKram Jul 11, 2019
0269d77
remove bdist
AndKram Jul 11, 2019
b3787d4
Update README.md
AndKram Jul 11, 2019
a6513bf
Update README.md
AndKram Jul 11, 2019
dac81e8
revert
AndKram Jul 11, 2019
f70e918
Update README.md
AndKram Jul 11, 2019
e74ef97
unit8 observations everywhere
AndKram Jul 15, 2019
3b847a5
version malmoenv
AndKram Jul 15, 2019
2ebded6
Merge pull request #825 from adarshp/patch-1
AndKram Jul 16, 2019
428a75e
Merge pull request #824 from microsoft/updateboost
AndKram Jul 16, 2019
bb02c69
Minor clarifications
AndKram Jul 18, 2019
3e5d980
MarLo missions
AndKram Jul 18, 2019
1fb8972
fix exit_resync
AndKram Jul 18, 2019
98607a8
Update README.md
AndKram Jul 18, 2019
d10fe20
arg comment
AndKram Jul 18, 2019
8f0cd41
Merge pull request #826 from microsoft/marloxmls
AndKram Jul 18, 2019
ace3b04
Improve README
AndKram Jul 18, 2019
88673dc
Improved Boost handling
Jul 26, 2019
0e4938e
fixes for reshape
AndKram Aug 1, 2019
cf2491f
Removing redundant setting of Boost Python library name
Aug 1, 2019
92ba0be
Merge pull request #832 from microsoft/marloxmls
AndKram Aug 2, 2019
0e8156e
add sub module
AndKram Sep 2, 2019
29e1c05
Point at test.pypi.org for additional wheels
AndKram Sep 2, 2019
1b29f67
add video recording
AndKram Sep 3, 2019
5d1d91f
Merge pull request #837 from microsoft/malmoenvvideo
AndKram Sep 5, 2019
bfda7ae
Merge pull request #836 from microsoft/proxyenv
AndKram Sep 6, 2019
e46272c
Merge pull request #828 from adarshp/patch-2
AndKram Sep 6, 2019
26433ad
Merge pull request #804 from microsoft/inventory
AndKram Sep 6, 2019
89da24c
Microsoft mandatory file
microsoft-github-policy-service[bot] Sep 8, 2022
b59258d
Merge pull request #926 from microsoft/users/GitHubPolicyService/b02e…
DaveyBiggers Sep 23, 2022
c4a3bae
Update from gym to gymnasium, and remove the proxyenv
Sep 3, 2025
2af0800
Merge pull request #1026 from microsoft/dabignel/nuke_proxy_env
DaveyBiggers Sep 3, 2025
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
44 changes: 36 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,26 @@ set( STATIC_BOOST ON CACHE BOOL ${STATIC_BOOST_DESC} )
if( INCLUDE_PYTHON )
set( USE_PYTHON_VERSIONS_DESC "Specifies which version of Python to build Malmo with Python bindings" )
set( USE_PYTHON_VERSIONS 3.6 CACHE STRING ${USE_PYTHON_VERSIONS_DESC} )
set( BOOST_PYTHON_NAME_DESC "Specifies which Boost Python module to build Malmo with" )
set( BOOST_PYTHON_NAME "python3" CACHE STRING ${BOOST_PYTHON_NAME_DESC} )
if (NOT BOOST_PYTHON_NAME)
message("The name of the Boost Python library has not been set - trying to
determine it automatically...")
set(BOOST_PYTHON_NAME_DESC "Specifies which Boost Python module to build Malmo with" )

if (Boost_VERSION VERSION_GREATER 1.67 )
# From version 1.67 and up, Boost appends the Python version number to
# the library name by default.
# (https://www.boost.org/users/history/version_1_67_0.html)
execute_process(
COMMAND python3 -c "import sys; print('python' + str(sys.version_info[0]) + str(sys.version_info[1]), end='')"
OUTPUT_VARIABLE BOOST_PYTHON_NAME
)
else()
set (BOOST_PYTHON_NAME "python")
endif()
message("BOOST_PYTHON_NAME set to ${BOOST_PYTHON_NAME}. To override it, add
the flag -DBOOST_PYTHON_NAME=<name> where <name> is the name of the Boost
Python library on your system (see https://github.com/boostorg/build/pull/250).")
endif()
endif()

set( WARNINGS_AS_ERRORS OFF )
Expand Down Expand Up @@ -102,19 +120,29 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
SET(Boost_ADDITIONAL_VERSIONS "1.65" "1.65.0")
SET(Boost_ADDITIONAL_VERSIONS "1.66" "1.66.0")
SET(Boost_ADDITIONAL_VERSIONS "1.67" "1.67.0")
SET(Boost_ADDITIONAL_VERSIONS "1.68" "1.68.0")
SET(Boost_ADDITIONAL_VERSIONS "1.69" "1.69.0")
SET(Boost_ADDITIONAL_VERSIONS "1.70" "1.70.0")

# Boost release variant builds have symbol visibility set to hidden by default
# (https://boostorg.github.io/build/manual/develop/index.html#bbv2.overview.builtins.features)
# The line below adds compilation flags to make the visibility settings for compiling Malmo
# consistent with the visibility settings for Boost, and fixes linking warnings emitted by the
# GCC 9 compiler.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")

# This allows users to override the Boost Python library name if different from
# the defaults (this can occur with certain package managers - e.g. For Boost compiled against Python 3.6,
# MacPorts would name the Boost Python library as libboost_python3 instead of libboost_python36).

SET(BOOST_PYTHON_MODULE_NAME "python")
if ( USE_PYTHON_VERSIONS VERSION_GREATER 3 )
SET( BOOST_PYTHON_MODULE_NAME ${BOOST_PYTHON_NAME} )
endif()

if( WIN32 )
SET(Boost_USE_STATIC_LIBS ON)
find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options ${BOOST_PYTHON_MODULE_NAME} regex system thread REQUIRED )
find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options ${BOOST_PYTHON_NAME} regex system thread REQUIRED )
add_definitions(-DBOOST_ALL_NO_LIB=1) # Turn off auto-linking, creates problems when linking boost statically
else()
SET(Boost_USE_STATIC_LIBS ${STATIC_BOOST})
find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options ${BOOST_PYTHON_MODULE_NAME} regex system thread REQUIRED )
find_package( Boost COMPONENTS chrono date_time filesystem iostreams program_options ${BOOST_PYTHON_NAME} regex system thread REQUIRED )
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package( Threads REQUIRED )
endif()
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Microsoft Corporation
Copyright (c) 2016, 2018 Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
Expand Down
10 changes: 8 additions & 2 deletions Malmo/samples/Python_examples/inventory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def getContainerXML():
while world_state.is_mission_running:
world_state = agent_host.getWorldState()
if world_state.number_of_rewards_since_last_state > 0:
total_reward += world_state.rewards[-1].getValue()
reward = world_state.rewards[-1].getValue()
if reward != 0:
print("Got reward of " + str(reward))
total_reward += reward
if world_state.number_of_observations_since_last_state > 0:
obs = json.loads(world_state.observations[-1].text)

Expand Down Expand Up @@ -306,7 +309,10 @@ def getContainerXML():
# Mission has ended.
# Get final reward:
if world_state.number_of_rewards_since_last_state > 0:
total_reward += world_state.rewards[-1].getValue()
reward = world_state.rewards[-1].getValue()
if reward != 0:
print("Got final reward of " + str(reward))
total_reward += reward

test_passed = True
if False in list(completed_boxes.values()):
Expand Down
4 changes: 3 additions & 1 deletion Malmo/samples/Python_examples/sample_missions_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
# -- set up the mission -- #
#mission_file_no_ext = '../Sample_missions/default_world_1' # Survive and find gold, diamond or redstone!
#mission_file_no_ext = '../Sample_missions/default_flat_1' # Move to a wooden hut in a snow tempest!
mission_file_no_ext = '../Sample_missions/tricky_arena_1' # Mind your step to the redstone!
# This is the default mission to run:
mission_file_no_ext = '../Sample_missions/tricky_arena_1' # Mind your step to the redstone!
#mission_file_no_ext = '../Sample_missions/inventory_handlers' # Tour of crafting, smelting, collecting!
#mission_file_no_ext = '../Sample_missions/eating_1' # Eat a healthy diet!
#mission_file_no_ext = '../Sample_missions/cliff_walking_1' # Burning lava!

Expand Down
2 changes: 1 addition & 1 deletion Malmo/samples/Python_examples/team_reward_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def safeStartMission(agent_host, my_mission, my_client_pool, my_mission_record,
print("Will wait and retry.", max_attempts - used_attempts, "attempts left.")
time.sleep(2)
else:
print("Other error:", e.message)
print("Other error: ", str(e))
print("Waiting will not help here - bailing immediately.")
exit(1)
if used_attempts == max_attempts:
Expand Down
38 changes: 38 additions & 0 deletions Malmo/src/AgentHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,44 @@ namespace malmo
this->world_state.is_mission_running = false;
closeServers();
closeRecording();

// Ensure all TCP server ports are closed.

if (this->video_server) {
this->video_server->close();
this->video_server = 0;
}

if (this->depth_server) {
this->depth_server->close();
this->depth_server = 0;
}

if (this->luminance_server) {
this->luminance_server->close();
this->luminance_server = 0;
}

if (this->colourmap_server) {
this->colourmap_server->close ();
this->colourmap_server = 0;
}

if (this->observations_server) {
this->observations_server->close();
this->observations_server = 0;
}

if (this->rewards_server) {
this->rewards_server->close();
this->rewards_server = 0;

}

if (this->mission_control_server) {
this->mission_control_server->close();
this->mission_control_server = 0;
}
}

void AgentHost::closeServers()
Expand Down
37 changes: 36 additions & 1 deletion Malmo/src/MissionSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace malmo
const std::vector<std::string> MissionSpec::all_inventory_commands = { "swapInventoryItems", "combineInventoryItems", "discardCurrentItem",
"hotbar.1", "hotbar.2", "hotbar.3", "hotbar.4", "hotbar.5", "hotbar.6", "hotbar.7", "hotbar.8", "hotbar.9" };
const std::vector<std::string> MissionSpec::all_simplecraft_commands = { "craft" };
const std::vector<std::string> MissionSpec::all_nearbycraft_commands = { "craftNearby" };
const std::vector<std::string> MissionSpec::all_nearbysmelt_commands = { "smeltNearby" };
const std::vector<std::string> MissionSpec::all_chat_commands = { "chat" };
const std::vector<std::string> MissionSpec::all_mission_quit_commands = { "quit" };
const std::vector<std::string> MissionSpec::all_human_level_commands = { "forward", "left", "right", "jump", "sneak", "sprint", "inventory", "swapHands", "drop", "use", "attack", "moveMouse",
Expand Down Expand Up @@ -110,6 +112,7 @@ namespace malmo
child.erase("FlatWorldGenerator");
child.erase("FileWorldGenerator");
child.erase("DefaultWorldGenerator");
child.erase("BiomeGenerator");
}
}

Expand Down Expand Up @@ -137,6 +140,10 @@ namespace malmo
if (defaultWorldGenerator) {
defaultWorldGenerator.get().put("<xmlattr>.forceReset", true);
}
const auto& biomeWorldGenerator = mission.get_child_optional("Mission.ServerSection.ServerHandlers.BiomeGenerator");
if (biomeWorldGenerator) {
biomeWorldGenerator.get().put("<xmlattr>.forceReset", true);
}
}

void MissionSpec::setTimeOfDay(int t,bool allowTimeToPass)
Expand Down Expand Up @@ -359,6 +366,11 @@ namespace malmo
mission.put("Mission.AgentSection.AgentHandlers.ObservationFromChat", "");
}

void MissionSpec::observeCompass()
{
mission.put("Mission.AgentSection.AgentHandlers.ObservationFromCompass", "");
}

// ------------------ settings for the agents : command handlers --------------------------------

void MissionSpec::removeAllCommandHandlers()
Expand All @@ -371,6 +383,9 @@ namespace malmo
child.erase("DiscreteMovementCommands");
child.erase("AbsoluteMovementCommands");
child.erase("SimpleCraftCommands");
child.erase("NearbyCraftCommands");
child.erase("NearbySmeltCommands");
child.erase("PlaceCommands");
child.erase("ChatCommands");
child.erase("MissionQuitCommands");
}
Expand Down Expand Up @@ -415,11 +430,16 @@ namespace malmo
{
addVerbToCommandType(verb, "Mission.AgentSection.AgentHandlers.InventoryCommands");
}

void MissionSpec::allowAllChatCommands()
{
mission.put("Mission.AgentSection.AgentHandlers.ChatCommands", "");
}

void MissionSpec::allowAllPlaceCommands()
{
mission.put("Mission.AgentSection.AgentHandlers.PlaceCommands", "");
}

// ------------------------------- information ---------------------------------------------------

Expand Down Expand Up @@ -517,6 +537,15 @@ namespace malmo

if (e.second.get_child_optional("AgentHandlers.SimpleCraftCommands"))
command_handlers.push_back("SimpleCraft");

if (e.second.get_child_optional("AgentHandlers.NearbyCraftCommands"))
command_handlers.push_back("NearbyCraft");

if (e.second.get_child_optional("AgentHandlers.NearbySmeltCommands"))
command_handlers.push_back("NearbySmelt");

if (e.second.get_child_optional("AgentHandlers.PlaceCommands"))
command_handlers.push_back("Place");

if (e.second.get_child_optional("AgentHandlers.MissionQuitCommands"))
command_handlers.push_back("MissionQuit");
Expand Down Expand Up @@ -577,6 +606,12 @@ namespace malmo
else if (command_handler == "SimpleCraft") {
allowed_commands = all_simplecraft_commands;
}
else if (command_handler == "NearbyCraft") {
allowed_commands = all_nearbycraft_commands;
}
else if (command_handler == "NearbySmelt") {
allowed_commands = all_nearbysmelt_commands;
}
else if (command_handler == "Chat") {
allowed_commands = all_chat_commands;
}
Expand Down
9 changes: 9 additions & 0 deletions Malmo/src/MissionSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ namespace malmo
//! Asks for chat messages to be included in the observations.
void observeChat();

//! Asks for compass information to be included in the observations.
void observeCompass();

// -------------------- settings for the agents : command handlers -------------------------

//! Remove any existing command handlers from the mission specification. Use with other functions to add exactly the command handlers you want.
Expand Down Expand Up @@ -296,6 +299,10 @@ namespace malmo
//! Only applies to the first agent in the mission. For multi-agent missions, specify the command handlers for each in the XML.
void allowAllChatCommands();

//! Adds a place command handler if none present, with neither an allow-list or a deny-list, thus allowing any command to be sent.
//! Only applies to the first agent in the mission. For multi-agent missions, specify the command handlers for each in the XML.
void allowAllPlaceCommands();

// ------------------------- information --------------------------------------

//! Returns the short description of the mission.
Expand Down Expand Up @@ -379,6 +386,8 @@ namespace malmo
static const std::vector<std::string> all_discrete_movement_commands;
static const std::vector<std::string> all_inventory_commands;
static const std::vector<std::string> all_simplecraft_commands;
static const std::vector<std::string> all_nearbycraft_commands;
static const std::vector<std::string> all_nearbysmelt_commands;
static const std::vector<std::string> all_chat_commands;
static const std::vector<std::string> all_mission_quit_commands;
static const std::vector<std::string> all_human_level_commands;
Expand Down
2 changes: 1 addition & 1 deletion Malmo/src/PythonWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set( CPP_SOURCES
)

set( OTHER_FILES
${CMAKE_SOURCE_DIR}/Malmo/samples/Python_examples/tutorial_6.xml
${PROJECT_SOURCE_DIR}/Malmo/samples/Python_examples/tutorial_6.xml
)

python_add_module( MalmoPython SHARED ${CPP_SOURCES} )
Expand Down
15 changes: 9 additions & 6 deletions Malmo/src/StringServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@
namespace malmo {
StringServer::StringServer(boost::asio::io_service& io_service, int port, const boost::function<void(const TimestampedString string_message)> handle_string, const std::string& log_name)
: handle_string(handle_string)
, server(io_service, port, boost::bind(&StringServer::handleMessage, this, _1), log_name)
, io_service(io_service)
, port(port)
, log_name(log_name)
{
}

void StringServer::start(boost::shared_ptr<StringServer>& scope)
{
this->server = boost::make_shared<TCPServer>(this->io_service, this->port, boost::bind(&StringServer::handleMessage, scope, _1), this->log_name);
this->scope = scope;
this->server.start(scope.get());
this->server->start(scope.get());
}

void StringServer::close() {
this->server.close();
this->server->close();
}

void StringServer::release() {
Expand All @@ -60,13 +63,13 @@ namespace malmo {

StringServer& StringServer::confirmWithFixedReply(std::string reply)
{
this->server.confirmWithFixedReply(reply);
this->server->confirmWithFixedReply(reply);
return *this;
}

StringServer& StringServer::expectSizeHeader(bool expect_size_header)
{
this->server.expectSizeHeader(expect_size_header);
this->server->expectSizeHeader(expect_size_header);
return *this;
}

Expand All @@ -91,7 +94,7 @@ namespace malmo {

int StringServer::getPort() const
{
return this->server.getPort();
return this->server->getPort();
}

void StringServer::recordMessage(const TimestampedString string_message)
Expand Down
5 changes: 4 additions & 1 deletion Malmo/src/StringServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ namespace malmo
void handleMessage(const TimestampedUnsignedCharVector message);

boost::function<void(const TimestampedString string_message)> handle_string;
TCPServer server;
boost::asio::io_service& io_service;
int port;
const std::string log_name;
boost::shared_ptr<TCPServer> server;
std::ofstream writer;
boost::mutex write_mutex;

Expand Down
Loading