Build and test systems with several moving parts. Keep the physics, presentation and measurements separate so you can explain the result of each change.
Start here once you can build and test a small feature. Save your original project and keep a short record of the source version, inputs, expected results and observed results.
1. Simulate a delivery and a landing
Use fixed update steps to compare repeated attempts. In each study, use Run original for the automatic attempt. Choose Change one variable, apply the change, then choose Open full Studio. With creator access, run your edited copy and press D for the automatic attempt. As a guest, run the original and use the worked check for the comparison.
Curling
Ski jumping
Try it
- In straight-travel Curling, run the automatic comparison of
ICE_FRICTION at 0.15 and 0.18. Record both stopping distances in metres. Repeat in stage 2, then separately compare a delivery with and without sweeping.
- In Ski Jump stage 1, compare
SKI_LIFT at 0.12 and 0.18. Repeat in stage 2 with the same automatic takeoff. Record World X at touchdown for each run.
- Open both stage 3 sources. Trace the stone contact count and the ski landing check. Write down which quantities each contact changes, and which values feed the result.
Check your work. Repeat one pair of runs and compare its recorded distances, contact or penalty counts and results. Explain any difference using an input or a rule from the source.
Worked check
Higher drag removes more speed per step. The straight delivery stops at about 25.3 m on the Z axis with the original drag and 21.2 m with the higher drag. In later stages, sweeping changes effective drag and a stone contact can transfer motion, so compare those changes separately. Stage 1 reads zero lift in the flight routine and should give identical results for either lift value. Stage 2 reads the configured lift. Greater lift reduces the downward acceleration and moves the touchdown from about 106.1 m to 133.1 m on the X axis. A stone contact separates overlapping stones and adjusts velocity. A landing check ends the flight and uses the landing window to decide the penalty.
6. Validate a complete change
Make the Curling contact glint easier to see. Keep its start tied to contact, then show that your change leaves scoring and the simulation consistent.
Build and test
- Preview the original glint in Effect Animator. Change its fade from
12 to 18 frames. Keep the same start, scale, rotation and contact sound. Compare the two previews at the same frame during the fade.
- Open Curling Arcade's project in current Studio and work in a copy. With editing access, find
Proc ContactSpark and apply the same one-value change. Compare the original and edited programs with the same aim, weight, release and sweep inputs. For a repeatable baseline, choose Fuzzy, leave aim and weight at their defaults, release around halfway down the meter and leave sweeping off. Record contact count, score and the start and end of the glint.
- Test a missed contact and a fresh attempt as well. Save your source change and the results together so another learner can repeat them.
Autochannel 1,"RESETFX: ALPHA 85: SCALE 0.45,0.45: ROTATE 15: SCALETO 1.4,1.4,8: ROTATE 45: FADE 0,18: HIDE"
Check your work. Compare before and after for a contact, a miss and a new attempt. For each case, record the inputs, visible cue, score and any differences.
Worked check
With the same delivery and a collision, the edited fade ends six frames later. Its start, contact count and score should match. A miss never calls ContactSpark. A new attempt starts from the game's reset state. Verify this once after a visible glint so a leftover sprite is easy to spot. If a score changes, compare the actual delivery inputs before changing any physics code.
7. Take a driving simulation into VR
Landscape Drive / Fuzzy off-road uses a signed ethosBASIC project for the motor and suspension. Studio’s browser host reads controllers, tracks the viewer and renders the cockpit. Desktop, touch and VR all feed driving controls into the same fixed 120 Hz simulation.
Open the project in Studio and choose Run. On a compatible headset, select your steering hand, choose Enter VR, then point at Start driving and pull either trigger. Steer left or right with the steering stick. Push it forward to accelerate or hold it back to brake and then reverse. Press B or Y for options. From there, use Back to game to resume or Game menu followed by Back to editor to end the session. On desktop, choose Start driving and use arrows or WASD. On a phone, use the on-screen steering and pedals.
WebXR methods in the browser host
navigator.xr.isSessionSupported('immersive-vr') and navigator.xr.requestSession('immersive-vr')
- Check support before offering Enter VR. Request the session from the button’s click handler on a secure page.
gl.makeXRCompatible(), session.requestReferenceSpace('local') and session.updateRenderState()
- Prepare WebGL, use a local tracking space and attach an
XRWebGLLayer for the headset to display.
session.requestAnimationFrame(), frame.getViewerPose(space) and layer.getViewport(view)
- Read the viewer pose each headset frame. Use each view’s own projection, inverse pose and viewport. Cull terrain outside the eye views before submitting meshes. Queue fixed simulation steps once per headset frame, then draw both views from the same car pose.
session.inputSources and frame.getPose(source.targetRaySpace, space)
- Choose the steering controller by handedness and read the
xr-standard thumbstick. Use each controller’s ray pose for pointing at menus. Clear held input when tracking or input sources change. Where haptics are supported, road bumps go to the steering controller and the in-game launcher’s feedback goes to the other controller.
session.end() and the end event
- Release held controls and return focus to the desktop controls when the session ends, including when the browser ends it.
This JavaScript example isolates the thumbstick mapping from the cockpit. It takes an XRSession and the selected steering hand. The full cockpit also reads progressive trigger input.
function readDriveStick(session, steeringHand) {
const source = Array.from(session.inputSources).find(input =>
input.handedness === steeringHand
&& input.targetRayMode === 'tracked-pointer'
&& input.gamepad?.mapping === 'xr-standard'
);
const axes = source?.gamepad.axes ?? [];
const axis = value => Math.abs(value) <= 0.14
? 0
: Math.sign(value) * Math.min(1, (Math.abs(value) - 0.14) / 0.86);
const steer = axis(axes[2] ?? 0);
const pedal = axis(axes[3] ?? 0);
return {
steer,
throttle: pedal < 0 ? -pedal : 0,
brake: pedal > 0 ? 0.11 + 0.89 * pedal : 0
};
}
const sample = {
handedness: 'left',
targetRayMode: 'tracked-pointer',
gamepad: {mapping: 'xr-standard', axes: [0, 0, 0, -0.57]}
};
console.log(readDriveStick({inputSources: [sample]}, 'left'));
ethosBASIC commands for the driving surface
Landscape Height(world,x,z) returns physical ground Y. Landscape Normal(world,x,z,axis) returns one component of the physical surface normal (0 for X, 1 for Y and 2 for Z). The suspension reads these when a wheel overhangs a higher triangle than its suspension ray hit. Turning your head changes the rendered view while the terrain query at a fixed X and Z returns the same values.
Run this in Studio to sample ground height and all three normal components. The driving project loads its terrain from a bank. This small example creates its own terrain from seed 17.
Console On
ready%=Landscape Create(0,65536,65536,4,17,28,0.5)
If ready%
Landscape Interpolation 0,1,2
world_x=10
world_z=20
ground_y=Landscape Height(0,world_x,world_z)
normal_x=Landscape Normal(0,world_x,world_z,0)
normal_y=Landscape Normal(0,world_x,world_z,1)
normal_z=Landscape Normal(0,world_x,world_z,2)
Print ground_y,normal_x,normal_y,normal_z
Landscape Release 0
Endif
End
Try it
- Predict the JavaScript output when the vertical stick axis is
-0.57, 0 and 0.57 with the horizontal axis centred. Run the function with a sample xr-standard source whose axes are [0, 0, 0, -0.57], then swap in the other values. Switch the selected hand and see what happens when no controller matches.
- Run the BASIC example twice with the same seed and coordinates, then change
world_x by four. Record the heights and normal components. In Landscape Drive, try the same brake-then-reverse sequence using your available input.
- If you have a headset, wait on the start panel before driving, turn your head while stopped, then open options and return to the game. Check for movement with the stick centred after closing options. Use Back to editor to check that the cockpit closes and Studio receives focus.
Check your work. Record the stick values, brake and throttle outputs, and both terrain samples. If you ran the headset checks, record which device and browser you used and what happened at start, resume and exit.
Worked check
The three stick values produce about 0.5 throttle, neutral controls and about 0.555 brake respectively, with zero steering in every case. A missing controller produces neutral controls. A held brake slows the moving vehicle before reverse engages. At the same terrain coordinates the two console outputs match. Changing X samples a different point, so compare the values before deciding how the surface changed. In VR, the start panel waits for a trigger. While stopped, a head turn changes the view. Closing options with neutral controls allows a fresh driving input.
Trace the example in the Studio source for the session and stereo frame, the controller mapping and the BASIC motor and suspension. Studio’s Landscape Drive guide lists the full controls.