示例#1
0
    def __init__(self):

        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the texture of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.world = {}

        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}

        # Mapping from position to a pyglet `VertextList` for all shown blocks.
        self._shown = {}

        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
        self.queue = deque()

        self._initialize()
示例#2
0
    def __init__(self):

        # Collection of vertex lists to render in batches
        self.batch = pyglet.graphics.Batch()

        # A group to manage the OpenGL texture
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A ObjRelMap from player position to the texture of the indicated block
        # at that position - this holds all the blocks currently sitting in the world
        self.world = {}

        # Same as above - but only holds the blocks that are visible
        self.shown = {}

        # ObjRelMap from player position to a pyglet VertexList for all visible blocks
        self._shown = {}

        # ObjRelMap from current sector to a list of coordinate positions
        # within that sector.
        self.sectors = {}

        # A simplistic function to queue implementation. This is populated with
        # _show_block() and _hide_block() calls
        self.queue = dequeue()

        self._initialize()
示例#3
0
    def __init__(self):

        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the instance of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.world = {}

        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}

        # Mapping from position to a pyglet `VertexList` for all shown blocks.
        self._shown = {}

        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        # A list of blocks the player can place. Hit num keys to cycle.
        self.inventory = [BRICK, GRASS, SAND, PATH]

        # The current block the user can place. Hit num keys to cycle.
        self.block = self.inventory[0]

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
        self.queue = deque()

        self.generate_terrain()
示例#4
0
    def __init__(self):

        self.WORLDSIZE = 100
        self.MIN_Y = -20
        self.MOUNTHEIGHT = 2
        #Generator blocks
        self.GRASS_BLOCK = GRASS
        self.DIRT_BLOCK = DIRT
        self.STONE_BLOCK = STONE
        self.BEDROCK_BLOCK = BEDROCK
        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the texture of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.world = {}
        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}
        self.position = (0,100,0)
        # Mapping from position to a pyglet `VertextList` for all shown blocks.
        self._shown = {}

        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
        self.queue = deque()
        self.blockname = "BRICKS"
示例#5
0
    def __init__(self, path):
        self.atlas = TextureAtlas()
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
        self.group = TextureGroup(self.atlas.texture)

        for image in os.listdir(path):
            setattr(self, image[:-4], self.add(os.path.join(path, image)))
示例#6
0
 def __init__(self, game):
     self.game = game
     self.batch = Batch()
     self.group = TextureGroup(self.game.textures.texture)
     self.sector = None
     self.overlay = None
     self.rendered = {}
     self.queue = deque()
示例#7
0
 def __init__(self):
     self.batch = pyglet.graphics.Batch()
     self.group = TextureGroup(image.load(txt_path).get_texture())
     self.world = {}
     self.shown = {}
     self._shown = {}
     self.sectors = {}
     self.queue = deque()
     self._initialize()
示例#8
0
 def __init__(self, initialPos):
     self.batch = pyglet.graphics.Batch() # A collection of vertex lists for batched rendering.
     self.group = TextureGroup(image.load(Constants.TEXTURE_PATH).get_texture()) # A TextureGroup manages an OpenGL texture.
     self.blockSet = {}              # A mapping from position to the texture of the block at that position. Defines all blocks currently in the world
     self.shownBlocks = {}           # Same mapping as `self.blockSet` but only contains blocks that are shown.
     self._shown = {}                # Mapping from position to a pyglet `VertextList` for all shown blocks.
     self.sectors = {}               # Mapping from sector to a list of positions inside that sector.
     self.queue = deque()            # Create queue to manage function calls to keep game running smooth. The queue is populated with_showBlock() and _hideBlock() calls.
                                     # self.queue is not a necessary feature but helps to improve game performance.
     self.GenerateWorld(initialPos)
示例#9
0
    def __init__(self, top, bottom, side, nombre=None, tag=None, durable=1):
        self.texture = []
        self.tex_coords(top, bottom, side)
        self.nombre = nombre
        self.tag = tag
        self.__durabilidad = durable
        self.live = durable
        self.roto = False
        self.selected = False

        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
