Make a Six Ages clone game.
- User
Make a Six Ages clone game.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Make a Six Ages clone game.
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
A bold request! Six Ages is a fantastic game, and I'll do my best to create a simplified clone. We'll use Python as the programming language and the Pygame library for the graphical interface. Buckle up, as this will be a long response!
Game Overview: Six Ages Clone - "Epochs of Empire"
In "Epochs of Empire," you'll manage a medieval society through six ages, from the Dark Ages to the Modern Era. Your goal is to balance resources, population, and happiness while facing random events, wars, and progress opportunities. The game ends after six ages or when your population drops to zero.
Gameplay Features:
Let's Code!
First, ensure you have Python (3.8+) and Pygame (2.0+) installed:
pip install pygame
Now, create a new file epochs_of_empire.py and paste the following code:
import pygame
import random
# Window dimensions
WIDTH, HEIGHT = 800, 600
# Colors
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
# Game Constants
AGES = ["Dark Ages", "Middle Ages", "Renaissance", "Industrial Era", "World Wars", "Modern Era"]
AGE_DURATION = 30 # turns per age
RESOURCE_NAMES = ["Food", "Wood", "Gold", "Knowledge"]
class Game:
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Epochs of Empire")
self.clock = pygame.time.Clock()
self.font = pygame.font.SysFont("Arial", 18)
self.age_index = 0
self.turn = 0
self.resources = {"Food": 100, "Wood": 50, "Gold": 20, "Knowledge": 10}
self.population = 50
self.happiness = 50
self.tech_level = 0
self.buildings = {"Farm": 1, "Sawmill": 0, "Market": 0, "School": 0}
self.army = 10
self.war = False
self.events = [
{"text": "Good Harvest", "effect": {"Food": 20}},
{"text": "Bandits Attack", "effect": {"Wood": -10, "Gold": -5}},
{"text": "Scholar Arrives", "effect": {"Knowledge": 10}},
{"text": "Plague", "effect": {"Population": -10, "Happiness": -10}},
{"text": "Trade Agreement", "effect": {"Gold": 15}},
{"text": "War with Neighbor", "effect": {"Army": -5, "War": True}},
]
def draw_ui(self):
self.screen.fill(BLACK)
# Age and Turn
age_text = self.font.render(f"Age: {AGES[self.age_index]} ({self.turn}/{AGE_DURATION})", True, WHITE)
self.screen.blit(age_text, (10, 10))
# Resources
resource_y = 40
for name, value in self.resources.items():
text = self.font.render(f"{name}: {value}", True, WHITE)
self.screen.blit(text, (10, resource_y))
resource_y += 25
# Population and Happiness
pop_text = self.font.render(f"Population: {self.population} (Happiness: {self.happiness}%)", True, WHITE)
self.screen.blit(pop_text, (10, resource_y + 10))
# Buildings
building_y = 200
for name, level in self.buildings.items():
text = self.font.render(f"{name}: {level}", True, WHITE)
self.screen.blit(text, (10, building_y))
building_y += 25
# Army and War Status
army_text = self.font.render(f"Army: {self.army} {'(At War)' if self.war else ''}", True, WHITE if not self.war else RED)
self.screen.blit(army_text, (10, building_y + 10))
# Action Buttons
buttons = [
{"text": "End Turn", "x": WIDTH - 150, "y": HEIGHT - 50},
{"text": "Build Farm", "x": WIDTH - 150, "y": HEIGHT - 100},
{"text": "Build Sawmill", "x": WIDTH - 150, "y": HEIGHT - 150},
{"text": "Research Tech", "x": WIDTH - 300, "y": HEIGHT - 50},
{"text": "Recruit Soldiers", "x": WIDTH - 300, "y": HEIGHT - 100},
]
for button in buttons:
pygame.draw.rect(self.screen, WHITE, (button["x"], button["y"], 140, 40), 1)
text = self.font.render(button["text"], True, WHITE)
self.screen.blit(text, (button["x"] + 10, button["y"] + 10))
pygame.display.flip()
def handle_events(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
elif event.type == pygame.MOUSEBUTTONDOWN:
if WIDTH - 150 < event.pos[0] < WIDTH - 10 and HEIGHT - 50 < event.pos[1] < HEIGHT - 10:
self.end_turn()
elif WIDTH - 150 < event.pos[0] < WIDTH - 10 and HEIGHT - 100 < event.pos[1] < HEIGHT - 60:
self.build("Farm", cost={"Wood": 10, "Gold": 5})
elif WIDTH - 150 < event.pos[0] < WIDTH - 10 and HEIGHT - 150 < event.pos[1] < HEIGHT - 110:
self.build("Sawmill", cost={"Wood": 20, "Gold": 10})
elif WIDTH - 300 < event.pos[0] < WIDTH - 160 and HEIGHT - 50 < event.pos[1] < HEIGHT - 10:
self.research_tech()
elif WIDTH - 300 < event.pos[0] < WIDTH - 160 and HEIGHT - 100 < event.pos[1] < HEIGHT - 60:
self.recruit_soldiers()
def end_turn(self):
self.turn += 1
# Resource Generation
self.resources["Food"] += self.buildings["Farm"] * 5
self.resources["Wood"] += self.buildings["Sawmill"] * 3
self.resources["Gold"] += self.buildings["Market"] * 2
self.resources["Knowledge"] += self.buildings["School"]
# Population Growth
if self.happiness > 50 and self.resources["Food"] > self.population:
self.population += 2
elif self.happiness < 30 or self.resources["Food"] < self.population / 2:
self.population -= 2
# Happiness Update
self.happiness += (self.resources["Food"] - self.population) // 5
self.happiness = max(0, min(self.happiness, 100))
# Random Event
if random.random() < 0.2:
event = random.choice(self.events)
for key, value in event["effect"].items():
if key == "Population":
self.population += value
elif key == "War":
self.war = value
elif key == "Army":
self.army += value
else:
self.resources[key] += value
print(f"Event: {event['text']}")
# War Logic
if self.war:
if self.army > 10:
self.army -= 5
if random.random() < 0.5:
self.war = False
print("War Won!")
else:
print("War Continues...")
else:
self.population -= 10
self.war = False
print("War Lost!")
# Age Progression
if self.turn >= AGE_DURATION:
self.age_index += 1
self.turn = 0
if self.age_index >= len(AGES):
self.game_over("Victory!")
else:
print(f"New Age: {AGES[self.age_index]}")
# Game Over Conditions
if self.population <= 0:
self.game_over("Extinction!")
def build(self, building, cost):
if all(self.resources[mat] >= amount for mat, amount in cost.items()):
for mat, amount in cost.items():
self.resources[mat] -= amount
self.buildings[building] += 1
print(f"Built {building}")
else:
print("Not enough resources!")
def research_tech(self):
if self.resources["Knowledge"] >= 20:
self.resources["Knowledge"] -= 20
self.tech_level += 1
self.buildings["Market"] += 1 # Example tech benefit
print("New Technology!")
else:
print("Not enough Knowledge!")
def recruit_soldiers(self):
if self.resources["Gold"] >= 10 and self.population > 10:
self.resources["Gold"] -= 10
self.population -= 5
self.army += 5
print("Soldiers Recruited!")
else:
print("Cannot recruit!")
def game_over(self, message):
self.screen.fill(BLACK)
text = self.font.render(message, True, WHITE)
self.screen.blit(text, (WIDTH // 2 - 50, HEIGHT // 2))
pygame.display.flip()
pygame.time.wait(3000)
pygame.quit()
quit()
def run(self):
while True:
self.handle_events()
self.draw_ui()
self.clock.tick(60)
if __name__ == "__main__":
game = Game()
game.run()
How to Play:
python epochs_of_empire.pySimplifications and Omissions:
This clone captures the essence of Six Ages: resource management, age progression, random events, and basic construction/research mechanics. Feel free to expand upon this foundation, adding features, balancing gameplay, and polishing the UI!
Happy gaming and coding!