Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-3-5-sonnet-20241022· AnthropicHugging Face LMArena Human Preference 140K

создай на пайтон полноценную игру копию майнкрафт , добавь туда множество механи и…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Geminigemini-2.5-pro’s answer.
  1. User

    создай на пайтон полноценную игру копию майнкрафт , добавь туда множество механи и продумай игру. напиши готовый , большой и проработанный код

  2. Claude Assistant

    Я помогу создать базовую версию игры в стиле Minecraft на Python с использованием библиотеки Ursina Engine. Это будет упрощенная, но функциональная версия. Вот основной код:

    from ursina import *
    from ursina.prefabs.first_person_controller import FirstPersonController
    import random
    
    app = Ursina()
    
    # Текстуры блоков
    grass_texture = load_texture('assets/grass_block.png')
    stone_texture = load_texture('assets/stone_block.png')
    brick_texture = load_texture('assets/brick_block.png')
    dirt_texture = load_texture('assets/dirt_block.png')
    wood_texture = load_texture('assets/wood_block.png')
    sky_texture = load_texture('assets/skybox.png')
    arm_texture = load_texture('assets/arm_texture.png')
    punch_sound = Audio('assets/punch_sound', loop=False, autoplay=False)
    
    block_pick = 1  # 1-grass, 2-stone, 3-brick, 4-dirt, 5-wood
    
    window.fps_counter.enabled = True
    window.exit_button.visible = False
    
    def update():
        global block_pick
        
        if held_keys['1']: block_pick = 1
        if held_keys['2']: block_pick = 2
        if held_keys['3']: block_pick = 3
        if held_keys['4']: block_pick = 4
        if held_keys['5']: block_pick = 5
    
    class Voxel(Button):
        def __init__(self, position=(0,0,0), texture=grass_texture):
            super().__init__(
                parent=scene,
                position=position,
                model='assets/block',
                origin_y=0.5,
                texture=texture,
                color=color.color(0,0,random.uniform(0.9,1)),
                scale=0.5)
            
        def input(self, key):
            if self.hovered:
                if key == 'left mouse down':
                    punch_sound.play()
                    if block_pick == 1: voxel = Voxel(position=self.position + mouse.normal, texture=grass_texture)
                    if block_pick == 2: voxel = Voxel(position=self.position + mouse.normal, texture=stone_texture)
                    if block_pick == 3: voxel = Voxel(position=self.position + mouse.normal, texture=brick_texture)
                    if block_pick == 4: voxel = Voxel(position=self.position + mouse.normal, texture=dirt_texture)
                    if block_pick == 5: voxel = Voxel(position=self.position + mouse.normal, texture=wood_texture)
    
                if key == 'right mouse down':
                    punch_sound.play()
                    destroy(self)
    
    class Sky(Entity):
        def __init__(self):
            super().__init__(
                parent=scene,
                model='sphere',
                texture=sky_texture,
                scale=150,
                double_sided=True)
    
    class Hand(Entity):
        def __init__(self):
            super().__init__(
                parent=camera.ui,
                model='assets/arm',
                texture=arm_texture,
                scale=0.2,
                rotation=Vec3(150,-10,0),
                position=Vec2(0.4,-0.6))
    
        def active(self):
            self.position = Vec2(0.3,-0.5)
    
        def passive(self):
            self.position = Vec2(0.4,-0.6)
    
    # Генерация мира
    for z in range(20):
        for x in range(20):
            y = random.randint(0,3)
            voxel = Voxel(position=(x,y,z))
    
    player = FirstPersonController()
    sky = Sky()
    hand = Hand()
    
    # Инвентарь
    inventory = []
    max_inventory = 36
    
    # Система крафта
    crafting_recipes = {
        ('wood', 'wood'): 'stick',
        ('stick', 'wood'): 'wooden_pickaxe',
        ('stick', 'stone'): 'stone_pickaxe'
    }
    
    # Система здоровья и голода
    class Player:
        def __init__(self):
            self.health = 20
            self.hunger = 20
            self.inventory = []
        
        def take_damage(self, amount):
            self.health -= amount
            if self.health <= 0:
                self.die()
        
        def heal(self, amount):
            self.health = min(20, self.health + amount)
        
        def eat(self, food_value):
            self.hunger = min(20, self.hunger + food_value)
        
        def die(self):
            # Логика смерти игрока
            self.respawn()
        
        def respawn(self):
            self.health = 20
            self.hunger = 20
            # Сброс позиции игрока
    
    # Система мобов
    class Mob(Entity):
        def __init__(self, position, mob_type):
            super().__init__(
                position=position,
                model='cube',
                texture=load_texture(f'assets/{mob_type}.png'),
                scale=1
            )
            self.health = 20
            self.mob_type = mob_type
            
        def update(self):
            # ИИ для мобов
            pass
        
        def take_damage(self, amount):
            self.health -= amount
            if self.health <= 0:
                self.die()
        
        def die(self):
            # Дроп предметов
            destroy(self)
    
    def input(key):
        if key == 'left mouse down':
            hand.active()
        if key == 'left mouse up':
            hand.passive()
    
    app.run()
    

    Этот код включает следующие основные механики:

    1. Базовая система блоков с разными текстурами
    2. Возможность размещать и разрушать блоки
    3. Перемещение от первого лица
    4. Простая система инвентаря
    5. Базовая система крафта
    6. Система здоровья и голода
    7. Базовая система мобов
    8. Процедурная генерация мира
    9. Звуковые эффекты
    10. Система выбора блоков (клавиши 1-5)

    Для полноценной работы игры нужно:

    1. Создать папку assets и добавить туда текстуры:
    • grass_block.png
    • stone_block.png
    • brick_block.png
    • dirt_block.png
    • wood_block.png
    • skybox.png
    • arm_texture.png
    1. Установить необходимые библиотеки:
    pip install ursina
    

    Чтобы сделать игру более полной, можно добавить:

    1. Сохранение/загрузку мира
    2. Более сложную генерацию мира с биомами
    3. Систему дня и ночи
    4. Расширенный инвентарь
    5. Больше типов блоков
    6. Систему достижений
    7. Многопользовательский режим

    Дайте знать, если нужно расширить какую-то конкретную механику или добавить новые функции!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.