20 #ifndef _MISSIONSPEC_H_
21 #define _MISSIONSPEC_H_
24 #include <boost/property_tree/ptree.hpp>
52 std::string
getAsXML(
bool prettyPrint )
const;
87 void drawBlock(
int x,
int y,
int z,
const std::string& blockType);
97 void drawCuboid(
int x1,
int y1,
int z1,
int x2,
int y2,
int z2,
const std::string& blockType);
104 void drawItem(
int x,
int y,
int z,
const std::string& itemType);
112 void drawSphere(
int x,
int y,
int z,
int radius,
const std::string& blockType);
122 void drawLine(
int x1,
int y1,
int z1,
int x2,
int y2,
int z2,
const std::string& blockType);
149 void endAt(
float x,
float y,
float z,
float tolerance);
230 void observeGrid(
int x1,
int y1,
int z1,
int x2,
int y2,
int z2,
const std::string& name);
367 int getChildCount(
const std::string& element,
const std::string& childName)
const;
369 friend std::ostream& operator<<(std::ostream& os,
const MissionSpec& ms);
370 friend class MissionInitSpec;
372 static const std::string XMLNS_XSI;
373 static const std::string MALMO_NAMESPACE;
376 boost::optional<int> getRoleValue(
int role, std::string videoType,
char what)
const;
377 void addVerbToCommandType(std::string verb, std::string commandType);
378 void worldGeneratorReset();
380 boost::property_tree::ptree& getDrawingDecorator();
382 boost::property_tree::ptree mission;
384 static const std::vector<std::string> all_continuous_movement_commands;
385 static const std::vector<std::string> all_absolute_movement_commands;
386 static const std::vector<std::string> all_discrete_movement_commands;
387 static const std::vector<std::string> all_inventory_commands;
388 static const std::vector<std::string> all_simplecraft_commands;
389 static const std::vector<std::string> all_nearbycraft_commands;
390 static const std::vector<std::string> all_nearbysmelt_commands;
391 static const std::vector<std::string> all_chat_commands;
392 static const std::vector<std::string> all_mission_quit_commands;
393 static const std::vector<std::string> all_human_level_commands;
Specifies a mission to be run.
Definition: MissionSpec.h:37
void createDefaultTerrain()
Instead of the default flat world, make a world using Minecraft's terrain generator.
void allowAllAbsoluteMovementCommands()
Adds an absolute movement command handler if none present, with neither an allow-list or a deny-list,...
void drawBlock(int x, int y, int z, const std::string &blockType)
Draw a Minecraft block in the world.
void observeHotBar()
Asks for the contents of the player's hot-bar to be included in the observations.
MissionSpec()
Constructs a mission with default parameters: a flat world with a 10 seconds time limit and continuou...
void allowContinuousMovementCommand(const std::string &verb)
Adds an allow-list to the continuous movement command handler if none present.
void allowAllInventoryCommands()
Adds an inventory command handler if none present, with neither an allow-list or a deny-list,...
void endAt(float x, float y, float z, float tolerance)
Sets the end location for the agent.
void timeLimitInSeconds(float s)
Sets the time limit for the mission.
void startAtWithPitchAndYaw(float x, float y, float z, float pitch, float yaw)
Sets the start location and angles for the agent.
void drawSphere(int x, int y, int z, int radius, const std::string &blockType)
Draw a solid sphere of blocks in the world.
int getVideoHeight(int role) const
Returns the height of the requested video for one of the agents involved in this mission.
void observeDistance(float x, float y, float z, const std::string &name)
Asks for the Euclidean distance to a location to be included in the observations.
void setViewpoint(int viewpoint)
Sets the camera position.
void observeFullInventory()
Asks for the full item inventory of the player to be included in the observations.
void setModeToSpectator()
Sets the player mode for the agent to spectator, allowing them to fly and pass through objects....
void observeGrid(int x1, int y1, int z1, int x2, int y2, int z2, const std::string &name)
Asks for observations of the block types within a cuboid relative to the agent's position.
void requestLuminance(int width, int height)
Asks for 8bpp greyscale image data to be sent from Minecraft for the agent.
void setWorldSeed(const std::string &seed)
Set the seed used for Minecraft's terrain generation.
void setTimeOfDay(int t, bool allowTimeToPass)
Sets the time of day for the start of the mission.
void setSummary(const std::string &summary)
Sets the summary description of the mission.
void allowAllDiscreteMovementCommands()
Adds a discrete movement command handler if none present, with neither an allow-list or a deny-list,...
void allowDiscreteMovementCommand(const std::string &verb)
Adds an allow-list to the discrete movement command handler if none present.
MissionSpec(const std::string &xml, bool validate)
Constructs a mission from the supplied XML as specified here: Schemas/Mission.html
void allowAllPlaceCommands()
Adds a place command handler if none present, with neither an allow-list or a deny-list,...
void requestVideo(int width, int height)
Asks for image data to be sent from Minecraft for the agent.
bool isDepthRequested(int role) const
Gets whether depthmap video has been requested for one of the agents involved in this mission.
int getVideoWidth(int role) const
Returns the width of the requested video for one of the agents involved in this mission.
void allowAllContinuousMovementCommands()
Adds a continuous movement command handler if none present, with neither an allow-list or a deny-list...
std::vector< std::string > getAllowedCommands(int role, const std::string &command_handler) const
Returns a list of the names of the allowed commands for one of the agents involved in this mission.
void removeAllCommandHandlers()
Remove any existing command handlers from the mission specification.
void requestVideoWithDepth(int width, int height)
Asks for image data and depth data to be sent from Minecraft for the agent.
void drawLine(int x1, int y1, int z1, int x2, int y2, int z2, const std::string &blockType)
Draw a line of blocks in the world.
void allowAllChatCommands()
Adds a chat command handler if none present, with neither an allow-list or a deny-list,...
void observeChat()
Asks for chat messages to be included in the observations.
std::string getAsXML(bool prettyPrint) const
Gets the mission specification as an XML string.
void observeCompass()
Asks for compass information to be included in the observations.
void requestColourMap(int width, int height)
Asks for 24bpp colourmap image data to be sent from Minecraft for the agent.
int getChildCount(const std::string &element, const std::string &childName) const
Count the number of children with the given child name or -1 if no such element path is present.
void request32bppDepth(int width, int height)
Asks for 32bpp depth data to be sent from Minecraft for the agent.
int getVideoChannels(int role) const
Returns the number of channels in the requested video for one of the agents involved in this mission.
void rewardForReachingPosition(float x, float y, float z, float amount, float tolerance)
Asks for a reward to be sent to the agent when it reaches a certain position.
std::string getSummary() const
Returns the short description of the mission.
void startAt(float x, float y, float z)
Sets the start location for the agent.
void setModeToCreative()
Sets the player mode for the agent to creative, allowing them to fly and to not sustain damage....
void forceWorldReset()
Force Minecraft to reload the world rather than use the current one (if appropriate).
void allowAbsoluteMovementCommand(const std::string &verb)
Adds an allow-list to the absolute movement command handler if none present.
bool isLuminanceRequested(int role) const
Gets whether luminance video has been requested for one of the agents involved in this mission.
bool isColourMapRequested(int role) const
Gets whether colourmap video has been requested for one of the agents involved in this mission.
void drawItem(int x, int y, int z, const std::string &itemType)
Draw a Minecraft item in the world.
int getNumberOfAgents() const
Returns the number of agents involved in this mission.
void drawCuboid(int x1, int y1, int z1, int x2, int y2, int z2, const std::string &blockType)
Draw a solid cuboid in the world.
bool isVideoRequested(int role) const
Gets whether video has been requested for one of the agents involved in this mission.
void observeRecentCommands()
Asks for the list of commands acted upon since the last timestep to be returned in the observations.
void allowInventoryCommand(const std::string &verb)
Adds an allow-list to the inventory command handler if none present.
std::vector< std::string > getListOfCommandHandlers(int role) const
Returns a list of the names of the active command handlers for one of the agents involved in this mis...