Your First Game

This guide walks through creating a simple game on Krunker from concept to playable prototype.

Start With a Concept

Before opening the editor, decide on a basic game idea. Keep it simple:

Don't try to build everything at once. Start with the core mechanic and expand from there.

Create Your Scene

Open the Krunker Editor and select "Quick Start" or choose a template that fits your concept.

The editor provides:

See the Scene Composition guide for details on building scenes.

Add Game Logic

Open the script editor and add your game logic. Here's a minimal example that tracks score when players interact with objects:

Server script:

num score = 0;

public action onPlayerSpawn(str id) {
    obj player = GAME.PLAYERS.findByID(id);
    if (!!player) {
        player.score = 0;
    };
}

public action onNetworkMessage(str id, obj data, str playerID) {
    if (id == "score") {
        obj player = GAME.PLAYERS.findByID(playerID);
        if (!!player) {
            (num) player.score += 1;
            GAME.NETWORK.send("updateScore", {s: (num) player.score}, playerID);
        };
    };
}

Client script:

public action onNetworkMessage(str id, obj data) {
    if (id == "updateScore") {
        GAME.UI.updateDIVText("scoreDisplay", "Score: " + toStr (num) data.s);
    };
}

See the Game Logic guide for detailed coverage of timing, players, inputs, and AI.

Test and Iterate

Use the editor's play button to test your game. The iterative process is:

  1. Play - test the current state
  2. Identify - find what feels wrong or missing
  3. Adjust - make small, targeted changes
  4. Repeat - test again

Focus on getting the core mechanic feeling right before adding polish, UI, or extra features.

Next Steps

Once your basic game works: