Manual

Getting Started

This guide covers the fastest path from a Sendama project to a working editor and runtime loop.

1. Create Or Open A Project

To create a new game:

sendama new:game my-game
cd my-game
composer install

To open an existing game, change into its project directory instead.

2. Know The Standard Project Layout

A typical Sendama project looks like this:

my-game/
├── sendama.json
├── preferences.json
├── game.php
├── config/
│   └── input.php
├── logs/
│   ├── debug.log
│   └── error.log
└── Assets/
    ├── Scenes/
    ├── Prefabs/
    ├── Scripts/
    ├── Events/
    ├── Textures/
    └── Maps/

Newer projects use Assets. Older projects may still use lowercase assets, and the editor can handle that too.

3. Bootstrap The Runtime Entry File

Most games start with a small game.php or my-game.php bootstrap that configures the engine and loads scenes:

<?php

declare(strict_types=1);

use Sendama\Engine\Game;

require __DIR__ . '/vendor/autoload.php';

$game = new Game('My Game');

$game
  ->loadScenes('Scenes/level01')
  ->loadSettings()
  ->run();

That bootstrap usually stays small. Scene structure, object setup, and gameplay tuning should live in scenes, prefabs, and behaviours instead of being hard-coded here.

4. Open The Editor

From inside the game project:

sendama edit

Or point directly at a project:

sendama edit --directory /path/to/project

The editor expects:

  • sendama.json
  • an asset root such as Assets
  • at least one scene under Assets/Scenes or assets/Scenes

If common files are missing, the editor can normalize the project by filling in the usual folders and bootstrap files.

5. Understand The Opening Layout

The default editor layout has five panels:

  • Hierarchy
  • Assets
  • Main
  • Console
  • Inspector

The Main panel switches between:

  • Scene for placing and selecting scene objects
  • Game for play-state monitoring
  • Sprite for editing textures and tile maps

6. Make Your First Edits

A good first session looks like this:

  1. Open the scene root from Hierarchy.
  2. Set the scene Name, Width, and Height.
  3. Assign an Environment Tile Map and, if needed, an Environment Collision Map.
  4. Add a GameObject or UI element from Hierarchy.
  5. Select the object and edit its transform and renderer in Inspector.
  6. Move it visually in Main -> Scene.
  7. Press Ctrl+S to save the scene.

If you want a concrete first scene target, this is a healthy minimum:

<?php

return [
  'name' => 'Level01',
  'width' => 96,
  'height' => 32,
  'gameObjects' => [
    [
      'name' => 'Player',
      'type' => 'GameObject',
      'transform' => [
        'position' => ['x' => 8, 'y' => 20],
      ],
      'renderer' => [
        'texture' => 'Textures/player.texture',
      ],
      'components' => [
        [
          'type' => Sendama\MyGame\Scripts\PlayerController::class,
          'data' => [
            'speed' => 4.0,
          ],
        ],
      ],
    ],
  ],
];

7. Learn The Save Model Early

This is the most important editor rule:

  • scene and hierarchy edits stay in memory until you press Ctrl+S
  • texture and tile map drawing is written immediately
  • prefab edits are written immediately
  • file renames and deletions happen immediately

If you rename an asset that a scene uses, save the scene soon after so the updated path is written back to disk.

8. Run The Game

Use the full runtime when you want to verify gameplay:

sendama play

Or:

sendama play --directory /path/to/project

The most effective workflow is usually:

  1. edit in sendama edit
  2. save scene changes with Ctrl+S
  3. run sendama play
  4. use the editor console and inspector to support the next change

When you are iterating quickly, it helps to keep the editor and runtime responsibilities separate:

# terminal 1
sendama edit

# terminal 2
sendama play

Next Steps