AI CHOREOGRAPHY / THE AI / LEVEL 1 OF 5

Ask for data,
not code.

The AI knows nothing about this game. So the scene never sends just your idea: it wraps it in a message that explains the job, the coordinate system, the safe ranges and the exact JSON shape of the answer. The AI replies with numbers, never code, and the numbers are in the same form as the game's built-in poses. This page builds that message with the scene's own coachAI.js.

your idea"tired penguin", typed in VR or on a computer
→
coachTextPromptadds the job, the rules and the JSON shape
→
the course serverPOST /api/aiquery; the key stays in .env
→
JSON backa title and eight poses, as numbers

What is sent to the AI

built by the real functions, live
your inputthe jobrules of the gamethe answer's shape

Try it

Your movement idea

How a hand is written

[ outward, up from the head, forward ] in metres
[0.25, -0.55, 0.05] = hand 25 cm out, 55 cm below the head, 5 cm forward: arms hanging by the sides.

What travels to the server

The two prompts

coachAI.js

Both prompts share the rules (the ranges match the limits used in level 2) and end with an example of the exact JSON shape. Your idea is inserted with JSON.stringify, so quotes or line breaks in it cannot break the message.


      

Asking for JSON

aiquery.js (the course's starter kit)

askAIJson adds one more instruction, sends the text to /api/aiquery on the course server, and turns the answer into an object with JSON.parse, even if the AI wrapped it in a markdown code block. The server adds the OpenAI key from .env, so the key is never in the web page.


      
    

What you should be able to explain

  1. The AI has no context. Everything it needs, including what a pose is and how big a body is, must be in the message.
  2. Data, not code. The answer is a title and a list of poses. The game already knows how to perform poses, so the AI only decides what to dance, never how. The course's askSceneCoder asks for code instead, and that code can fail to run.
  3. The same form as the game's own data. AI poses use the coordinates of the built-in routines and the recorded poses, so all three can be mixed, scored and shared in the same way.
  4. The key stays on the server. The browser calls the course server; only the server knows the OpenAI key. Anyone can read a web page's code, so a key in the page would be public.

Exercises: ① Type an idea with quotation marks in it and find how it appears in the message. ② Which sentence keeps the routine loopable? ③ Why does the prompt give an example answer instead of only describing the format?