Example #1
0
    def __init__(self, world=None, game_map=None, create_player=True, level_type=const.lvl_default):
        self.start_pos = None
        self.world = world
        self.game_map = game_map
        if world is None:
            self.world = esper.CachedWorld()
        if game_map is None:
            self._create_level(create_player, level_type)
        self.astar = tcod.path.AStar(self.game_map.walkable)

        self.processor_group = processor.PROCESSOR_GROUP
        self.change_processors('player_turn')

        self.fov_recompute = True
        self.message = collections.deque()
        self.action = {}
        self.mouse = tcod.Mouse()

        self.con = tcod.console.Console(
            width=const.MAP_WIDTH,
            height=const.MAP_HEIGHT
        )
        self._render_unexplored_map()

        self.panel = tcod.console.Console(
            width=const.SCREEN_WIDTH,
            height=const.PANEL_HEIGHT
        )
Example #2
0
def world():
    return esper.CachedWorld()
Example #3
0
def populated_world():
    pop_world = esper.CachedWorld()
    create_entities(pop_world, 2000)
    return pop_world
Example #4
0
##########################
def timing(f):
    def wrap(*args):
        time1 = time.process_time()
        ret = f(*args)
        time2 = time.process_time()
        current_run.append((time2 - time1) * 1000.0)
        return ret

    return wrap


##########################
# Create a World instance:
##########################
world = esper.CachedWorld()


#################################
# Define some generic components:
#################################
class Velocity:
    def __init__(self, x=0.0, y=0.0):
        self.x = x
        self.y = y


class Position:
    def __init__(self, x=0.0, y=0.0):
        self.x = x
        self.y = y
Example #5
0
# Simple timing decorator:
##########################
def timing(f):
    def wrap(*args):
        time1 = time.time()
        ret = f(*args)
        time2 = time.time()
        result_times.append((time2 - time1)*1000.0)
        return ret
    return wrap


##############################
#  Instantiate the game world:
##############################
world = esper.CachedWorld() if '--use-cache' in sys.argv[1:] else esper.World()


#################################
# Define some generic components:
#################################
class Velocity:
    def __init__(self):
        self.x = 0
        self.y = 0


class Position:
    def __init__(self):
        self.x = 0
        self.y = 0