Пример #1
0
    def make_world(self):
        world = World()

        # set any world properties first
        num_humans = 2
        num_zombies = 5
        num_agents = num_humans + num_zombies

        # add agents
        agents = []
        # add humans' team
        for i in range(num_humans):
            agent = Agent()
            agent.collide = True
            agent.team = 0
            agent.name = 'human %d' % i
            agent.size = 0.05
            agent.accel = 4.0
            agent.max_speed = 1.3
            agent.health_decay = 0.99

            # weapons
            agent.armed = True
            agent.arms_reload_time = 0.2
            agent.arms_pallet_count = 2
            agent.arms_pallet_damage = 0.2
            agent.arms_pallet_range = 3
            agent.arms_pallet_spread = 3 / 360.0 * 2 * np.pi

            agents.append(agent)
        # add zombies' team
        for i in range(num_zombies):
            agent = Agent()
            agent.collide = True
            agent.team = 1
            agent.name = 'zombie %d' % i
            agent.size = 0.05
            agent.accel = 3.0
            agent.max_speed = 1.0
            agents.append(agent)
        world.agents = agents

        # make initial conditions
        self.reset_world(world)

        return world
Пример #2
0
    def make_world(self):
        world = World()

        # set any world properties first
        num_humans = 2
        num_zombies = 5
        num_agents = num_humans + num_zombies

        # add agents
        agents = []
        # add humans' team
        for i in range(num_humans):
            agent = Agent()
            agent.collide = True
            agent.team = 0
            agent.name = 'human %d' % i
            agent.size = 0.05
            agent.accel = 4.0
            agent.max_speed = 1.3
            agent.health_decay = 0.99
            agents.append(agent)
        # add zombies' team
        for i in range(num_zombies):
            agent = Agent()
            agent.collide = True
            agent.team = 1
            agent.name = 'zombie %d' % i
            agent.size = 0.05
            agent.accel = 3.0
            agent.max_speed = 1.0
            agents.append(agent)
        world.agents = agents

        # make initial conditions
        self.reset_world(world)

        return world