示例#10
0
    def __init__(self):

        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()
        self.hud_batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        texture = image.load(TEXTURE_PATH).get_texture() #possible to use image.load(file=filedescriptor) if necessary
        self.textured_normal_group = TextureGroup(texture, parent = normal_group) 
        self.textured_colorkey_group = TextureGroup(texture, parent = colorkey_group)

        self.shown = {} #{(position,face):vertex_list(batch_element)}
        self.chunks = Chunkdict()
        self.entities = {} #{entity_id: (vertex_list,...,...)}
        self.hud_elements = {} #{hud_element_id: (vertex_list,element_data,corners)}

        self.queue = deque()
        self.blockface_update_buffer = SetQueue()

        self.occlusion_cache = collections.OrderedDict()
示例#11
0
 def __init__(self, gp):
     self.count = 0
     self.batch = pyglet.graphics.Batch()
     self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
     self.world = {}
     self.shown = {}
     self._shown = {}
     self.sectors = {}
     self.queue = deque()
     self._initialize()
     self.quadcopter = QuadCopter(gp)
示例#12
0
 def __init__(self, world=None):
     self.batch = pyglet.graphics.Batch()
     self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
     if world is None:
         world = {}
     self.world = world
     self.shown = {}
     self._shown = {}
     self.sectors = {}
     self.queue = deque()
     if not world:
         self._initialize()
示例#13
0
 def loadTexture(self, path):
     """ This function loads textures if necessary and returns them as a
          object
     """
     if not path in self._textures:
         self.log.debug("Loading texture: %s" % (path, ))
         try:
             self._textures[path] = TextureGroup(
                 image.load(path).get_texture())
         except Exception as e:
             self.log.error(e)
     return self._textures[path]
示例#14
0
    def __init__(self):

        self.batch = mbatch()  #pyglet.graphics.Batch()
        self.group = TextureGroup(
            image.load(TEXTURE_PATH).get_texture())  # 纹理列表
        self.world = {}  # 地图
        self.shown = {}  # 显示的方块
        self._shown = {}  # 显示的纹理
        self.pool = {}  # 水池
        self.sectors = {}
        self.areat = {}
        self.queue = deque()  # 指令队列
        print("Loading...")
        self.dfy = self._initialize()
        print("OK")
示例#15
0
    def __init__(self, gp):
        self.count = 0
        self.batch = pyglet.graphics.Batch()
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        self.world = {}
        self.sizes = {}
        self.colors = {}
        self.material = []
        self.volumes = {}

        self.shown = {}
        self._shown = {}
        self.sectors = {}
        self.queue = deque()
        self._initialize()
        self.camera = Camera(gp)
