#VS2017 – Commands with the basic movements for an #Minecraft Agent with #ProjectMalmo

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.

2017 11 19 Malmo Movements 01.gif

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

 

#VS2017 – Comandos con los movimientos básicos en un Agente #Minecraft con #ProjectMalmo

Buenas!

Hoy mostrare como realizar 2 movimientos básicos con un Agente en Minecraft

  • Avanzar
  • Girar

El ejemplo de código al final del post, representa una ConsoleApp, que una vez conectado al host Minecraft, adelanta una serie de pasos, luego gira y vuelve a adelantar. Ejemplo en modo gráfico.

2017 11 19 Malmo Movements 01.gif

Pues bien, los comandos que usamos son

  • Avanzar > “move {1}”
  • Girar > “turn {1}”

Donde el primer parámetro es un entero entre 0 y 1 que define el movimiento a realizar. Estos 2 comandos son los mínimos que podemos utilizar en escenarios como por ejemplo un laberinto, así que tiene sentido que el siguiente post hable de eso.

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

Saludos @ Toronto

El Bruno

References