RynthCore/tools/FlightRecorderTests/FlightRecorderTests.csproj
Daniel Wallace aaaa0a94b4 AutoId limit: AutoIdMode All/Limited/Off (default Limited), requester-tagged 0xC8s
A flight capture from one 26-minute session showed the client sending 3211 IdentifyObject
(0xC8) messages, most of everything it sent, because AutoId appraised every object the
client created. Bots already appraise at the point of use, so the background appraisals
are now limited.

AutoIdMode (engine.json "AutoIdMode", default Limited; /rc autoid all|limited|off, live
and saved; /rc autoid alone reports it):
  All      the old behaviour.
  Limited  only the selected target (fresh-cache skip), items in the container the
           player has open now, and items in the player's own inventory with nothing
           cached. The last two wait until the object is 2 s old and until 30 s after a
           world transition's settle window ends (death, portal, teleport, landblock jump;
           walking into the next landblock never defers). A container opened after the
           settle ended is not deferred. Creatures, ground items, other players: never.
  Off      nothing, the selected target included.
Plugins' own RequestId calls are not limited; they still merge in the RequestId slot.

The decision is AutoIdPolicy (pure). AutoIdService now keeps a pending list on its drain
timer (waits for age/defer stay, skips leave), classifies each candidate from the PWD
snapshot (container / wielder / side pack owner, and the ground container from
ViewObjectContents), takes InventoryPutObjInContainer (0x0022) moves from the server
message stream, and rescans an opened container 2.5 s after the open.

Requester tagging: a thread-local EngineSendMarker around every engine RequestId call
(AutoId by class, plugin host API, the login self-identify, the Inventory panel hover).
A queued request carries its requester in PendingIdQueue and the main-thread drain
re-enters the marker around the real send. Only a marked send registers with the
flight recorder (FlightCapture.EngineSend, its own 64-entry table so bursts never evict
other engine calls), so its 0xC8 shows as [eng:autoid-target|autoid-container|
autoid-inventory|autoid-world|plugin|self|ui]; an unmarked 0xC8 stays [cli] and counts
as AC's or Decal's.

Per-minute log line "autoid 60s: ..." (its own line, not part of "hb #"): sends by
requester, cli, total, AutoId skips by reason (mode, age, defer, fresh), pending.

EngineSettings keeps upstream's MaxHotReloads, IltServerNames/IltHosts, ReportEndpoint
and CloseOnServerDisconnect next to AutoIdMode (owned keys, load and save).

Tests: EngineRobustnessTests (decision table against an independent expected function,
spot cases, defer window from WorldTransitionState inputs, classification, marker scopes
and thread-locality, requester through PendingIdQueue, heartbeat field names against the
launcher regex), FlightRecorderTests (identify tagging, foreign count, match window, burst),
EngineSettingsTests (AutoIdMode round trip, default left out). check_offthread_mutators.py:
DrainPending allow-listed like DrainTick (it only enqueues).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 17:18:12 -07:00

41 lines
2.2 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<!--
Offline tests for the flight recorder (src\RynthCore.Engine\Net\Flight*.cs, compiled in; pure
code, no engine state):
- the ring (order, wrap, truncation, concurrent writers against a reader);
- what is kept from client and server datagrams (filters, the player's id learned from
game events, objects the character used, position rate limit, retransmit dedupe,
resend-request markers);
- engine-call tagging ([eng] / [cli]) and folding of repeated calls;
- the stall detectors (use refusal, unanswered uses, "too busy") and the dump rate limit;
- decoding every recorded message type from hand-built bytes (WireBuilder.cs from
NetMessageTests), truncated and garbage input, and the dump file format;
- cost: no allocation and time per datagram on the hot path.
Extra arguments are .rnc captures from "/rc netmsg capture" (server datagrams): replayed through
the recorder and dumped to the console.
Nothing native: no AC, no engine.
Run: dotnet run -c Release [(double dash) capture.rnc ...] (exit 0 = pass, 1 = fail)
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>FlightRecorderTests</RootNamespace>
<ServerGarbageCollection>false</ServerGarbageCollection>
<TieredPGO>true</TieredPGO>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\RynthCore.Engine\Net\AcPacketWire.cs" Link="Engine\AcPacketWire.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Net\FlightRing.cs" Link="Engine\FlightRing.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Net\FlightCapture.cs" Link="Engine\FlightCapture.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Net\FlightFormat.cs" Link="Engine\FlightFormat.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Net\IdRequester.cs" Link="Engine\IdRequester.cs" />
<Compile Include="..\NetMessageTests\WireBuilder.cs" Link="WireBuilder.cs" />
</ItemGroup>
</Project>