示例#16
0
    def __init__(self, rng, width, height, autocamera=False):
        self.rng = rng
        self.autocamera = autocamera

        self.overlay_batch = pyglet.graphics.Batch()
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
        self.path = {}

        self.width = width
        self.height = height
        self.window = pyglet.window.Window(width=width, height=height)
        #self.window.maximize()

        self.xoffset = 0
        self.yoffset = 0
        self.camera_distance = max(15, self.rng.gamma(shape=1, scale=100))
        self.camera_height = self.camera_distance * self.rng.rand() * 0.3
        self.camera_angle = (-180 + 360 * self.rng.rand())

        if self.autocamera:
            self._reset_moving_camera()

        self.rotation = (0, 0)
        self.boat_models = {}

        self.main_batch = pyglet.graphics.Batch()
        self.world = {}
        self.terrain_shape = {}
        self.element_type = {}
        self.shown = {}
        self._shown = {}
        self.position = (0, self.camera_height, 0)
        self.queue = deque()

        self.reset_world()

        self.label = pyglet.text.Label('',
                                       font_size=18,
                                       x=210,
                                       y=self.height - 10,
                                       anchor_x='left',
                                       anchor_y='top',
                                       color=(0, 0, 0, 255))

        glEnable(GL_BLEND)
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
示例#17
0
    def __init__(self, world=None):
        # Batch of pyglet VertexLists; everything loaded into the batch is drawn
        self.batch = Batch()

        # TextureGroup for managing OpenGL textures.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # All of the blocks in the world; key is a tuple of (x, y, z) position
        if world is None:
            self.world = {}
        else:
            self.world = world

        # Just the blocks that are visible, i.e. exposed on at least one side
        self.visible = {}

        # Mapping from position to a pyglet VertexList (only for visible blocks)
        self.vertices = {}

        # Mapping from chunks to block locations within those chunks.
        self.chunks = {}

        # The chunk in which the player is currently located.
        self.chunk = None

        # The player's position in the world, initially at the origin.
        self.position = (0, 2, 0)

        # The rotation of the player's view.
        # First element is in the xz plane, second in some rotation of the yz plane.
        # Up-down rotation is constrained to between -90 and 90 (straight up and down)
        self.rotation = (0, 0)

        # Initialize player motion in the xz plane.
        # For the first element, -1 and 1 are left and right.
        # For the second, -1 and 1 are down and up.
        # For the third, backwards and forwards.
        self.motion = [0, 0, 0]

        # A queue for function calls; this allows blocks to be added and removed
        # in a way that doesn't slow down the game loop
        self.queue = deque()

        # Place blocks in the world
        self._initialize()
示例#18
0
    def __init__(self):
        self.count = 0
        self.batch = pyglet.graphics.Batch()
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
        self.world = {}
        self.shown = {}
        self._shown = {}
        self.sectors = {}
        self.queue = deque()
        self.targets = 0

        maze = Maze3D(self)

        self.quadcopter = QuadCopter(self)
        self.quadcopter.position = (-15,-2,-2)
        self.quadcopter.angle = 90
        self.start = None
        self.time = ''
    def __init__(self):

        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the texture of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.world = {}

        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}

        # Mapping from position to a pyglet `VertextList` for all shown blocks.
        self._shown = {}

        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
        self.queue = deque()

        # True/False variable that tells the model class if the rocket has already
        # been loaded.  This prevents it from being loaded twice.
        self.rocket_loaded = False

        # True/False variable that tells the model class if the rocket has been
        # launched.
        self.rocket_launched = False

        # stores the altitude of the rocket
        self.rocket_altitude = 0

        # mode of the rocket "up" for going up and "down" for going down
        self.rocket_mode = "up"

        # Counts the number of calls to rocket_update. This variable will
        # help us slow down the update rate and keep frame rate high
        self.rocket_update_count = 0

        self._initialize()
示例#20
0
    def __init__(self):

        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the texture of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.world = {}

        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}

        # Mapping from position to a pyglet `VertextList` for all shown blocks.
        self._shown = {}

        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
        self.queue = deque()

        self.mob_loaded = False

        self.mob_mode = "1"

        self.mob_x_position = 0

        self.mob_z_position = 0

        #need for when jumping
        self.mob_y_position = -1

        self.mob_update_count = 0

        # AI for running or following
        self.ai = AI_class.AI()

        self._initialize()
示例#21
0
 def __init__(self, recorder, agent=None):
     self.started = False
     if agent:
         self.agent = agent
         self.recorder = agent.recorder
     else:
         self.agent = None
         self.recorder = recorder
     self.batch = pyglet.graphics.Batch()
     self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
     # A mapping from position to the texture of the block at that position.
     # This defines all the blocks that are currently in the world.
     self.world = {}
     # Same mapping as `world` but only contains blocks that are shown.
     self.shown = {}
     # Mapping from position to a pyglet `VertextList` for all shown blocks.
     self._shown = {}
     # Simple function queue implementation. The queue is populated with
     # _show_block() and _hide_block() calls
     self.queue = deque()
