Skip to content

Run the samples

The engine comes with six samples: the minimal sample, LineSweeper, and the collision, audio, local multiplayer and components examples. The Collision, Audio and Local multiplayer guides each run one, and the rest of the guides quote their code. This page is where every one of them is run from.

The samples are not part of your game. They are in the engine’s own folder, and your game’s build does not build them: cmake --build --preset x64-debug in your project folder makes MyGame.exe and its tests, and nothing else. To get the samples you run the engine’s own build, in the engine’s folder. It makes a second build folder there and does not change your game.

Every command on this page, and every sample command in the guides, runs in the engine’s folder, in the x64 Native Tools Command Prompt from Install the tools:

You have The engine’s folder
The starter project, extracted to C:\dev\mygame C:\dev\mygame\external\labrador
A clone from Build Labrador C:\dev\Labrador

The boxes below use the starter project’s folder. On the Git route, use cd /d C:\dev\Labrador in place of the first line. Build Labrador has already built every sample, so on that route you can go straight to Start a sample.

If your project is somewhere other than C:\dev\mygame, the engine’s folder is your project’s folder followed by \external\labrador.

  1. Go to the engine’s folder:

    Terminal window
    cd /d C:\dev\mygame\external\labrador

    The prompt ends C:\dev\mygame\external\labrador>. Check that you are in the right place:

    Terminal window
    dir /b samples

    It lists six folders: audio, collision, components, linesweeper, local_multiplayer and minimal. If cd answers The system cannot find the path specified., your project is not in C:\dev\mygame: use your project’s folder followed by \external\labrador.

  2. Configure the engine’s build:

    Terminal window
    cmake --preset x64-debug

    This is the same preset name as your game’s, but here it configures the engine as a project of its own, with its samples and tests, into out\build\x64-debug inside the engine’s folder. vcpkg reuses the packages it built for your game. On a fast desktop this took 10 seconds; a slower machine, or one where vcpkg has to build a package again, takes longer.

    It has worked when the last lines are these:

    Output
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/dev/mygame/external/labrador/out/build/x64-debug

    CMake also prints a time in brackets after each done. If it ends with Configuring incomplete, errors occurred!, the messages are the same as the ones in Build Labrador’s If something fails. Those fixes are written for a clone: where they say C:\dev\Labrador or the Labrador folder, use C:\dev\mygame\external\labrador, whose prompt ends external\labrador>.

  3. Build everything:

    Terminal window
    cmake --build --preset x64-debug

    This builds the engine, all six samples, the engine’s tests and its benchmarks: 326 steps, which took 19 seconds on the same desktop. Ninja numbers each step, and a build that worked stops at the last number, such as [326/326] Linking CXX executable tests\app\AppTests.exe, with no line saying FAILED. Your total and the last file may differ.

    The engine’s build folder comes to about 1 GB. It is separate from your game’s C:\dev\mygame\out.

  4. Optionally, run the engine’s tests:

    Terminal window
    ctest --preset x64-debug

    It should end 100% tests passed, 0 tests failed out of 21, after about 20 seconds. These are the engine’s tests, not your game’s; your game’s two are still run from C:\dev\mygame.

From the engine’s folder, start a sample by its path. For the collision sample:

Terminal window
out\build\x64-debug\samples\collision\CollisionSample.exe

The prompt is ready again as soon as the window opens, and the sample keeps running until you quit it. Each sample copies its content beside its .exe, so it starts from any folder: from another prompt, give the whole path, such as C:\dev\mygame\external\labrador\out\build\x64-debug\samples\collision\CollisionSample.exe.

