Skip to content
TheChatArchiveThe Chat Archive
Qwenqwen3-235b-a22b-no-thinking· Alibaba (Qwen)Hugging Face LMArena Human Preference 140K

SINGLE HTML FILE. FLIGHT SIMULATOR. BASIC GRAPHICS. BUILDINGS. LARGE FLYING AREA.…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-5-haiku-20241022’s answer.
  1. User

    SINGLE HTML FILE. FLIGHT SIMULATOR. BASIC GRAPHICS. BUILDINGS. LARGE FLYING AREA. KEYBOARD CONTROLS.

  2. Qwen Assistant

    Here's a single HTML file that implements a basic flight simulator with:

    • Simple 3D graphics using HTML5 Canvas + JavaScript
    • A few basic buildings (as cubes)
    • A large flying area
    • Keyboard controls for movement:
      • WASD – Move forward, strafe left/right, move backward
      • Arrow keys – Look around (pitch/yaw)
      • Space/Shift – Climb/descend

    This is not a realistic physics-based flight simulator but a simplified first-person "aircraft" experience.


    ✅ Save the following as flight_simulator.html and open in your browser:

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Basic Flight Simulator</title>
      <style>
        html, body {
          margin: 0;
          overflow: hidden;
          height: 100%;
          background-color: #87CEEB; /* Sky blue */
        }
        canvas {
          display: block;
        }
        #info {
          position: absolute;
          top: 10px;
          left: 10px;
          color: white;
          font-family: sans-serif;
          background: rgba(0,0,0,0.5);
          padding: 5px 10px;
          border-radius: 5px;
        }
      </style>
    </head>
    <body>
    <canvas id="game"></canvas>
    <div id="info">
      Controls:<br>
      W/A/S/D – Move<br>
      ←↑→↓ – Look<br>
      Space – Up<br>
      Shift – Down
    </div>
    
    <script>
    const canvas = document.getElementById('game');
    const ctx = canvas.getContext('2d');
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    
    let keys = {};
    document.addEventListener('keydown', e => keys[e.key] = true);
    document.addEventListener('keyup', e => keys[e.key] = false);
    
    // Camera variables
    let pos = { x: 0, y: 5, z: 0 };
    let rot = { x: 0, y: 0 }; // pitch, yaw
    let speed = 0.1;
    
    function degToRad(deg) {
      return deg * Math.PI / 180;
    }
    
    function drawLine(x1, y1, x2, y2) {
      ctx.beginPath();
      ctx.moveTo(x1, y1);
      ctx.lineTo(x2, y2);
      ctx.stroke();
    }
    
    function project(x, y, z) {
      let cosYaw = Math.cos(rot.y);
      let sinYaw = Math.sin(rot.y);
      let cosPitch = Math.cos(rot.x);
      let sinPitch = Math.sin(rot.x);
    
      let dx = x - pos.x;
      let dz = z - pos.z;
    
      let px = dx * cosYaw - dz * sinYaw;
      let pz = dx * sinYaw + dz * cosYaw;
    
      let py = y - pos.y;
    
      let worldY = py * cosPitch - pz * sinPitch;
      let worldZ = py * sinPitch + pz * cosPitch;
    
      if (worldZ <= 0) return null;
    
      const f = 400 / worldZ;
      return {
        x: canvas.width / 2 + px * f,
        y: canvas.height / 2 - worldY * f
      };
    }
    
    class Building {
      constructor(x, y, z, w, h, d) {
        this.x = x;
        this.y = y;
        this.z = z;
        this.w = w;
        this.h = h;
        this.d = d;
      }
    
      draw() {
        const hw = this.w / 2;
        const hh = this.h / 2;
        const hd = this.d / 2;
    
        const points = [
          [this.x - hw, this.y - hh, this.z - hd],
          [this.x + hw, this.y - hh, this.z - hd],
          [this.x + hw, this.y + hh, this.z - hd],
          [this.x - hw, this.y + hh, this.z - hd],
          [this.x - hw, this.y - hh, this.z + hd],
          [this.x + hw, this.y - hh, this.z + hd],
          [this.x + hw, this.y + hh, this.z + hd],
          [this.x - hw, this.y + hh, this.z + hd]
        ];
    
        const proj = points.map(p => project(p[0], p[1], p[2]));
    
        const edges = [
          [0,1],[1,2],[2,3],[3,0],
          [4,5],[5,6],[6,7],[7,4],
          [0,4],[1,5],[2,6],[3,7]
        ];
    
        ctx.strokeStyle = '#333';
        for (let [a, b] of edges) {
          const pa = proj[a];
          const pb = proj[b];
          if (pa && pb) drawLine(pa.x, pa.y, pb.x, pb.y);
        }
      }
    }
    
    let buildings = [];
    for (let i = 0; i < 100; i++) {
      let x = (Math.random() - 0.5) * 2000;
      let z = (Math.random() - 0.5) * 2000;
      let w = 20 + Math.random() * 30;
      let h = 20 + Math.random() * 100;
      let d = 20 + Math.random() * 30;
      buildings.push(new Building(x, 0, z, w, h, d));
    }
    
    function updateCamera() {
      if (keys['w']) {
        pos.x -= Math.sin(rot.y) * speed;
        pos.z -= Math.cos(rot.y) * speed;
      }
      if (keys['s']) {
        pos.x += Math.sin(rot.y) * speed;
        pos.z += Math.cos(rot.y) * speed;
      }
      if (keys['a']) {
        pos.x -= Math.sin(rot.y + Math.PI/2) * speed;
        pos.z -= Math.cos(rot.y + Math.PI/2) * speed;
      }
      if (keys['d']) {
        pos.x += Math.sin(rot.y + Math.PI/2) * speed;
        pos.z += Math.cos(rot.y + Math.PI/2) * speed;
      }
      if (keys[' ']) pos.y += speed;
      if (keys['Shift']) pos.y -= speed;
    
      if (keys['ArrowUp']) rot.x -= 0.02;
      if (keys['ArrowDown']) rot.x += 0.02;
      if (keys['ArrowLeft']) rot.y -= 0.02;
      if (keys['ArrowRight']) rot.y += 0.02;
    
      // Clamp pitch
      rot.x = Math.max(-Math.PI/2, Math.min(Math.PI/2, rot.x));
    }
    
    function gameLoop() {
      ctx.clearRect(0, 0, canvas.width, canvas.height);
    
      updateCamera();
    
      for (let building of buildings) {
        building.draw();
      }
    
      requestAnimationFrame(gameLoop);
    }
    
    gameLoop();
    </script>
    </body>
    </html>
    

    🛫 Features:

    • First-person camera
    • Buildings rendered as wireframe boxes
    • Large open world (±1000 units on X/Z)
    • Basic keyboard movement and rotation
    • Canvas-based pseudo-3D projection

    🧱 How it works:

    • Uses simple 3D-to-2D projection.
    • No WebGL or libraries — just vanilla JS and Canvas.
    • Each building is represented by 8 corners and connected lines.

    🚀 Possible Enhancements:

    • Add terrain or ground plane
    • Use textures or shading
    • Add clouds or skybox
    • Implement roll and proper aircraft physics
    • Mouse look support

    Let me know if you'd like to add any of those features!

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