Example #1
0
def start_mission():
    miss = mb.MissionXML()
    colourmap_producer = mb.ColourMapProducer(width=WIDTH, height=HEIGHT)
    video_producer = mb.VideoProducer(width=WIDTH, height=HEIGHT, want_depth=False)
    colourmap_producer = None

    obs = mb.Observations()
    agent_handlers = mb.AgentHandlers(observations=obs)

    agent_handlers = mb.AgentHandlers(observations=obs,
        colourmap_producer=colourmap_producer,
        video_producer=video_producer)

    miss = mb.MissionXML(agentSections=[mb.AgentSection(name='Cristina',
             agenthandlers=agent_handlers)])
    
    # seed 28 - with a see
    world = mb.defaultworld(
        seed='28',
        forceReset="false")

    
    miss.setWorld(world)
    miss.serverSection.initial_conditions.allowedmobs = "Pig Sheep Cow Chicken Ozelot Rabbit Villager"
    # disable passage of time:
    miss.serverSection.initial_conditions.time_pass = '******'
    miss.serverSection.initial_conditions.time_start = "1000"

    mc = MalmoConnector(miss)
    obs1 = RobustObserverWithCallbacks(mc)
    return mc, obs1
Example #2
0
def init_mission(mc, start_x=None, start_y=None):
    want_depth = False
    video_producer = mb.VideoProducer(width=320 * 4,
                                      height=240 * 4,
                                      want_depth=want_depth)

    obs = mb.Observations()
    obs.gridNear = [[-1, 1], [-2, 1], [-1, 1]]

    agent_handlers = mb.AgentHandlers(observations=obs,
                                      video_producer=video_producer)

    print('starting at ({0}, {1})'.format(start_x, start_y))

    #miss = mb.MissionXML(namespace="ProjectMalmo.microsoft.com",
    miss = mb.MissionXML(agentSections=[
        mb.AgentSection(
            name='Cristina',
            agenthandlers=agent_handlers,
            #    depth
            agentstart=mb.AgentStart([start_x, 74.0, start_y, 1]))
    ])
    flat_json = {
        "biome": "minecraft:plains",
        "layers": [{
            "block": "minecraft:diamond_block",
            "height": 1
        }],
        "structures": {
            "structures": {
                "village": {}
            }
        }
    }

    flat_param = "3;7,25*1,3*3,2;1;stronghold,biome_1,village,decoration,dungeon,lake,mineshaft,lava_lake"
    flat_json = json.dumps(flat_json).replace('"', "%ESC")
    world = mb.defaultworld(seed='5', forceReuse="true", forceReset="false")
    flat_world = mb.flatworld(
        flat_json,
        seed='43',
    )
    miss.setWorld(world)
    miss.serverSection.initial_conditions.allowedmobs = "Pig Sheep Cow Chicken Ozelot Rabbit Villager"
    # uncomment to disable passage of time:
    miss.serverSection.initial_conditions.time_pass = '******'
    miss.serverSection.initial_conditions.time_start = "1000"

    if mc is None:
        mc = MalmoConnector(miss)
        obs = RobustObserver(mc)
    else:
        mc.setMissionXML(miss)
    return mc, obs
Example #3
0
def start_mission():
    miss = mb.MissionXML()
    colourmap_producer = mb.ColourMapProducer(width=WIDTH, height=HEIGHT)
    video_producer = mb.VideoProducer(width=WIDTH,
                                      height=HEIGHT,
                                      want_depth=False)

    obs = mb.Observations()
    agent_handlers = mb.AgentHandlers(observations=obs)

    agent_handlers = mb.AgentHandlers(observations=obs,
                                      colourmap_producer=colourmap_producer,
                                      video_producer=video_producer)

    miss = mb.MissionXML(agentSections=[
        mb.AgentSection(
            name='Cristina',
            agenthandlers=agent_handlers,
        )
    ])
    # agenthandlers=agent_handlers,)], namespace='ProjectMalmo.microsoft.com')

    # good point seed='2', x=-90, y=71, z=375
    # good point seed='3', x=6, y=71, z=350
    # good point seed='31'
    world = mb.defaultworld(seed='5', forceReset="true")

    world1 = mb.flatworld(
        "3;7,25*1,3*3,2;1;stronghold,biome_1,village,decoration,dungeon,lake,mineshaft,lava_lake",
        seed='43',
        forceReset="false")
    miss.setWorld(world)
    miss.serverSection.initial_conditions.allowedmobs = "Pig Sheep Cow Chicken Ozelot Rabbit Villager"
    # uncomment to disable passage of time:
    miss.serverSection.initial_conditions.time_pass = '******'
    miss.serverSection.initial_conditions.time_start = "1000"
    mc = MalmoConnector(miss)
    obs1 = RobustObserver(mc)
    return mc, obs1
Example #4
0
    SCALE = 3
    setup_logger()
    visualizer = Visualizer()
    visualizer.start()
    video_producer = mb.VideoProducer(width=320 * SCALE,
                                      height=240 * SCALE,
                                      want_depth=False)
    agent_handlers = mb.AgentHandlers(video_producer=video_producer)
    miss = mb.MissionXML(agentSections=[
        mb.AgentSection(
            name='Robo',
            agenthandlers=agent_handlers,
        )
    ])

    world = mb.defaultworld(forceReset="true", seed="151")
    #113 122 127? 128 129+? 130+? 131+?
    miss.setWorld(world)

    agent = Explorer(miss, visualizer=visualizer)
    sleep(4)
    agent.run()
    '''
    rob = agent.rob
    skb = StaticKnowledge(rob)
    for i in range(600):
        sleep(0.2)
        rob.observeProcCached()
        skb.update()
        if skb.novelty_list != []:
            print(skb.novelty_list)
Example #5
0
    # create console handler and set level to debug
    ch = logging.StreamHandler()
    ch.setFormatter(formatter)
    ch.setLevel(logging.DEBUG)
    # add ch to logger
    logger.addHandler(ch)


if __name__ == '__main__':
    setup_logger()
    visualizer = Visualizer()
    visualizer.start()
    video_producer = mb.VideoProducer(width=320 * SCALE, height=240 * SCALE, want_depth=False)
    agent_handlers = mb.AgentHandlers(video_producer=video_producer)
    miss = mb.MissionXML(agentSections=[mb.AgentSection(name='Cristina',
             agenthandlers=agent_handlers,)])


    world = mb.flatworld("3;7,25*1,3*3,2;1;stronghold,biome_1,village,decoration,dungeon,lake,mineshaft,lava_lake", seed='43', forceReset="false")
    miss.serverSection.initial_conditions.time_pass = '******'
    miss.serverSection.initial_conditions.time_start = "1000"
    world1 = mb.defaultworld(forceReset="true")
    miss.setWorld(world1)
    # miss.serverSection.initial_conditions.allowedmobs = "Pig Sheep Cow Chicken Ozelot Rabbit Villager"
    agent = LJAgent(miss, visualizer=visualizer)
    agent.rob.sendCommand("chat /difficulty peaceful")
    # agent.loop()
    agent.loop(target = {'type': 'wooden_pickaxe'})

    visualizer.stop()