示例#22
0
    def __init__(self):

        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = pyglet.graphics.Batch()

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the texture of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.world = {}

        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}

        # Mapping from position to a pyglet `VertextList` for all shown blocks.
        self._shown = {}

        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
        self.queue = deque()
        world = 2
        """

        1 : Sh*t world generation
        2 : Perlin Noise minecraftlike generation
        3 : No water Perlin Generation
        """
        if world == 1 :
            self._initialize_1()
        elif world == 2 :
            self._initialize_2()
        elif world == 3 :
            self._initialize_3()
        elif world == 4 :
            self._initialize_4()
        elif world == 5 :
            self._initialize_5()
示例#23
0
    def __init__(self, scaler=None):
        self.settings = {
            'SECTOR_SIZE': 16,
            'WALKING_SPEED': 5,
            'FLYING_SPEED': 15,
            'GRAVITY': 20.0,
            'MAX_JUMP_HEIGHT': 1.0,
            'TERMINAL_VELOCITY': 50,
            'PLAYER_HEIGHT': 2,
            'FACES': {(0, 1, 0), (0, -1, 0), (-1, 0, 0), (1, 0, 0), (0, 0, 1),
                      (0, 0, -1)}
        }
        self.scaler = scaler
        self.batch = pyglet.graphics.Batch()
        self.group = TextureGroup(image.load(scaler.src).get_texture())
        self.world = {}
        self.shown = {}
        self._shown = {}
        self.sectors = {}
        self.queue = deque()

        self.__initialize()
示例#24
0
    def __init__(self):
        # A Batch is a collection of vertex lists for batched rendering.
        self.batch = Batch()
        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
        # A mapping from position to the texture of the block at that position.
        # This defines all the blocks that are currently in the world.
        self.objects = {}
        # Same mapping as `world` but only contains blocks that are shown.
        self.shown = {}
        # Mapping from position to a pyglet `VertextList` for all shown blocks.
        self._shown = {}
        # Which sector the player is currently in.
        self.sector = None
        # Mapping from sector to a list of positions inside that sector.
        self.sectors = {}

        self.shader = None
        self.show_hide_queue = OrderedDict()
        self.init_gl()
        #       self._initialize()
        self.init_shader()
示例#25
0
文件: world.py 项目: tsukori/pycraft
    def _show_block(self, position, block):
        """Private implementation of the `show_block()` method.

        Parameters
        ----------
        position : tuple of len 3
            The (x, y, z) position of the block to show.
        texture : list of len 3
            The coordinates of the texture squares. Use `tex_coords()` to
            generate.
        """
        x, y, z = position
        vertex_data = cube_vertices(x, y, z, 0.5)
        shade_data = cube_shade(1, 1, 1, 1)
        texture_data = block.texture
        if block.identifier not in self.texture_group:
            self.texture_group[block.identifier] = TextureGroup(
                image.load(block.texture_path).get_texture())
        self._shown[position] = self.batch.add(
            24, GL_QUADS, self.texture_group[block.identifier],
            ('v3f/static', vertex_data), ('c3f/static', shade_data),
            ('t2f/static', texture_data))
示例#26
0
文件: world.py 项目: spillz/minepy
    def __init__(self):

        # A TextureGroup manages an OpenGL texture.
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
        
        mapgen.initialize_map_generator()

        # The world is stored in sector chunks.
        self.sectors = {}
        self.sector_lock = threading.Lock()
        self.thread = None

        # Simple function queue implementation. The queue is populated with
        # _show_block() and _hide_block() calls
#        self.queue = deque()

        d = range(-SECTOR_SIZE,SECTOR_SIZE+1,SECTOR_SIZE)
        #d = range(-128,128+1,SECTOR_SIZE)
        for pos in itertools.product(d,(0,),d):
            s=Sector(pos, self.group, self)
            self.sectors[sectorize(pos)] = s
            s._initialize()
        for s in self.sectors:
            self.sectors[s].check_show()
