class StoneWall(Tile): generation_parameters = GenerationProfile( fabrication = GenerationParameter(0.5, dropoff=1.5), shelter = GenerationParameter(0.3, dropoff=1.2), opulence = GenerationParameter(0.0) ) def tile_id(self): return 'env-stone-wall' def generate(self, *_): random_gray = random.uniform(130, 180) return [int(random_gray) for x in range(3)] + [1]
class Cobblestone(Tile): BaseAlias = 'cobblestone' generation_parameters = GenerationProfile( fabrication=GenerationParameter(0.8), shelter=GenerationParameter(0.3), opulence=GenerationParameter(0.3)) def tile_id(self): return 'env-cobblestone' def generate(self, *_): random_gray = random.uniform(20, 130) return [int(random_gray) for x in range(3)] + [1]
class StoneFloor(Tile): BaseAlias = 'a stone floor' generation_parameters = GenerationProfile( fabrication = GenerationParameter(0.5, dropoff=1.5), shelter = GenerationParameter(0.3, dropoff=1.2), opulence = GenerationParameter(0.0) ) def tile_id(self): return 'env-stone-floor' def generate(self, *_): random_gray = random.uniform(100, 150) return [int(random_gray) for x in range(3)] + [1]
class Snow(Tile): BaseAlias = 'fresh snow' generation_parameters = GenerationProfile( precipitation=GenerationParameter(1.0, strength=2), temperature=GenerationParameter(-0.8, dropoff=3, strength=2), fabrication=GenerationParameter(-0.5), shelter=GenerationParameter(-1.0, dropoff=4.0)) def tile_id(self): return 'env-snow' def generate(self, *_): random_gray = random.uniform(225, 250) return [int(random_gray) for x in range(3)] + [1]
class StoneBricks(Tile): BaseAlias = 'a masoned stone wall' generation_parameters = GenerationProfile( fabrication=GenerationParameter(0.8), shelter=GenerationParameter(0.3), opulence=GenerationParameter(0.3)) def tile_id(self): return 'env-stone-brick-wall' def generate(self, loc, total_dimensions): if (loc[1] + 1) % 3 and (loc[1] + loc[0]) % 6: random_gray = int(random.uniform(160, 180)) else: random_gray = int(random.uniform(130, 150)) return [random_gray, random_gray, random_gray] + [1]
class FrozenGrass(Tile): BaseAlias = 'frozen grass' generation_parameters = GenerationProfile( ambient_water=GenerationParameter(0.3), precipitation=GenerationParameter(-0.3), temperature=GenerationParameter(-0.9, dropoff=4, strength=5), fertility=GenerationParameter(1.0, dropoff=1.5), barrenness=GenerationParameter(-0.8), altitude=GenerationParameter(0.3), fabrication=GenerationParameter(-0.2), shelter=GenerationParameter(-1.0, dropoff=0.5)) def tile_id(self): return 'env-frozen-grass' def generate(self, *_): random_red = int(random.uniform(20, 40)) random_green = int(random.uniform(80, 130)) random_blue = int(random.uniform(60, 100)) return [random_red, random_green, random_blue] + [1]
class Sand(Tile): BaseAlias = 'loose sand' generation_parameters = GenerationProfile( ambient_water=GenerationParameter(-0.2), precipitation=GenerationParameter(-0.7), temperature=GenerationParameter(0.7), fertility=GenerationParameter(-1.0, dropoff=2.5), fabrication=GenerationParameter(-0.8, dropoff=2.0), shelter=GenerationParameter(-1.0, dropoff=4.0), barrenness=GenerationParameter(0.5), ) def tile_id(self): return 'env-sand' def generate(self, *_): random_red = int(random.uniform(210, 220)) random_green = int(random.uniform(160, 180)) random_blue = int(random.uniform(80, 100)) return [random_red, random_green, random_blue] + [1]
class Tiles(Tile): generation_parameters = GenerationProfile( temperature=GenerationParameter(0.2), fabrication=GenerationParameter(1.0, dropoff=1.5), shelter=GenerationParameter(1.0, dropoff=5), opulence=GenerationParameter(0.8)) def tile_id(self): return 'env-tiled-floor' def generate(self, loc, total_dimensions): if (loc[0] >= math.floor(total_dimensions[0] / 2)) ^ ( loc[1] >= math.floor(total_dimensions[1] / 2)): random_red = int(random.uniform(200, 250)) random_green = random_red random_blue = random_red else: random_red = int(random.uniform(50, 100)) random_green = random_red random_blue = random_red return [random_red, random_green, random_blue] + [1]
class Grass(Tile): BaseAlias = 'foot-tall grass' generation_parameters = GenerationProfile( ambient_water=GenerationParameter(0.5), precipitation=GenerationParameter(0.1), temperature=GenerationParameter(0.6), fertility=GenerationParameter(1.0, dropoff=1.5, strength=2), barrenness=GenerationParameter(-1.0, dropoff=0.5), altitude=GenerationParameter(0.3), fabrication=GenerationParameter(-0.2), shelter=GenerationParameter(-1.0, dropoff=0.5)) def tile_id(self): return 'env-grass' def generate(self, *_): random_red = int(random.uniform(40, 60)) random_green = int(random.uniform(130, 160)) random_blue = int(random.uniform(30, 60)) return [random_red, random_green, random_blue] + [1]
class Dirt(Tile): BaseAlias = 'a patch of dirt' generation_parameters = GenerationProfile( precipitation = GenerationParameter(-0.2), ambient_water = GenerationParameter(-0.2), temperature = GenerationParameter(0.0), fertility = GenerationParameter(-0.8, dropoff=2.0), altitude = GenerationParameter(-0.1), fabrication = GenerationParameter(-0.8, dropoff=5.0), shelter = GenerationParameter(-0.8, dropoff=2.0) ) def tile_id(self): return 'env-dirt' def generate(self, *_): random_red = int(random.uniform(100, 150)) random_green = int(random.uniform(60, 80)) random_blue = int(random.uniform(00, 10)) return [random_red,random_green,random_blue] + [1]
class Pine(Tile): BaseAlias = 'a pine tree' generation_parameters = GenerationProfile( precipitation=GenerationParameter(1.0, strength=2), temperature=GenerationParameter(-0.8, dropoff=3, strength=2), fabrication=GenerationParameter(-0.5), shelter=GenerationParameter(-1.0, dropoff=4.0)) def tile_id(self): return 'env-pine-tree' def build_generator(self, dimensions, *_): h, w = dimensions circles = list(Pine.get_circles(dimensions)) for x in range(h): for y in range(w): scalar = sum((x, y) in circle for circle in circles) if not scalar: random_red = int(random.uniform(1, 20)) random_green = int(random.uniform(35, 60)) random_blue = int(random.uniform(1, 10)) else: random_red = int(random.uniform(1, 30 + 20 * scalar)) random_green = int( random.uniform(40 + 20 * scalar, 70 + 23 * scalar)) random_blue = int( random.uniform(5 + 20 * scalar, 20 + 40 * scalar)) yield Tile.rgba(*[random_red, random_green, random_blue, 1.0]) def get_circles(dimensions): h, w = dimensions x0 = w / 2 y0 = h / 2 radius = int(w / 2) for offset in [2, 3, 3]: radius -= offset x0 -= offset y0 += offset yield list(Distance.points_in_circle(radius, (x0, y0)))
class SandStoneBricks(Tile): generation_parameters = GenerationProfile( ambient_water=GenerationParameter(-0.2), precipitation=GenerationParameter(-0.7), temperature=GenerationParameter(0.7), fertility=GenerationParameter(-1.0, dropoff=2.5), fabrication=GenerationParameter(-0.8, dropoff=2.0), shelter=GenerationParameter(-1.0, dropoff=4.0), barrenness=GenerationParameter(0.5), ) def tile_id(self): return 'env-sandstone-brick-wall' def generate(self, loc, total_dimensions): if (loc[1] + 1) % 2 and (loc[1] + loc[0]) % 4: random_red = int(random.uniform(210, 220)) random_green = int(random.uniform(160, 180)) random_blue = int(random.uniform(80, 100)) else: random_red = int(random.uniform(150, 190)) random_green = int(random.uniform(120, 140)) random_blue = int(random.uniform(60, 80)) return [random_red, random_green, random_blue] + [1]
class WoodFloor(Tile): BaseAlias = 'wood flooring' generation_parameters = GenerationProfile( temperature = GenerationParameter(0.1), fabrication = GenerationParameter(0.5, dropoff=1.5), shelter = GenerationParameter(0.3, dropoff=1.2), opulence = GenerationParameter(-0.3) ) def tile_id(self): return 'env-wood-floor' def generate(self, loc, total_dimensions): if loc[0] % 4: random_red = int(random.uniform(100, 130)) random_green = int(random.uniform(80, 100)) random_blue = int(random.uniform(35, 55)) else: random_red = int(random.uniform(90, 110)) random_green = int(random.uniform(50, 80)) random_blue = int(random.uniform(0, 10)) return [random_red,random_green,random_blue] + [1]