(Feat) Add Build

This commit is contained in:
2026-07-22 12:56:13 +02:00
parent 3657b870d8
commit 0052b0d98e
244 changed files with 35752 additions and 3112 deletions
+21 -7
View File
@@ -171,14 +171,28 @@ World objects (pickables, harvestables) are **not** NetworkObjects. They use the
owns a synced set of inactive ids + server-side authority (health, loot, drops) via RPC.
Add new harvestable/pickable-like world state here, not as per-object NetworkObjects.
`ItemData` cannot cross the wire — map items to ids through `ItemDatabase`
(**Tools ▸ Ashwild ▸ Rebuild Item Database** after adding items). `BuildRegistry` +
`BuildableDatabase` mirror this for placed structures (which also accumulate to high counts).
(**Tools ▸ Ashwild ▸ Rebuild Item Database** after adding items).
This "no NetworkObjects" rule targets **high-count** world state (thousands of scatter objects,
hundreds of builds) — making those NetworkObjects would flood the network. It is **not** absolute:
a **transient, low-count** object that moves and needs smooth replication — the build ghost, one
per player — is the case where a real **NetworkObject + client-authoritative NetworkTransform**
is the better tool, and `BuildRegistry` spawns it as such. Pick by count and lifetime, not dogma.
**Placed structures are the deliberate exception — they ARE NetworkObjects.** `BuildRegistry` spawns
every committed build server-side (`ServerManager.Spawn`) and each one carries its own state on its
own `BuiltStructure`. This used to be a data registry (a `SyncList` of pose records each client
instantiated locally), and it was changed on purpose: the records never saved the GameObjects — those
were instantiated locally anyway, so memory, colliders and draw calls were identical — they only saved
FishNet's per-object bookkeeping, and they forced a **second, incompatible mechanism** for any build
with real state (chests, cooking stations). One mechanism for walls, chests and campfires alike is
worth the bookkeeping at co-op base scale. Buildables still cross the wire as ids through
`BuildableDatabase`.
This "no NetworkObjects" rule targets genuinely **high-count, stateless** world state — the thousands
of scatter objects — where a per-object NetworkObject buys nothing. It is **not** a blanket ban, and
two cases deliberately go the other way:
- **Placed structures** (hundreds, and many of them stateful) — server-spawned NetworkObjects, see above.
- **The build ghost** (transient, one per player, moves every frame) — a NetworkObject with a
client-authoritative NetworkTransform, spawned by `BuildRegistry`.
Pick by **state and count together**, not by count alone: the moment an object needs its own
replicated state, a data registry means hand-rolling what FishNet already does per object.
### Shared interactables (cooking stations, future chests/benches)