Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Game Engines  ›  Lesson

Native Code or an Engine?

Native 12 minWriting a game natively means building the loop, maths, physics and tools yourself on low-level libraries, while an engine owns the loop and supplies them, trading control for speed.

Native Code or an Engine?

Everything so far — the loop, the maths, the physics — has to live somewhere. You can write it all yourself on top of low-level libraries, or you can start from an engine that already contains it. Before choosing, it helps to see exactly what each path hands you and what it asks of you.

The rule

Native means you own the loop; an engine owns it for you.

Native development means writing the game directly in a systems language such as C or C++ (Rust is a growing choice too), assembled from libraries:

  • a platform library such as SDL or GLFW for the window, input and timing;
  • a graphics API such as OpenGL, Vulkan, Direct3D or Metal for drawing;
  • optionally a physics library, such as Box2D for 2D games.

Then you write everything else yourself: the loop, the fixed timestep, the maths types, the scene, the tools.

while (running) {
    running = poll_input(&input);            // window events, keys, pads
    accumulator += seconds_since_last_frame();
    while (accumulator >= STEP) {            // the fixed timestep, by hand
        physics_step(STEP);
        accumulator -= STEP;
    }
    render(accumulator / STEP);              // your code on the graphics API
}

An engine such as Unity, Unreal Engine or Godot runs that loop for you. You write functions that it calls each frame, place objects in a visual editor, bring in art and sound through its import pipeline, and export to many platforms from a single project.

Native gives you full control, small builds and a deep understanding of how a game really works. An engine gives you speed: a team, including artists and designers who don't write code, can build and ship far sooner.

The shortcut

Ask "who calls whom?" If your code contains the while (running) loop, you're native. If the engine calls your update function every frame, you're on an engine. Then run a short checklist. Do non-programmers need an editor? Must it ship on several platforms soon? Is the core a familiar kind of game? Yes answers point to an engine. A technology-driven core, or learning for its own sake, points to native.

Choosing a home for Harbour HopperStep 1 of 4
  1. The team

    Two programmers and an artist who needs to place crates, boats and gulls by hand. An editor matters.

Drills

Answer fast — trust the rule.

quick drill

In a native C++ game, who writes the while (running) loop?

quick drill

Which of these is a graphics API rather than a complete engine?

quick drill

Which project most favours going native?

quick drill

On an engine, how does your per-frame code run?

Remember

  • Native: you write the loop, timestep and tools on top of libraries such as SDL and a graphics API.
  • Engine: it owns the loop and calls your code, and you get an editor, importers and exporters.
  • Ask "who calls whom?", then weigh the team, the technology and the platforms.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainHarbour Hopper, natively

A friend wants to build Harbour Hopper natively in C++ with SDL. Explain what they would have to write themselves that an engine would provide, and give one good reason to do it anyway.