Skip to content
TheChatArchiveThe Chat Archive
Metallama-3.3-70b-instruct· MetaHugging Face LMArena Human Preference 140K

Generate a html/js game that recrates touhou 6

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4.1-mini-2025-04-14’s answer.
  1. User

    Generate a html/js game that recrates touhou 6

  2. Meta Assistant

    Recreating Touhou 6: Embodiment of Scarlet Devil in HTML/JS is a significant undertaking, as it involves creating a full-fledged bullet hell shooter with complex game mechanics, graphics, and sound effects. However, I can provide a basic structure and some code to get you started.

    Note: This is a simplified version of the game, and it will not be a perfect replica of the original Touhou 6. You will need to add more features, graphics, and sound effects to make it more authentic.

    Game Structure:

    • index.html: The main HTML file that loads the game.
    • game.js: The JavaScript file that contains the game logic.
    • styles.css: The CSS file that styles the game.
    • images/: A folder that contains the game's graphics.
    • sounds/: A folder that contains the game's sound effects.

    index.html:

    <!DOCTYPE html>
    <html>
    <head>
      <title>Touhou 6: Embodiment of Scarlet Devil</title>
      <link rel="stylesheet" href="styles.css">
    </head>
    <body>
      <canvas id="game-canvas" width="640" height="480"></canvas>
      <script src="game.js"></script>
    </body>
    </html>
    

    game.js:

    // Get the canvas element
    const canvas = document.getElementById('game-canvas');
    const ctx = canvas.getContext('2d');
    
    // Set the canvas dimensions
    canvas.width = 640;
    canvas.height = 480;
    
    // Define the game variables
    let player = {
      x: canvas.width / 2,
      y: canvas.height / 2,
      speed: 5,
      bullets: []
    };
    
    let enemies = [];
    let bullets = [];
    let score = 0;
    let lives = 3;
    
    // Define the enemy types
    const enemyTypes = [
      {
        name: 'Fairy',
        speed: 2,
        health: 1,
        bulletSpeed: 3,
        bulletDamage: 1
      },
      {
        name: 'Youkai',
        speed: 3,
        health: 2,
        bulletSpeed: 4,
        bulletDamage: 2
      }
    ];
    
    // Define the player's bullet type
    const playerBulletType = {
      speed: 10,
      damage: 1
    };
    
    // Main game loop
    function update() {
      // Update the player position
      player.x += player.speed;
    
      // Update the enemies
      for (let i = 0; i < enemies.length; i++) {
        enemies[i].x += enemies[i].speed;
        if (enemies[i].x > canvas.width) {
          enemies.splice(i, 1);
        }
      }
    
      // Update the bullets
      for (let i = 0; i < bullets.length; i++) {
        bullets[i].x += bullets[i].speed;
        if (bullets[i].x > canvas.width) {
          bullets.splice(i, 1);
        }
      }
    
      // Check for collisions
      for (let i = 0; i < enemies.length; i++) {
        for (let j = 0; j < bullets.length; j++) {
          if (checkCollision(enemies[i], bullets[j])) {
            enemies[i].health -= bullets[j].damage;
            bullets.splice(j, 1);
            if (enemies[i].health <= 0) {
              enemies.splice(i, 1);
              score++;
            }
          }
        }
      }
    
      // Draw the game
      ctx.clearRect(0, 0, canvas.width, canvas.height);
      ctx.fillStyle = 'black';
      ctx.fillRect(0, 0, canvas.width, canvas.height);
      ctx.fillStyle = 'white';
      ctx.font = '24px Arial';
      ctx.textAlign = 'left';
      ctx.textBaseline = 'top';
      ctx.fillText(`Score: ${score}`, 10, 10);
      ctx.fillText(`Lives: ${lives}`, 10, 40);
    
      // Draw the player
      ctx.fillStyle = 'red';
      ctx.fillRect(player.x, player.y, 20, 20);
    
      // Draw the enemies
      for (let i = 0; i < enemies.length; i++) {
        ctx.fillStyle = 'blue';
        ctx.fillRect(enemies[i].x, enemies[i].y, 20, 20);
      }
    
      // Draw the bullets
      for (let i = 0; i < bullets.length; i++) {
        ctx.fillStyle = 'yellow';
        ctx.fillRect(bullets[i].x, bullets[i].y, 5, 5);
      }
    
      // Request the next frame
      requestAnimationFrame(update);
    }
    
    // Check for collisions between two objects
    function checkCollision(obj1, obj2) {
      if (obj1.x + obj1.width > obj2.x &&
          obj1.x < obj2.x + obj2.width &&
          obj1.y + obj1.height > obj2.y &&
          obj1.y < obj2.y + obj2.height) {
        return true;
      }
      return false;
    }
    
    // Handle keyboard input
    document.addEventListener('keydown', (e) => {
      if (e.key === 'ArrowUp') {
        player.speed = -5;
      } else if (e.key === 'ArrowDown') {
        player.speed = 5;
      } else if (e.key === 'ArrowLeft') {
        player.x -= 5;
      } else if (e.key === 'ArrowRight') {
        player.x += 5;
      } else if (e.key === ' ') {
        // Shoot a bullet
        const bullet = {
          x: player.x,
          y: player.y,
          speed: playerBulletType.speed,
          damage: playerBulletType.damage
        };
        bullets.push(bullet);
      }
    });
    
    document.addEventListener('keyup', (e) => {
      if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
        player.speed = 0;
      }
    });
    
    // Start the game
    update();
    

    styles.css:

    body {
      margin: 0;
      padding: 0;
      background-color: #f0f0f0;
    }
    
    #game-canvas {
      border: 1px solid black;
    }
    

    This code creates a basic game structure with a player that can move up and down, shoot bullets, and collide with enemies. The game also keeps track of the score and lives.

    However, this is just a starting point, and there are many features that need to be added to make the game more like Touhou 6. Some of these features include:

    • More enemy types with different behaviors and bullet patterns
    • Power-ups and items that the player can collect
    • A boss fight with a complex bullet pattern
    • A scoring system that rewards the player for grazing bullets and defeating enemies
    • Sound effects and music to enhance the game's atmosphere
    • Graphics and animations to make the game more visually appealing

    I hope this helps! Let me know if you have any questions or need further assistance.

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