# Getting Started — Your First Map

This guide walks you through setting up the map template project and creating
a basic playable map.

## Prerequisites

- Godot 4.0 or later (any 4.x stable)
- The Tactical Shooter repository cloned
- Familiarity with Godot's editor (scene tree, inspector, 3D viewport)

## 1. Copy the Template

The template project lives at `client/map_template/`. Copy it somewhere outside
the main project (or keep it adjacent — it's a standalone Godot project):

```bash
# From the tactical-shooter repository root
cp -r client/map_template/ maps/my_first_map/
cd maps/my_first_map/
mv template_map.tscn de_dust2.tscn
```

## 2. Open in Godot

Launch Godot and click **Import** (not Open). Navigate to your copied directory
and select `project.godot`. The map template project will open.

> **Why "Import"?** Because template is a standalone project with its own
> `project.godot`. You're importing a new project into the Godot project list,
> not opening a scene within an existing project.

## 3. Explore the Demo Scene

Open `de_dust2.tscn` (the renamed `template_map.tscn`). You'll see:

- **Floor**: A green CSGBox3D pad (16×20 units)
- **Walls**: Orange CSGBox3D walls forming a rough box
- **Spawn pads**: Green (CT) and red (T) Marker3D spawn points
- **Bomb sites**: Semi-transparent orange floor panels
- **Buy zones**: Semi-transparent yellow trigger areas
- **Lighting**: DirectionalLight3D (sun), OmniLight3D fill, LightmapGI
- **Environment**: WorldEnvironment with sky

The scene also contains a `template_map.gd` editor tool script. When you open
this scene, the **Output** panel (bottom dock) shows auto-validation results
for the map structure.

## 4. Build Your First Room

1. **Select the floor** — Click `Floor` in the scene tree
2. **Scale it** — With the scale tool (R), drag the red/green/blue handles
   to resize the floor to roughly 12×16 units
3. **Add walls** — Select `Walls` → right-click → **Instantiate Child Scene** →
   select `assets/prefabs/map_bounds.tscn`. Size them to enclose the floor
4. **Add a ceiling** — Duplicate (Ctrl+D) the floor, move it up 4 units,
   set **Operation** to Union (0) so it acts as a solid ceiling

> **Tip:** Use **View → Perspective** and rotate around to check your geometry
> from all angles. Walls should overlap slightly to prevent light leaks.

## 5. Place Spawn Points

Spawn points tell the game where players appear at round start.

**CT Spawns:**
- Drag `assets/prefabs/ct_spawn.tscn` from the FileSystem dock into the scene
- Position it on the floor at one end of the map
- The green pad's +Z arrow shows the direction players face on spawn
- Duplicate for 5 players (competitive standard)

**T Spawns:**
- Same process with `assets/prefabs/t_spawn.tscn` (red pads)
- Place at the opposite end of the map

## 6. Define Bomb Sites

A competitive defuse map needs two bomb sites, A and B.

1. Drag `assets/prefabs/bomb_site.tscn` into the scene
2. Rename it to `BombsiteA`
3. Resize the CollisionShape3D to cover the intended site area
4. In the **Node** dock → **Groups** tab, ensure it has:
   - `bomb_site` (required — game logic finds sites by this group)
   - `bombsite_a` (informational — helps identify which site)
5. Repeat for BombsiteB with group `bombsite_b`

## 7. Add Buy Zones

Buy zones mark areas where players can purchase equipment.

1. Drag `assets/prefabs/buy_zone.tscn` into the scene
2. Place one at the CT spawn area (group `buy_zone` stays)
3. Resize the yellow CollisionShape3D to cover the spawn room
4. Duplicate for T spawn — add subgroup `ct_buy` or `t_buy` on each

## 8. Check the Editor Validator

Open the **Output** (bottom dock). The `template_map.gd` script runs
automatically. You should see something like:

```
=== Map Template: Validate Scene ===
  + CT Spawn points (5 found)
  + T Spawn points (5 found)
  + Buy zones (2 found)
  + Bomb sites (2 found)
  + Cubemap capture origins (1 found)
  + Map boundary walls (8 found)
  + CSG Floor geometry (1 nodes)
  + CSG Wall geometry (4 walls)
  + LightmapGI configured ✓
  + LightmapGI: NOT YET BAKED
  + ReflectionProbe present
  + WorldEnvironment present
  + DirectionalLight3D (sun) present
```

The "NOT YET BAKED" warning is expected — you'll bake lighting after geometry
is finalised (see [Lighting guide](03-lighting-and-env.md)).

## 9. Save and Package

When your map is ready for testing:

1. Save the scene (`Ctrl+S`)
2. Read the [Validation guide](04-validation.md) for headless CI checks
3. Read the [Packaging guide](05-packaging-and-shipping.md) to ship it

## Next Steps

- [Building Geometry with CSG](02-building-geometry.md) — detailed prefab reference
- [Lighting & Baking](03-lighting-and-env.md) — how to light your map properly
- [Validator Reference](04-validation.md) — CLI validator exit codes and CI
- [Packaging & Shipping](05-packaging-and-shipping.md) — publishing as .pck