示例#27
0
文件: minecraft.py 项目: adhamaa/Lab
    def __init__(self, gp):
        self.count = 0
        self.batch = pyglet.graphics.Batch()
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())
        self.world = {}
        self.shown = {}
        self._shown = {}
        self.sectors = {}
        self.queue = deque()
        self.targets = 0

        if GAME == 0:
            self._initialize()
        elif GAME == 30:
            maze = Maze3D(self)
        else:
            self.sponge(0,0,0,GAME)

        self.quadcopter = QuadCopter(gp, self)
        #self.quadcopter.position = (-3,-2,-2)
        #self.quadcopter.position = (-12,-2,-2)
        #self.quadcopter.angle = 90
        self.start = None
        self.time = ''
示例#28
0
 def __init__(self, name):
     # Batch 是用于批处理渲染的顶点列表的集合
     self.batch3d = pyglet.graphics.Batch()
     # 为了分开绘制3D物体和2D的 HUD, 我们需要两个 Batch
     self.batch2d = pyglet.graphics.Batch()
     # 纹理的集合
     self.group = TextureGroup(
         image.load(os.path.join(path['texture'],
                                 'block.png')).get_texture())
     # 存档名
     self.name = name
     # world 存储着世界上所有的方块
     self.world = {}
     # 类似于 world, 但它只存储要显示的方块
     self.shown = {}
     # Mapping from position to a pyglet `VertextList` for all shown blocks.
     self._shown = {}
     # 记录玩家改变的方块
     self.change = {}
     # Mapping from sector to a list of positions inside that sector.
     self.sectors = {}
     # Simple function queue implementation. The queue is populated with
     # _show_block() and _hide_block() calls
     self.queue = deque()
示例#29
0
    def __init__(self,
                 drone_3d_model,
                 horizon_view_size=8,
                 init_drone_z=5,
                 task='no_collision',
                 debug_mode=False):
        self.task = task
        self.debug_mode = debug_mode

        # When increase this, show more blocks in current view window
        self.horizon_view_size = horizon_view_size

        # A Batch is a collection of vertex lists for batched rendering
        self.batch = Batch()

        # Manages an OpenGL texture
        self.group = TextureGroup(image.load(TEXTURE_PATH).get_texture())

        # A mapping from position to the texture for whole, global map
        self.whole_map = dict()

        # Same as `whole_map` but only contains the positions to show
        self.partial_map = dict()

        # A mapping from position to a pyglet `VertextList` in `partial_map`
        self._partial_map = dict()

        # A mapping from sector to a list of positions (contiguous sub-region)
        # using sectors for fast rendering
        self.sectors = dict()

        # Use deque to populate calling of `_show_block` and `_hide_block`
        self.queue = deque()

        # A graphics batch to draw drone 3D model
        self.drone_batch = pyglet.graphics.Batch()
        # Load drone triangular mesh and scene
        self.drone_name = os.path.basename(drone_3d_model)
        self.drone_mesh = trimesh.load(drone_3d_model)
        self.drone_scene = self.drone_mesh.scene()
        # Drawer stores drone scene geometry as vertex list in its model space
        self.drone_drawer = None
        # Store drone geometry hashes for easy retrival
        self.drone_vertex_list_hash = ''
        # Store drone geometry rendering mode, default gl.GL_TRIANGLES
        self.drone_vertex_list_mode = gl.GL_TRIANGLES
        # Store drone geometry texture
        self.drone_texture = None

        black = np.array([0, 0, 0, 255], dtype=np.uint8)
        red = np.array([255, 0, 0, 255], dtype=np.uint8)
        green = np.array([0, 255, 0, 255], dtype=np.uint8)
        blue = np.array([0, 0, 255, 255], dtype=np.uint8)
        for i, facet in enumerate(self.drone_mesh.facets):
            if i < 30:
                self.drone_mesh.visual.face_colors[facet] = black
            elif i < 42:
                self.drone_mesh.visual.face_colors[facet] = red
            elif i < 54:
                self.drone_mesh.visual.face_colors[facet] = green
            elif i < 66:
                self.drone_mesh.visual.face_colors[facet] = blue
            else:
                self.drone_mesh.visual.face_colors[facet] = black

        # Mark positions of bounding wall and obstacles in the map
        self._initialize(init_drone_z)
