* Failing test for non-spawned NB writer/reader
* fix: Write for non-spawned NB only writes 0 netId
Instead of writing 0 and component index which does not match what the reader expects (it will stop reading netId is 0)
Fixes#3399
* Shortened PingWindowSize to get a faster more accurate result.
Shortened PingWindowSize to get a faster more accurate result.
It taking too long to calculate the average may look bad to users
* Revert "Shortened PingWindowSize to get a faster more accurate result."
This reverts commit 0a5916b4dc.
* Revert "Shortened PingWindowSize to get a faster more accurate result."
This reverts commit 0a5916b4dc.
* Shortened PingWindowSize to get a faster more accurate result.
Shortened PingWindowSize to get a faster more accurate result.
It taking too long to calculate the average may look bad to users
* Shortened PingWindowSize to get a faster more accurate result.
Shortened PingWindowSize to get a faster more accurate result.
It taking too long to calculate the average may look bad to users, choosing 6 gives us an average of 3 results, where as the previous 10, would wait for 5, it should be a slight visual improvement.
- fix: set send/recv buffer sizes directly instead of iterating to find the limit.
fixes: https://github.com/MirrorNetworking/Mirror/issues/3390
- fix: server & client sockets are now always non-blocking to ensure main thread never
blocks on socket.recv/send. Send() now also handles WouldBlock.
- fix: socket.Receive/From directly with non-blocking sockets and handle WouldBlock,
instead of socket.Poll. faster, more obvious, and fixes Poll() looping forever while
socket is in error state. fixes: https://github.com/MirrorNetworking/Mirror/issues/2733
* Organize WeaverTypes
- Put all NetworkBehaviors together
- Put Writer with Reader
- Put Remote things together
- moved ScriptableObjectType down
* moved NetworkClientConnectionReference up
We always use a specific reader for NB syncvars, so if a custom defined writer handles data differently this leads to data mismatches.
Supporting custom readers for NB syncvars will just lead to too many edge cases and unexpected behaviour, so dont do it (see https://github.com/MirrorNetworking/Mirror/issues/2680#issuecomment-1435093212 for rationale).
Fixes#2680
* perf: Weave in pre-computed function hash for RPCs
Instead of computing it at runtime for every call
See #3381, #3377 and #3375
* Update Assets/Mirror/Editor/Weaver/Processors/CommandProcessor.cs
* Update Assets/Mirror/Editor/Weaver/Processors/RpcProcessor.cs
* Update Assets/Mirror/Editor/Weaver/Processors/TargetRpcProcessor.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
* feat: InterestManagementBase
A interest management base class that allows more advanced interest management by bypassing the built-in HashSet checks via Rebuild overriding
* Update Assets/Mirror/Core/InterestManagementBase.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
This cleanup step prepares for InterestManagement classes being able to customize the rebuild logic, but for that we should move it out of the NetworkServer class
* Interpolation off bools for NetworkTransform.
Gives a snap-like effect to position, rotation and scaling.
* Update Assets/Mirror/Components/NetworkTransformBase.cs
* Update NetworkTransformBase.cs
---------
Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
* perf: Use static generic class to cache message id
we can (ab)use c# generics to cache the message id in a static field
this is significantly faster than doing a runtime Dictionary lookup in my testing (16% thread cpu-> ~0.22% for 121 moving nts)
generic classes have separate static fields per type specification, so we can store things per-type there, exactly what we need!
* Obsolete NetworkMessages.GetId
* Update Assets/Mirror/Core/NetworkMessages.cs
* Copy comment from GetId up to the Id field
* wording
---------
Co-authored-by: MrGadget <9826063+MrGadget1024@users.noreply.github.com>
* fix: NetworkWriter - Change MaxStringLength to ushort.MaxValue
- local `realsize` in NetworkReaderExtensions.ReadString changed to ushort with proper casting
- Comments added to NetworkWriterExtensions
- Comments added to NetworkReaderExtensions
- Log output updated in both for consistency
* Added comment
* Changes per request
* feat: Read / Write DateTime
- no UTC conversion...users can do that on their own if they want / need to.
DateTime is a public struct but has no public fields (all properties) so no error is thrown if users try to use it in SyncVar / Cmd / Rpc / NetMsg, but no value is put on the wire and SyncVar hooks don't fire because the client determines no actual value change.
* Added nullable DateTime support
* Removed mysterious using