def setup(self):
self.create_gui()
# Clear out the event log
with open('event_log.txt', 'w') as f:
f.write('')
size = utility.S_WIDTH // utility.CELL_SIZE
data = noise.generate_noise(size, 'Generating terrain: ')
print('')
cells_x = utility.S_WIDTH // utility.CELL_SIZE
cells_y = utility.S_HEIGHT // utility.CELL_SIZE
for x in xrange(cells_x):
self.cells.append([])
for y in xrange(cells_y):
utility.show_bar(x * cells_y + y, cells_x * cells_y, message='Generating world: ', number_limit=True)
self.cells[-1].append(terrain.Cell(self, '', x, y, data[x][y], random.random()**6, 0, None))
print('')
self.weather = terrain.Weather(self.cells, self)
self.weather.run(10)
for x, row in enumerate(self.cells):
for y, cell in enumerate(row):
cell.terrain.setup()
cell.reset_color()
print('')
self.nations = []
self.religions = []
self.old_nations = {}
for new_nation in xrange(self.nation_count):
self.add_nation(Nation(self))
# Initially create one new religion for every nation
for i in xrange(self.nation_count):
new_religion = Religion(self.nations[i].language, self.nations[i].language.make_name_word())
new_religion.adherents[self.nations[i].cities[0].name] = self.nations[i].cities[0].population
self.religions.append(new_religion)
# Choose a random nation to generate our world's name with
lang = random.choice(self.nations).language
self.world_name = lang.translateTo('world')
self.db = db.DB(self.world_name)
self.db.setup()
events.main = self
评论列表
文章目录