KROYSDOCS
HomeWhat's newv0.1.0
MANUAL / Get started / Your first project

Your first project

Create a project from a template, add a script to an entity and press Play. Everything a game needs lives in one project folder.

You needA built engine
Time10 minutes
TemplatesBlank, FPS, Third Person, Action Arena
01

Create the project

Start KroysEngine.exe. The launcher lists recent projects and creates new ones. Pick a template, a name and a folder outside the engine repository, then Create. Inside the editor, File › New Project... does the same.

TemplateWhat you get
Blank ProjectAn empty scene.
FPS StarterA character controller, a first-person camera, a weapon and targets.
Third Person StarterA character with an orbiting follow camera, a weapon and targets.
Action Arena StarterA small arena with a spawn point, pickups, a damage zone and targets.

The editor's project hub also offers a Game Module template: Action Arena with its rules in C# scripts and an optional native C++ module for the dedicated server.

02

What is in the folder

A project is a folder with a .kproject file. Assets live under Content; every asset gets a .kmeta sidecar holding its GUID, so references survive renames and moves. Commit the sidecars with the project.

MyGame/
MyGame/
  MyGame.kproject          name, startup scene, settings, enabled plugins
  Content/
    Scenes/Main.kscene     the startup scene
    Scripts/               the game's C# scripts project (created on demand)
  Plugins/                 project plugins (optional)
  Saved/                   editor state for this project (not shipped)
03

Add a script

In the Content panel, open the Scripts folder, right-click and create a C# Script. The editor writes Content/Scripts/<Name>.cs and, the first time, the game's scripts project. Open it with Tools › Scripting › Open Project in your code editor.

A script derives from EntityScript. This one moves its entity with the Move action, which the default input map binds to WASD, the arrow keys and the left stick.

Save the file. With Tools › Scripting › Auto Build On Save on, the editor builds the scripts in the background; Build Scripts (Ctrl+Shift+B) builds on demand. Compile errors appear in the Console with file and line; click one to jump to it.

Then select an entity in the World panel, add a Scripts component in the Inspector (Add Component) and press Add Script: the list shows every compiled script class. Its public fields appear under it, ready to edit.

Mover.cs
public sealed class Mover : EntityScript
{
    public float Speed = 4.0f;   // metres per second, editable in the Inspector

    protected override void OnFixedUpdate(float fixedDeltaTime)
    {
        Vector2 input = Input.GetAxis2D("Move");          // WASD, arrows, left stick
        if (input.LengthSquared() < 0.0001f) return;

        Transform transform = Transform;
        Vector3 move = transform.WorldForward * input.Y + transform.WorldRight * input.X;
        transform.WorldPosition += Vector3.Normalize(move) * Speed * fixedDeltaTime;
    }
}
04

Press Play

Press Play in the toolbar or F5. The editor copies the scene into a play world and runs it in the Game panel; edits you make while playing are thrown away when you stop. Play starts with the mouse captured by the game.

  • Shift+Esc stops Play.
  • Shift+F1 frees the cursor for the editor and gives it back.
Build Scripts · MyGame succeeded
Play · Main.kscene running
05

Save

File › Save Project (Ctrl+S) saves the project and every changed scene; File › Save Scene saves only the open scene. Scenes are text files, so they diff and merge well in version control.

Next: The editor.

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.