# 04 Spawn And Save

Modify the network at runtime + save/load it.

## Spawn / Remove

| Node            | Returns | What it does                                       |
| --------------- | ------- | -------------------------------------------------- |
| **Spawn Node**  | Node    | Create a node at a position with an optional name. |
| **Spawn Path**  | Path    | Create a path connecting two existing nodes.       |
| **Remove Node** | bool    | Delete a node and its connected paths.             |
| **Remove Path** | bool    | Delete a path.                                     |

## Save / Load

| Node                      | Returns         | What it does                           |
| ------------------------- | --------------- | -------------------------------------- |
| **Save Network Snapshot** | Snapshot struct | Capture current network state.         |
| **Load Network Snapshot** | —               | Restore network from a saved snapshot. |
| **Clear Runtime Changes** | —               | Remove all runtime-spawned actors.     |

## What's saved per node

* Stable ID (from the node's name).
* Location.
* Acceptance Radius.
* Enabled flag.
* Whether it was spawned at runtime.

## What's saved per path

* Stable ID.
* Start and end node IDs.
* Bidirectional, speed multiplier, cost multiplier, enabled flag.
* Spline shape (only for runtime-spawned paths).

## What is NOT saved

* Conditions and Events arrays (they live in the level, not the snapshot).
* Traffic occupancy (runtime-only state).
* Path Width, Danger Level, traffic settings.

## Save pattern

Add an `FOWPNetworkSnapshot` field on your USaveGame:

```
SaveGame BP variable:
    OWP Snapshot — type: OWP Network Snapshot

On Save:
    SaveGame.OWPSnapshot = Save Network Snapshot
    Save Game To Slot

On Load:
    Load Game From Slot
    Load Network Snapshot (SaveGame.OWPSnapshot)
```

## Stable IDs matter

If you spawn nodes at runtime and want them to load back:

* Pass an explicit **Name** when calling **Spawn Node**.
* Use the same name pattern for editor-placed nodes (the Batch Rename tool helps).

This way the snapshot can find them again on load.

## When to use Clear Runtime Changes

* "New game" flow — reset to the level's original state.
* After a bad run — wipe all spawned nodes/paths and rebuild.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://onesteppack.gitbook.io/openworldnavigation-doc/06-blueprint-functions/04-spawn-and-save.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
