Skip to content

Map embedded struct changes to their props in local entity transfer - #286

Merged
ZehMatt merged 2 commits into
SourceDotNET:mainfrom
Yahzy:fix/embedded-netvar-changes
Nov 21, 2026
Merged

ZehMatt merged 2 commits into
SourceDotNET:mainfrom
Yahzy:fix/embedded-netvar-changes

Conversation

@Yahzy

@Yahzy Yahzy commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Changing a struct network var through its ForModify accessor (for example FogForModify().Enable = false) never reached the client in singleplayer. The change is reported with the root field (Fog), but the send props are keyed by their full path (Fog.Enable, Fog.Start...), so MapPropFieldsToIndices found nothing and dropped the change (dt_ShowPartialChangeEnts 1 prints LocalTransfer field miss - DT: DT_FogController, field: Fog).

In the SDK each member of an embedded network var reports its own offset. Here the root is now mapped to the props it contains when the prop map is built, and a changed root copies only those props. If they don't fit in the list, the entity is copied entirely like a full update.

Tested: all four configurations build, Source.Common.Tests and Game.Server.Tests pass. With the env_fog_controller port, TurnOff and SetRadial now update the fog on all maps and the field miss is gone.

@Yahzy Yahzy mentioned this pull request Nov 19, 2026
@ZehMatt

ZehMatt commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

This seems like a bug in the generator code so I don't think this solution is correct.

@marchc1

marchc1 commented Nov 20, 2026

Copy link
Copy Markdown
Member

@ZehMatt if you can double check, that looks like the source generator solution

@ZehMatt ZehMatt left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine for now, the difference is however that it now does full copies of the entire array but it at least stops dropping changes but this needs to be reworked so I think this is acceptable for the time being.

Might be worth editing the title and PR description now but that isn't important really.

@ZehMatt
ZehMatt merged commit 7dbbdf1 into SourceDotNET:main Nov 21, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants