ethos Academy

Advanced

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

  1. 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.
  2. 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.
  3. 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.

2. Work in three coordinate spaces

Read a vertex relative to its model, place the model in the world, then see how the camera changes its image.

Try it

  1. Run the first Horse Riding study at HORSE_JUMP=6.2. Use the edited Studio copy at HORSE_JUMP=4 or the worked check to compare maximum height, clearance and faults. Find the fence position, then check how stage 2 places offset fences.
  2. Open stage 3 in Studio. In a copy, change CAMERA_DISTANCE from 9 to 13 while keeping the horse, fences and run inputs fixed. Use the automatic attempt for both versions.
  3. In Prism Hangar, choose a visible surface. Point out the model geometry, the placement of that model and the view from the camera.

Check your work. Record both camera views and the world-space results from the two automatic attempts.

Worked check

The weaker takeoff reduces peak height from about 1.91 m to 0.78 m. The original clears three fences and the weaker jump clears none. Fence clearance also depends on the horse's world position when it reaches each obstacle. The camera-only comparison should change the framing while producing the same jump height, clearances and faults. A model can keep the same local vertices while its placement and the camera both change.

3. Build event-driven animation

Rehearse motion, scale, rotation, opacity and sound on a timeline. Then identify the game event that should trigger each accent.

Try it

  1. Build the Ski Jump timeline and inspect frames 61, 62 and 94. Check the skis, first-contact snow, result label and audio markers.
  2. Move the result track and its audio marker from frame 94 to 100. Leave the contact track and audio at 62. Preview with sound and muted.
  3. Trace the real game sequence from touchdown through snow to scoring. In Curling, find the corresponding path from stone collision to glint. Identify the sprite reset, the animation start and the end of the visible effect.

Check your work. Record one screenshot or frame number for each cue, and explain how a late landing or a missed collision changes the game sequence.

Worked check

At frame 61 the snow track is inactive. Frame 62 starts the snow at the ski contact point and plays the contact sound. The result now starts at frame 100, six frames later than the original. The real game starts snow from the actual landing and starts the personal-best cue only after the score qualifies. In Curling, RESETFX clears the prior visual transform and HIDE ends the glint. The next collision creates and starts the sprite effect again.

4. Budget work and collect results

Keep an update responsive by limiting work per step. When work goes to workers, give each result an owner and identify which run requested it.

Try it

  1. Compare Budget%=2 and Budget%=1 at frame 60. Calculate the eventual sum of the same 100 items for both. Describe how to measure both runs fairly.
  2. In the workbook, follow the two workers from the code item in bank 12 to their individual result items in bank 20. Predict and run the variant with the second value changed from 9 to 7.
  3. Inspect Fractal Atlas's source for its work units. Sketch the data you would attach to a reply so results from an old view cannot overwrite a newer one.

Check your work. Write down the frame-60 sums, the final sum, and both ordered worker outputs. Explain when the caller can read the slots.

Worked check

The sums at frame 60 are 5050 and 1830. Both schedules eventually reach 5050. The first comparison measures progress at a fixed frame. To compare completed runs, finish the same 100 items and record the time as well as the output. The worker example reads 12|18 and then 12|14 after both workers finish. Slot ownership is independent of completion order. Use a run ID and a tile ID for each job, and accept the reply only while its run ID matches the current view.

5. Diagnose a failing boundary

Choose expected results from the rule, reproduce a failure with the smallest inputs you can, then check neighbouring cases after the fix.

Try it

  1. Write the expected outputs for x=199, x=200 and x=201 when 200 belongs inside. Run the original experiment and identify the failing case.
  2. In Studio, pause on the comparison or add a temporary output for the input and predicate. Replace the strict right-edge comparison with an inclusive comparison. Run all three cases again.
  3. Record the test inputs, the source change and the before/after outputs. Read the ramp case and identify one additional case you would test after a change to support geometry.

Check your work. Explain why the exact edge belongs inside. Show what the fix does for the two neighbouring inputs.

Worked check

The rule predicts inside, inside, outside. With a strict right edge, 200 is outside, producing one failure. The inclusive comparison produces zero failures for the three inputs. For a ramp, compare reaching the seam from both directions and at a speed that can carry the player across it in one update. Use the debugger to examine state and the profiler to measure repeated costs after the behaviour is correct.

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

  1. 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.
  2. 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.
  3. 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

  1. 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.
  2. 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.
  3. 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.

All courses · Browse the game development archive →