Hi!
Today I will share how to perform 2 basic Agent movements in Minecraft
- Move along
- Turn
The code example at the end of the post, is part of a ConsoleApp, which once connected to the Minecraft host, controls the movement of the current player / agent. The script advances a series of steps, then turns and returns to the advance mode again and again. Animation sample.
The basic set of commands are
- Move > “move {1}”
- Turn > “turn {1}”
Where the first parameter is an integer between 0 and 1 that defines the movement to be performed. These 2 commands are the minimum we can use in scenarios such as a labyrinth, so it makes sense that the next post talk about it.
namespace Malmo06 | |
{ | |
class Program | |
{ | |
private static AgentHost _agentHost; | |
private static MissionSpec _mission; | |
private static MissionRecordSpec _missionRecord; | |
private static WorldState _worldState; | |
public static void Main() | |
{ | |
InitAgentHost(); | |
InitMissionSpecs(); | |
StartMission(); | |
WaitMissionToStart(); | |
Console.WriteLine("Mission in progress !"); | |
Console.WriteLine(); | |
int i = 0; | |
do | |
{ | |
i++; | |
var command = "move 0.5"; | |
if (i > 3) | |
{ | |
i = 0; | |
command = "turn 0.5"; | |
_agentHost.sendCommand(command); | |
Thread.Sleep(500); | |
command = "turn 0"; | |
_agentHost.sendCommand(command); | |
Thread.Sleep(500); | |
} | |
else | |
{ | |
_agentHost.sendCommand(command); | |
Thread.Sleep(1000); | |
} | |
Console.WriteLine($"{i} – command: {command}"); | |
// Move | |
} while (_worldState.is_mission_running); | |
Console.WriteLine("Mission has stopped."); | |
} |
Sample Project en GitHub link
Greetings @ Toronto
El Bruno
References
- El Bruno, Minecraft missions options in Xml format Project Malmo
- El Bruno, Sample ConsoleApp to initialize missions in Minecraft using an Xml file definition
- El Bruno, Definition of Minecraft missions in Xml format
- El Bruno, Minecraft game interaction agents, missions definitions and recording with Project Malmo
- El Bruno, Learning to code with Minecraft? start with Hour of Code, MakeCode and Project Malmo
- Malmo, GitHub Home
- Malmo Mission Xml Schema
- Malmo Mission Xml Weather
- Superflat Preset Generator