Sample Start it with To quit More
Minimal out\build\x64-debug\samples\minimal\MinimalSample.exe Escape, then Enter Run the minimal sample
LineSweeper out\build\x64-debug\samples\linesweeper\LineSweeperSample.exe Escape, Down to QUIT, Enter Examples
Collision out\build\x64-debug\samples\collision\CollisionSample.exe Escape Collision
Audio out\build\x64-debug\samples\audio\AudioSample.exe Escape Audio
Local multiplayer out\build\x64-debug\samples\local_multiplayer\LocalMultiplayerSample.exe Escape Local multiplayer
Components out\build\x64-debug\samples\components\ComponentsGallery.exe Escape Examples

Your game started as a copy of the minimal sample. LineSweeper’s pause menu has RESUME, RESTART, the colours row and QUIT; Up and Down move between them. Once the board fills and it says TOPPED OUT, Escape does nothing: press R to start a new match first. To hear the audio sample, Windows needs a working sound output, such as speakers or headphones.

The guides build only the sample they are about, which is quicker than building everything the first time. In the engine’s folder, after step 2 of Build them has configured it:

Terminal window
cmake --build --preset x64-debug --target CollisionSample CollisionSampleTests

On the same desktop, straight after configuring, this took 100 steps and 9 seconds.

A target is one program in the build. Each sample’s target is the name of its .exe without .exe. Their tests have targets of their own, which do not all follow one pattern: MinimalTests, LineSweeperTests, CollisionSampleTests, AudioSampleTests, LocalMultiplayerTests and ComponentsTests. Building everything once, as above, makes every target, and later builds only redo what changed.

LineSweeper’s rules tests play whole matches with no window. Its README runs them under the x64-debug-null preset, which draws nothing and needs no graphics card. In the engine’s folder:

Terminal window
cmake --preset x64-debug-null
cmake --build --preset x64-debug-null --target LineSweeperTests
ctest --preset x64-debug-null -R "^LineSweeperTests$" --output-on-failure --no-tests=error

On the same desktop the three took 21 seconds, and the last ends 100% tests passed, 0 tests failed out of 1. They make a second build folder, out\build\x64-debug-null, beside the first.

The samples are yours to change and break: your game’s build does not compile anything in external\labrador\samples. Before you change one, keep a copy of them all. In the engine’s folder:

Terminal window
xcopy samples C:\dev\samples-backup /E /I /Q

It prints 140 File(s) copied, or a similar count. Edit a sample’s files, run the build from the engine’s folder again, and start it again. To put one file back, name it, starting samples\, then copy it back and give it the current time, as Make a first change explains for your game:

Terminal window
set "FILE=samples\collision\body.cpp"
copy /y "C:\dev\samples-backup\%FILE:samples\=%" "%FILE%" && copy /b "%FILE%" +,, "%FILE%"

It prints 1 file(s) copied. twice; then build again.

Changes to a sample stay in this project’s external\labrador only. Put your project in Git and Move a starter project to a newer Labrador both replace that folder, so keep anything you want from a sample somewhere else first.

Do not edit files in external\labrador\engine. That folder is the engine your game builds, so a change there changes your game too.

The engine’s build folder can be deleted whenever you no longer need the samples. From the engine’s folder:

Terminal window
rmdir /s /q out

rmdir /s /q deletes the folder and everything in it without asking, so check that the prompt ends external\labrador> first. It deletes only what this page’s build made. Your game, its build and the engine’s source are untouched, and the build steps above make it again.

Any other message: Troubleshooting lists them, and Read a build error shows how to find the line that matters.

LineSweeper plays in a desktop browser at the hosted demo, with nothing to build. Building the samples for a browser needs Emscripten as well; do Install Emscripten on the browser page first. Then, in an x64 Native Tools Command Prompt, set up Emscripten and go to the engine’s folder:

Terminal window
C:\dev\emsdk\emsdk_env.bat
cd /d C:\dev\mygame\external\labrador

and configure, build and test the browser build, a separate out\build\wasm-debug folder beside the Windows one:

Terminal window
cmake --preset wasm-debug
cmake --build --preset wasm-debug
ctest --preset wasm-debug

