Add a controllable player object that moves with WASD keys.

Movement = Input → Update Position → Render. The player presses a key, the game updates the player's position in state, and the renderer shows the new position. This happens every frame.

Ami — Combat Risk Engine

Player cube = Hero exploring Manhattan. The red cube represents your character moving through dangerous streets.

Ida — Economic Growth Engine

Player cube = Developer walking between lots. The red cube represents you surveying your construction sites.

Create the player mesh:

let player = new THREE.Mesh( new THREE.BoxGeometry(1, 1, 1), new THREE.MeshStandardMaterial({ color: 0xff0000 }) ); scene.add(player);

Track keyboard input with keydown/keyup:

const keys = {}; window.addEventListener('keydown', (e) => { keys[e.key.toLowerCase()] = true; }); window.addEventListener('keyup', (e) => { keys[e.key.toLowerCase()] = false; });

Define movement speed and update position inside the animation loop:

const MOVE_SPEED = 0.15; function animate() { requestAnimationFrame(animate); if (keys['w']) player.position.z -= MOVE_SPEED; if (keys['s']) player.position.z += MOVE_SPEED; if (keys['a']) player.position.x -= MOVE_SPEED; if (keys['d']) player.position.x += MOVE_SPEED; renderer.render(scene, camera); } animate();
  • Add a colored cube as the player
  • Add keyboard event listeners for WASD
  • Create a movement speed constant
  • Update player position inside animation loop
  • Test: player moves smoothly in all 4 directions
  • Checkpoint

    Cube moves smoothly with WASD. Camera follows or stays appropriately angled.

    No jumping. No sprinting. No collision detection. No diagonal speed normalization. Just basic 4-direction movement.

    Movement speed too high — the player teleports across the screen instead of moving smoothly.

    Forgetting to update position inside the animation loop — movement only happens once or not at all.

    Not using keydown/keyup tracking — relying on keypress alone causes stuttering movement instead of smooth gliding.

    Let them play with movement speed. "What breaks if speed is 100?" This teaches frame-rate dependent movement. The cube IS the player — no character model needed for v1.