Major Netcode Refactor #180
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notes
The reflection code in
PacketRegistrywill be kept as it completely removes the need to manually register each individual packet class. Maybe in the future a source generator could handle this task so the reflection cost on startup is completely removed.Changelog
Performance
GetOpcode()does not need to retrieve them on every lookupAssembly.GetExecutingAssembly().GetTypes()inPacketRegistryis now cached for single lookupMapPackets<T>now uses an array instead of aListIgnoredPacketsnow uses aHashSetinstead ofListReadability
PacketRegistryGodotServerGodotClientUsability
res://Framework/GodotUtils/Netcode/Sandbox/TopDown/NetControlPanelLownow requires its extending class to implementENetOptions Optionsand all the UI button nodesNETCODE_ENABLEDwhich can easily be disabled by removing the constant from.csprojBug Fixes
ToFormattedString(this object v)in GodotUtils returning extra blank linesSystem.IO.EndOfStreamExceptionis thrownLogger.Update()now only runs ifNETCODE_ENABLEDconstant existsDEBUGdefine wrapped aroundVisualizeusing causing non-debug release builds to failValdiateResourceFile(...)inOptionsManagernow also detects resource files with empty script paths caused by projects being ran in exported release mode