Where this page was checked, in a fresh starter with vcpkg’s packages cached, the configure took 9 seconds, the build 296 steps, and the three about two minutes together; the folder took 381 MB, and ctest ended 100% tests passed, 0 tests failed out of 32. That count includes the six samples’ page tests, which configure registers only when it finds Chrome; without it, configure says No Chromium found and ctest runs 19. A tree from after 4 November 2026 has one more page test, the components gallery’s mouse and touch run, so it ends out of 33. The configure also prints the three shared-library warnings the browser page describes. The first configure of a browser build can take a quarter of an hour at vcpkg’s Fetching registry information or Detecting compiler hash line; leave it running.

Each sample is then a page, beside its .js and .wasm, with its content packed into the module. Serve the folder that holds all six, from the same prompt. If the MyGame server from the browser page is still open, close its window first: a second server on port 8000 starts with no error, but the first goes on answering, and every sample’s address says 404. Or use 8001 in place of 8000, in the command and the addresses.

Terminal window
start "Samples server" "%EMSDK_PYTHON%" -m http.server 8000 --bind 127.0.0.1 --directory out\build\wasm-debug\samples

A window titled Samples server opens and prints Serving HTTP on 127.0.0.1 port 8000. Open each sample’s address in Chrome, Edge or Firefox:

Sample Address
Minimal http://127.0.0.1:8000/minimal/MinimalSample.html
LineSweeper http://127.0.0.1:8000/linesweeper/LineSweeperSample.html
Collision http://127.0.0.1:8000/collision/CollisionSample.html
Audio http://127.0.0.1:8000/audio/AudioSample.html
Local multiplayer http://127.0.0.1:8000/local_multiplayer/LocalMultiplayerSample.html
Components http://127.0.0.1:8000/components/ComponentsGallery.html

The keys are the Windows ones. A page cannot close its tab, so quitting stops the game and leaves the page; reload to play again, and reload with Ctrl+F5 after a rebuild. Close the Samples server window to stop the server. A page that says 404 means an older server is answering on the same port, or the prompt was not in external\labrador when you started the server: close every server window, cd /d C:\dev\mygame\external\labrador, and start it again. If the window closes at once, or another message appears, Build for the browser says why.

On 2026-10-30, on the owner’s desktop, a starter ZIP made from this tree was extracted to C:\dev\g4\mygame, and the steps above ran in mygame\external\labrador in the x64 Native Tools Command Prompt for Visual Studio 2026. The times and counts above are from that run, with vcpkg’s packages already cached, and every sample’s .exe was in the folder the table names. The minimal, collision, audio and local multiplayer samples each passed --smoke-test, and the start /wait lines in the Collision and Local multiplayer guides printed 0. The backup and the one-file restore ran as shown, and the restored file matched the copy. The first and second messages under If something fails were made on purpose: the build run in mygame, and the engine’s build run after its build folder was deleted. The third was starting the collision sample from mygame.

On 2026-10-31 In a browser was followed as worded in a fresh starter at C:\dev\g10-follow\mygame\external\labrador, with Emscripten’s emsdk_env.bat run and Chrome 156 installed: the configure ended -- Configuring done (8.7s), the build ran 296 steps, ctest passed 32 of 32, the three took 119 seconds, and the folder took 381 MB. Served on a free port, all six addresses answered 200. With the MyGame server still open on port 8000, the Samples server started without an error and the old server answered, 404 for each sample and 200 for MyGame.html; the page now says to close it or use 8001. That was rerun after the correction, and then the same build served on 8001 answered 200 at all six addresses. The collision sample’s address drew its arena in headless Chrome 156. Earlier that day, two fresh configures in another starter spent minutes at Fetching registry information and then waited at Detecting compiler hash for triplet x64-windows until they were stopped; why was not found. An earlier run, on 2026-10-30, took 137 seconds and 378 MB.

Development documentation (unreleased). Built from Labrador aceb130 of 2026-11-20.

All documentation versions