示例#30
0
    def __init__(self, given={}):
        #Process settings from the menu and create an object with the appropriate properties
        self.TEXTURES = (calcTextureCoords(1), calcTextureCoords(2),
                         calcTextureCoords(3), calcTextureCoords(4),
                         calcTextureCoords(5), calcTextureCoords(6),
                         calcTextureCoords(7), calcTextureCoords(8),
                         calcTextureCoords(9))
        self.TEXTURE_COLORS = (None, (128, 255, 255, 255),
                               (128, 180, 255, 255), (204, 128, 255, 255))

        self.LOGENABLED = False
        self.LOG = ""
        if "PROX" in given: self.PROX = given["PROX"]
        else: self.PROX = True
        if given["PROX_RANGE"]: self.PROX_RANGE = int(given["PROX_RANGE"])
        else: self.PROX_RANGE = 5
        self.ROOT_COST = 10
        if "FORK" in given: self.FORK_COST = given["FORK"] * self.ROOT_COST
        else: self.FORK_COST = 50
        if "STARTE" in given:
            self.INIT_ENERGY = given["STARTE"] * self.ROOT_COST
        else:
            self.INIT_ENERGY = 500
        if "REWARD" in given:
            self.ENERGY_REWARD = given["REWARD"] * self.ROOT_COST
        else:
            self.ENERGY_REWARD = 20

        if "GOAL" in given: self.GOAL = given["GOAL"] * self.ROOT_COST
        else: self.GOAL = 20

        if "REPLAY" in given: self.REPLAY = given["REPLAY"]
        else: self.REPLAY = False
        if "REPLAYFILE" in given: self.REPLAY_FILE = given["REPLAYFILE"]
        else: self.REPLAY_FILE = "logfile"

        self.TEXTURE_PATH = "roots.png"
        self.LOGNUTRIENTSTART = False

        self.TICKS_PER_SEC = 60

        self.textureGroup = TextureGroup(
            image.load(self.TEXTURE_PATH).get_texture())

        self.FACES = [
            (0, 1, 0),
            (0, -1, 0),
            (-1, 0, 0),
            (1, 0, 0),
            (0, 0, 1),
            (0, 0, -1),
        ]
        self.LATFACES = [(-1, 0, 0), (1, 0, 0), (0, 0, 1), (0, 0, -1)]
        self.ABSORB = (self.TEXTURES[5], self.TEXTURES[6], self.TEXTURES[7],
                       self.TEXTURES[8], self.TEXTURES[2])
        self.STALK_TEXTURE = calcTextureCoords(0)
        self.FLOWER_TEX = self.TEXTURES[3]
        self.FLOWER_CENTER = self.TEXTURES[1]
        self.NUTRIENT_TEXTURE = self.TEXTURES[4]
        #the lower function makes a lowercase string
        if given["mode"].lower() == "2D mode": self.TWODMODE = True
        else: self.TWODMODE = False
        if given["DENSITY"]: self.DENSITY = given["DENSITY"]
        else: self.DENSITY = 5
        if given["CLUSTER"]: self.CLUSTER = given["CLUSTER"]
        else: self.CLUSTER = 5
        if given["CLUSTERP"]: self.CLUSTERP = int(given["CLUSTERP"])
        else: self.CLUSTERP = 3
        if given["CLUSTERTYPE"]: self.CLUSTERTYPE = given["CLUSTERTYPE"]
        else: self.CLUSTERP = "None"
        if given["players"]: self.players = given["players"]
        else: self.players = ["Human Player", "RandomPlayer"]
        if given["whatdo"]:
            if given["whatdo"] == 'Play':
                self.whatdo = 0
            if given["whatdo"] == 'CPU best of 100':
                self.whatdo = 1
            if given["whatdo"] == 'Breeding':
                self.whatdo = 2
        else:
            self.whatdo = 0