Make a first change
Everything in game\ is yours now. This page changes three things you can see, so you know the
whole loop works: edit, build, test, run. It starts by keeping a copy of the game, so that any
edit you make here or later can be undone.
The commands run in the x64 Native Tools Command Prompt, in your project’s folder, the one Get the starter project or Start your own project made. If you opened a new prompt, go there first:
cd /d C:\dev\mygameThe edits use Notepad, which every copy of Windows has; any text editor or IDE does as well,
if it saves files as UTF-8, which the build reads them as. Windows 11’s Notepad, Visual
Studio and Visual Studio Code all do unless told otherwise, and Notepad shows the encoding at
the right of the bar along its bottom: UTF-8. A file saved as ANSI or another encoding
builds, but any letter outside plain English in it comes out wrong. In Notepad, Ctrl+F finds
a piece of text and Ctrl+S saves. Close Notepad after saving each file.
-
Keep a copy of your game. This copies the
gamefolder, everything that is yours, to a folder beside the project named after it with-backupon the end:C:\dev\mygame-backupforC:\dev\mygame. It is one line:Terminal window if not exist game\main.cpp (echo This is not your project's folder. Nothing was changed.) else (rmdir /s /q "%CD%-backup" 2>nul & xcopy game "%CD%-backup\game" /E /I /Q)%CD%is the folder the prompt is in. The line first deletes the copy you made last time, if there is one, thenxcopyprints how many files it copied,16 File(s) copiedfor the game a starter project begins with. If it printsThis is not your project's folder.instead, it changed nothing: run thecd /d C:\dev\mygameline above, then this line again.Run this line again whenever the game works and you want to keep it as it is now. Each run replaces the copy before it, so do not run it while the game is broken. Getting a file back below puts files back from the copy.
-
Change the greeting. Open the file that draws it:
Terminal window notepad game\states\hello_state.cppPress Ctrl+F, search for
Hello from the engine., and you are at the line that creates the greeting:samples/minimal/states/hello_state.cpp L"Hello from the engine.", font_name, this->motion_.centre, resources,samples/minimal/states/hello_state.cpp, lines 86–88 at
0f4f503Change its text:
L"Hello from my game.", font_name, this->motion_.centre, resources,Change only the words between the quotation marks, and keep the quotation marks, the
Lbefore them and the comma after them. TheLmakes it a wide string, which is what the engine’s text drawing takes. Use plain English letters, digits and punctuation: the game’s font has no other characters, and an accented letter, a curly quotation mark pasted from a web page or an emoji draws as?. Save and close Notepad. -
Make it spin faster. How the greeting moves is your game’s rules, in
game\rules\motion.h, and the speed is a constant beside the rules it configures:Terminal window notepad game\rules\motion.hSearch for
spin_speedwith Ctrl+F:samples/minimal/rules/motion.h inline constexpr float spin_speed = 1.2f;samples/minimal/rules/motion.h, line 32 at
0f4f503Change
1.2fto3.0f, keeping thefand the semicolon after it. The unit is radians per second. Save and close Notepad. -
Name the window. In
game\main.cpp, change the window’s class name and title:Terminal window notepad game\main.cppSearch for
window_class_namewith Ctrl+F. These are the lines:samples/minimal/main.cpp options.window_class_name = L"MinimalSampleWindowClass";// ASCII only: this file gets copied into new projects, and a wide// literal's encoding depends on how the compiler was told to read the// source.options.window_title = L"Labrador - minimal sample";samples/minimal/main.cpp, lines 107–111 at
0f4f503Change the text between the quotation marks in the first and last of them, so that they read as below, then save and close Notepad. The comment lines between them stay as they are, and as they say, the title is safest in plain English letters, digits and punctuation.
options.window_class_name = L"MyGameWindowClass";// ...options.window_title = L"My game"; -
Rebuild, test and run. First quit the game if it is still open from the previous page: click its window, so that the keys go to the game rather than to the prompt, then press Escape, then Enter. A game that is running cannot be replaced by the new one, and the build stops with
LNK1168. Then run this, which is one line:Terminal window cmake --build --preset x64-debug && ctest --preset x64-debug && out\build\x64-debug\game\MyGame.exe&&runs the command after it only if the one before it worked, so the tests run only after a good build, and the game starts only after the tests pass. Only the files you changed, and the ones that include them, are compiled again; on a fast desktop this took 7 seconds. It ends like this:Output [8/9] Linking CXX executable game\MyGameTests.exe[9/9] Linking CXX executable game\MyGame.exeTest project C:/dev/mygame/out/build/x64-debugStart 1: MyGameTests1/2 Test #1: MyGameTests ...................... Passed 0.03 secStart 2: MyGameSmokeTests2/2 Test #2: MyGameSmokeTests ................. Passed 0.77 sec100% tests passed, 0 tests failed out of 2Total Test time (real) = 0.84 secBoth tests still pass: the rules test reads
spin_speedrather than repeating1.2f, and the start-up check opens the game hidden, runs it for a moment and quits. Then the game opens. The window has your title, and your greeting circles faster.If the build fails, nothing after it runs, and the build’s last lines say where it stopped. Deleting the greeting’s closing quotation mark, for example, ends like this:
Output [3/4] Building CXX object game\CMakeFiles\MyGame.dir\states\hello_state.cpp.objFAILED: [code=2] game/CMakeFiles/MyGame.dir/states/hello_state.cpp.objC:\PROGRA~1\MICROS~1\18\COMMUN~1\VC\Tools\MSVC\1451~1.362\bin\Hostx64\x64\cl.exe /nologo /TP ...C:\dev\mygame\game\states\hello_state.cpp(87): error C2001: newline in string literalC:\dev\mygame\game\states\hello_state.cpp(88): error C2143: syntax error: missing ')' before 'labrador::Colour::white'C:\dev\mygame\game\states\hello_state.cpp(88): error C2143: syntax error: missing ';' before 'labrador::Colour::white'C:\dev\mygame\game\states\hello_state.cpp(88): error C2059: syntax error: ')'C:\dev\mygame\game\states\hello_state.cpp(88): error C2059: syntax error: ')'ninja: build stopped: subcommand failed.The line after
FAILED:is the command that failed, hundreds of characters long in a real build: skip it. The first line witherrorin it is the one to read. It names the file, the line number in brackets, and what the compiler expected. The lines after it are usually the same slip seen again, and go away when it is fixed. Here, line 87 ofhello_state.cpphas a quotation mark that is never closed. Open the file again, press Ctrl+G, type87in the Go to line box and press Enter; the bar along the bottom of Notepad then saysLn 87. Compare that line with this page: the usual slip is a quotation mark,L,f, comma or semicolon missing or doubled. Fix it, save, and run the line above again. Read a build error has more on reading the output and what the common errors mean. If the message is not about your edit, look it up in Troubleshooting. If you cannot find the slip, put the file back and make the edit again.If a test fails, the game does not start, and ctest’s summary counts the failure, such as
50% tests passed, 1 tests failed out of 2. The lines under the failed test say why. A failedMyGameSmokeTestsprints astartup failure:line, which Troubleshooting looks up by message. A failedMyGameTestsmeans a change togame\rulesbroke what a test checks, such as changing whatstep_motiondoes rather than its speed; Add a rule and a test reads that output line by line.If you build, test and run with separate commands instead, read the build’s last lines before going on. After a failed build the tests still pass and the game still starts, but they are the program from the last good build: the game looks as if your edit did nothing.
Getting a file back
Section titled “Getting a file back”If an edit breaks the game and you cannot see why, put the file back as it was in the copy from
step 1. Paste this line, but before you press Enter, change the path to the file you want
back, starting game\, as Typing the commands
shows:
set "FILE=game\states\hello_state.cpp"It prints nothing. Then, in your project’s folder:
copy /y "%CD%-backup\%FILE%" "%FILE%" && copy /b "%FILE%" +,, "%FILE%"It prints 1 file(s) copied. twice. The first copy puts the file back. The second gives it
the current time without changing what is in it. Without that, the file keeps the time it had
when you made the copy, which is older than the build’s own files, so the build would think
nothing had changed and keep the broken program. If it prints
The system cannot find the file specified. or The system cannot find the path specified.,
the copy has no file at that path: check the set line’s spelling, or that you made the copy
in step 1. Nothing was changed. Then build, test and run as in step 5.
To put the whole game folder back as it was in the copy, run this line. It deletes your
game folder, files you added since the copy included, and copies the copy back in its place,
but only if the copy is there:
if not exist "%CD%-backup\game\main.cpp" (echo There is no copy in %CD%-backup. Nothing was deleted.) else (rmdir /s /q game & xcopy "%CD%-backup\game" game /E /I /Q)It prints a count such as 16 File(s) copied, or There is no copy in and the folder it
looked for, having changed nothing. Then configure and build everything again:
cmake --preset x64-debugcmake --build --preset x64-debug --clean-firstThe configure reads game\CMakeLists.txt again, in case the copy lists other source files
than the folder did. --clean-first deletes everything the build made and builds it all again,
the engine too, for the same reason as the second copy above. The two took 17 seconds on a
fast desktop. Then build, test and run as in step 5.
The file as it came in the starter project. If you made the project from
the starter ZIP and it is still in C:\dev, the ZIP holds every
file as the project began. After the set line above, in your project’s folder, this empties
C:\dev\original, extracts that one file into it and copies it over yours:
if exist C:\dev\original rmdir /s /q C:\dev\originalmkdir C:\dev\originaltar -xf C:\dev\labrador-starter-v0.3.0.zip -C C:\dev\original "mygame/%FILE:\=/%"copy /y "C:\dev\original\mygame\%FILE%" "%FILE%" && copy /b "%FILE%" +,, "%FILE%"tar itself prints nothing when it works, and the copy line prints 1 file(s) copied.
twice. If tar says Not found in archive, the set line names a file the starter did not
have. If tar says Error opening archive, or copy alone says
The system cannot find the path specified., the starter ZIP is not in C:\dev. In each of
those cases your file was not changed.
If your project is in Git, Start your own project or
Put your project in Git made a commit of it, and this puts one
file back as it was at your last commit, whether or not you have run git add since:
git restore --source=HEAD --staged --worktree game\states\hello_state.cppSave and undo changes with Git is the everyday loop in Git: see what changed, record each working version, and go back to any of them.
What was checked
Section titled “What was checked”On 30 October 2026, in a starter project made from a starter ZIP at C:\dev\mygame, with
Visual Studio 2026’s compiler 19.51, the edits above were made and the one-line build, test
and run worked as shown. The failure output above was captured by deleting the greeting’s closing
quotation mark, and the same build with separate commands showed both tests passing on the
old program. On 31 October 2026 the slip was made again in a fresh starter, which put its lines
one earlier than the first run had, and the output above was corrected to it; a second agent
then checked every hello_state.cpp line number this page, Read a build error and
Troubleshooting quote against another fresh starter, and each matched. Each box on this page
that copies or restores files was run, in the project’s folder and, for the guarded lines, in the wrong folder and with no copy, where each printed its
message and changed nothing. The build after each restore compiled the restored file again; a
plain copy without the second line was also tried, and the build did not compile it again.
Where to go next
Section titled “Where to go next”The comments in hello_state.cpp explain why each part of it is written the way it is, and they
are the best next thing to read. Reading the C++ in minimal
explains the language features, ownership and rendering terms used there. After that:
Documentation for Labrador v0.3.0. Built from Labrador 0f4f503 of 2026-11-03.