Lesson 1: Setting up the Development Environment
Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.
Welcome Aboard
Why setup matters
Welcome to MMORPG From Scratch. This is the first lesson, so our goal is not to build gameplay yet — it is to create a development environment we can trust.
An MMORPG has many moving pieces:
- a native game client
- a server that owns game state
- tools for god-mode editing: maps, spawns, data
- rendering and networking libraries
- builds that stay reproducible as the project grows
Since you already know Java/Netty/Spring and web tooling, think of this lesson as creating the C++ equivalent of a professional project baseline: compiler, build system, dependencies, debugger, formatter, and project layout.
By the end, you should be able to compile and run a small C++ program from a clean project folder.

Toolchain Mental Model
The pieces we need
A C++ environment is more explicit than a typical Java/Spring setup. Instead of one ecosystem tool doing most things, we compose several tools:
Role Tool choice for this course Language Modern C++, preferably C++20 Build generator CMake Compiler MSVC on Windows, Clang/GCC also fine Dependency manager vcpkg or Conan; we will favor simple choices Version control Git Formatting clang-format Debugging IDE debugger, lldb, gdb, or Visual Studio debuggerCMake is not the compiler. It writes build files for your actual build backend: Visual Studio solutions, Ninja files, Makefiles, and so on.
A useful mental model:
source code -> CMake configure -> native build files -> compiler/linker -> executable

Install Checklist
Recommended setup
For Windows, the smoothest path is:
-
Visual Studio 2022 Community
- Install the workload: Desktop development with C++
- Include MSVC, Windows SDK, and CMake tools
-
Git
- Use Git Bash, PowerShell, or Windows Terminal
-
CMake
- Visual Studio can install it, but a standalone install is also fine
-
Ninja optional, but recommended
- Fast, simple build backend
-
VS Code optional
- Nice lightweight editor if you do not want full Visual Studio all the time
For macOS/Linux, install Clang or GCC, CMake, Ninja, Git, and a debugger through your package manager.
Verify from a terminal
You should be able to run these commands and get versions back:
git --versioncmake --version-
ninja --versionif installed -
clon Windows Developer PowerShell, orclang++ --version, org++ --version
Do not worry yet about OpenGL, Vulkan, SFML, or networking libraries. Today we are proving the foundation.
CMake Purpose
In this course, what is CMake primarily responsible for?
First Smoke Test
Compile one tiny program
Before creating a full project, confirm that your compiler can build and run a standalone C++ program.
Save this as main.cpp, then compile it with one of these approaches:
- MSVC Developer PowerShell:
cl /std:c++20 main.cpp - Clang/GCC:
clang++ -std=c++20 main.cpp -o mmorpg_env_test - GCC:
g++ -std=c++20 main.cpp -o mmorpg_env_test
Then run the produced executable.
This is intentionally small. We are checking that the machine can do the most basic loop: edit, compile, run, observe output.
```cpp
#include <iostream>
int main() {
std::cout << "MMORPG environment smoke test\n";
std::cout << "C++ executable built and ran successfully.\n";
return 0;
}
```
Build Command
After configuring a CMake project into a folder named build with cmake -S . -B build, what command builds it?
Fill in the blank: _____________
Dependency Discipline
Avoid dependency chaos early
Game projects often accumulate libraries quickly: windowing, graphics, audio, asset loading, networking, compression, scripting, and UI.
For this course, we want dependencies to be:
- intentional: added only when they solve a real problem
- reproducible: other machines can rebuild the project
- isolated: build artifacts do not pollute source folders
- portable enough: Windows-first, but not Windows-trapped
In Java terms, CMake plus a package manager plays a role similar to Maven/Gradle dependency declarations, but with more platform-specific details.
Good habit from day one: keep generated files under build/ and keep source code under version control.

Platform Sanity Check
Log your environment
When debugging build problems, it helps to print what the compiler thinks the platform is.
This tiny program uses preprocessor checks to report the operating system family, compiler family, and C++ language level. It is not gameplay code — it is a useful environment diagnostic.
Compile and run it the same way as the smoke test.
```cpp
#include <iostream>
int main() {
std::cout << "Environment report\n";
#if defined(_WIN32)
std::cout << "OS: Windows\n";
#elif defined(__APPLE__)
std::cout << "OS: macOS\n";
#elif defined(__linux__)
std::cout << "OS: Linux\n";
#else
std::cout << "OS: Unknown\n";
#endif
#if defined(_MSC_VER)
std::cout << "Compiler: MSVC\n";
#elif defined(__clang__)
std::cout << "Compiler: Clang\n";
#elif defined(__GNUC__)
std::cout << "Compiler: GCC\n";
#else
std::cout << "Compiler: Unknown\n";
#endif
std::cout << "__cplusplus: " << __cplusplus << "\n";
return 0;
}
```
Source Control Rule
True or false: generated build folders should usually be committed to Git so everyone gets the exact same compiled files.
Ready For Client
A clean starting layout
A simple project skeleton keeps us organized before the codebase becomes large:
-
src/for C++ source files -
include/for public headers when needed -
assets/for art, shaders, maps, and data later -
tools/for editor/helper programs later -
build/for generated files, ignored by Git -
CMakeLists.txtfor build configuration -
.clang-formatfor consistent style -
.gitignorefor generated files
Do not over-engineer this yet. The goal is a stable baseline that can grow into a client, server, and editor without becoming messy immediately.
Next lesson, we will use this environment to start the Game Client - Basics phase.
