Commit Graph

4225 Commits

Author SHA1 Message Date
vis2k
20056edc0f NetworkServer.Broadcast: explain ClearSpawnedDirtyBits better 2021-09-18 12:34:52 +08:00
vis2k
acebef0e16 NetworkBehaviour.IsDirty: OR both bitmasks instead of comparing separately. 2021-09-18 12:04:18 +08:00
vis2k
2208b6ce52
perf: breaking: SyncObjects (SyncList/SyncSet/SyncDict) Dirty Searching (O(N)) replaced with bit mask (O(1)) (#2922)
* wip

* internal field

* huh

* more

* use ondirty

* wip

* fix index

* test

* syntax

* restore old TOOD

* xml comment

* fix broken test
2021-09-18 11:56:28 +08:00
vis2k
3d624941a5 fix broken test from rename 2021-09-17 18:44:09 +08:00
MrGadget1024
1bc8232d60 Updated NetworkManager ScriptTemplate 2021-09-17 04:22:52 -04:00
vis2k
76ebb86d6d Tests: don't need to inherit from SyncList<T> anymore 2021-09-17 14:53:02 +08:00
vis2k
ccb901e708 remove strange import 2021-09-17 14:50:39 +08:00
vis2k
1a5fedf9bf Tests simplified 2021-09-17 13:37:49 +08:00
vis2k
a9c0ae014a Tests simplified 2021-09-17 13:36:18 +08:00
vis2k
8adb00bebe Tests simplified 2021-09-17 13:34:46 +08:00
vis2k
1487b2a27c Tests simplified 2021-09-17 13:33:01 +08:00
vis2k
c722f6988c breaking: SyncObject.Flush() renamed to ClearChanges() to make it more obvious.
'Flush' sounds like changes would be sent out over the wire.
When really it only clears changes.
2021-09-17 13:27:05 +08:00
vis2k
53d316bd9f syntax 2021-09-17 13:01:11 +08:00
vis2k
79f492aaf8 TODO 2021-09-17 12:48:55 +08:00
vis2k
19747954a3 fix: Weaver now allows exactly 64 SyncVars too 2021-09-16 21:50:44 +08:00
vis2k
88e1be8965 Tests: rename 2021-09-16 21:48:52 +08:00
vis2k
f01a701779 Tests: Weaver: SyncVarsExactlyMax 2021-09-16 21:48:18 +08:00
vis2k
6ebcbd8311 Tests: Weaver: SyncObjectsExactlyMax 2021-09-16 21:39:39 +08:00
vis2k
42cc181cfa syntax 2021-09-16 21:37:42 +08:00
vis2k
2e0b58c624 rename 2021-09-16 21:36:39 +08:00
vis2k
d1e60a0f62 fix: Weaver now detects and shows an error for >64 SyncObjects instead of silently not syncing them 2021-09-16 21:26:09 +08:00
vis2k
c77a50258d Too many SyncVars message improved with exact amount 2021-09-16 21:16:13 +08:00
vis2k
4daabd2fe4 syntax 2021-09-16 20:58:54 +08:00
vis2k
107e5b9f3b add comments 2021-09-16 15:13:09 +08:00
vis2k
98082c8527 comments 2021-09-16 14:50:06 +08:00
vis2k
3da14d2430 Tests: SetDirtyBit 2021-09-16 14:49:33 +08:00
vis2k
f43a29e712 NetworkBehaviour.AnySyncObjectDirty: reuse DirtyobjectBits 2021-09-16 14:42:44 +08:00
vis2k
0ad7cf7da7 Tests: IsDirty checks sync interval 2021-09-16 14:41:31 +08:00
vis2k
58ef1faaf9 Tests: IsDirty 2021-09-16 14:40:30 +08:00
vis2k
7828f25875 Tests: add SyncVars 2021-09-16 14:38:43 +08:00
vis2k
d9320b72f4 syntax 2021-09-16 14:37:06 +08:00
vis2k
cc22fabe1d syntax 2021-09-16 14:36:38 +08:00
vis2k
b5b3d33704 syntax 2021-09-16 14:35:31 +08:00
vis2k
f161fa8f43 NetworkBehaviour: DirtyObjectBits grouped to the dirty code section 2021-09-16 14:35:08 +08:00
vis2k
0954fb2b44 comment 2021-09-16 14:32:18 +08:00
vis2k
6b57e34d80 comment 2021-09-16 14:30:22 +08:00
vis2k
42e5a4d5ce NetworkBehaviourDirtyBitsTests: AnySyncObjectDirty 2021-09-16 14:28:29 +08:00
vis2k
2f2feb4d93 Tests: NetworkBehaviourDirtyBitsTests to prepare for cleanups 2021-09-16 14:21:34 +08:00
vis2k
860ee754f4 comment 2021-09-16 14:14:11 +08:00
vis2k
cf02df3a72 comment 2021-09-16 14:12:02 +08:00
vis2k
c4cc416385 comment 2021-09-16 14:11:01 +08:00
vis2k
bae099a981 syntax: NetworkBehaviour: group dirty bit code together 2021-09-16 14:10:20 +08:00
vis2k
6bd5cd7bb9 comment 2021-09-16 14:08:42 +08:00
vis2k
1b842bb168 comments 2021-09-16 14:06:29 +08:00
vis2k
e9a6b6e3d3 breaking: get/setSyncVarHookGuard renamed to Get/SetSyncVarHookGuard 2021-09-16 13:53:21 +08:00
vis2k
e4305b9d97 fix: disable weaver registered twice logs on ILPP again 2021-09-16 13:51:36 +08:00
vis2k
bb61c5324f comment 2021-09-16 13:39:25 +08:00
vis2k
f479a7404a syncVarDirtyBits comment 2021-09-16 13:38:39 +08:00
vis2k
b6fad02f13 remove unused import 2021-09-16 13:32:45 +08:00
MrGadget1024
5cde52171f formatting 2021-09-12 17:30:44 -04:00
MrGadget1024
c0dba76d35 Fixed typos in comments 2021-09-12 16:48:54 -04:00
MrGadget1024
4797007979 Removed unnecessary componet 2021-09-11 11:55:32 -04:00
vis2k
3bd30d13e2 Revert "Syntax"
This reverts commit 73c47b5fc3.
2021-09-07 11:22:42 +08:00
Justin Nolan
32f0fa47ef
Update weaver log, remove unused test and make transport send methods abstract (#2910)
* Turn on duplicate writer/reader logs in weaver

* Make Transport Client/ServerSend abstract

* Remove unused test
2021-09-07 11:20:48 +08:00
MrGadget1024
fe021f8fe7 fix: updated NetworkTransform2k test 2021-09-06 14:21:58 -04:00
MrGadget1024
73c47b5fc3 Syntax 2021-09-06 14:21:58 -04:00
vis2k
198fed4bdf comment 2021-09-07 01:16:45 +08:00
MrGadget1024
e565fce30b Updated comments 2021-09-06 13:15:36 -04:00
MrGadget1024
50ee8737a5 Moved FalbackTransport to Empty folder 2021-09-06 13:07:13 -04:00
MrGadget
8612c023a6
breaking: Remove Obsoletes (#2909)
* breaking: Remove Obsoletes
- MIRROR_47_0_OR_NEWER symbol added
- A few obsoletes with Network Visibility remain...not ready to remove just yet.

* fixed test
2021-09-07 00:10:36 +08:00
MrGadget1024
3afd3ba726 Updated deprecation dates
- We still need to replace NetworkOwnerChecker
2021-09-06 11:31:12 -04:00
MrGadget1024
9c4cc2926f fix: NTv2 interpolateScale default false, like syncScale 2021-09-06 11:15:46 -04:00
MrGadget1024
d457103850 fix: Updated NTv2 settings in examples 2021-09-06 10:01:02 -04:00
MrGadget1024
f2b3329c6f feat: Updated Additive Scenes example
- Now uses Distance Interest Management
- Adjusted position & rotation of scene objects
- Tank and Player have custom distance components
2021-09-06 09:36:55 -04:00
vis2k
1827b9558b remove unnecessary test 2021-09-06 17:25:59 +08:00
vis2k
5ab2ef0c6a Test: remove unused 2021-09-06 17:23:51 +08:00
James Clancey
8400cc46cd
Fixes a crash, if you stop discovery. (#2908)
* Fixes a crash, if you stop discovery.

* Update NetworkDiscoveryBase.cs

Co-authored-by: vis2k <info@noobtuts.com>
2021-09-06 17:17:34 +08:00
vis2k
d23403c0a3 NetworkTransformBase: expose IsClientWithAuthority 2021-09-05 20:20:22 +08:00
Justin Nolan
5bfc96d8ba
Remove obsolete weaver method calls (#2904)
* Weaver uses NetworkClient.connection instead of NetworkClient.readyConnection for client targetrpcs

* Update weaver tests to not use obsoletes

* Update test to expect SyncList<int> instead of SyncListInt
2021-09-05 19:30:50 +08:00
JesusLuvsYooh
7d4d5bf597
Default variables adjusted. (#2899)
- Old default variables are for 'worst case connection' types, or fine for casual social game movement.
- It should be set as minimum delay, whilst still containing some smooth buffer data by default.
- Tool tip suggests what users can change it to for non-ideal connections from the new default value.
- First impressions are vital.
2021-09-04 20:44:54 +08:00
vis2k
5128c4f987 MIRROR_46_0_OR_NEWER 2021-09-03 14:11:16 +08:00
vis2k
57f9923f78 OnTransportData: too short error changed to warning. it can happen if an attacker sends random data. 2021-09-02 19:30:37 +08:00
vis2k
f67704bbd9 UnpackAndInvoke: invalid message header errors changed to warnings. it can happen if an attacker sends random data. 2021-09-02 19:29:31 +08:00
vis2k
2026b6038b Tests for #2882 2021-09-02 19:17:56 +08:00
vis2k
0c65d29a32 NetworkServer/NetworkClient: UnpackAndInvoke disconnect responsibility moved to caller to avoid unbatcher count error. we already know what happened and we already disconnect anyway. 2021-09-02 19:10:10 +08:00
vis2k
99e0a6f401 update comments 2021-09-02 19:01:18 +08:00
vis2k
86eeecc9cf fix: #2882 UnpackAndInvoke now errors and disconnects in case of missing handler. This is necessary because messages in a batch are not length prefixed. we always need to read to the end, otherwise it overlaps into the next one, causing undefined behaviour. 2021-09-02 18:50:01 +08:00
vis2k
181267b99d add explanation to errors 2021-09-02 18:39:29 +08:00
vis2k
bce20b5f46 add comment 2021-09-02 18:36:36 +08:00
vis2k
3e4def126f fix: NetworkServer/NetworkClient batch processing now detects ever growing batches (as caused by #2882) 2021-09-02 18:31:43 +08:00
vis2k
9578deeb55 typo 2021-09-02 17:43:35 +08:00
vis2k
f6399f91db Tanks example: add GUIConsole to camera for easier debugging 2021-09-02 13:50:03 +08:00
MrGadget1024
d559d45031 fixed usings order 2021-08-31 10:45:03 -04:00
vis2k
04c364346e
fix: Weave via ILPostProcessor (Unity 2020+) fixes #2872 #2685 #1491 #2683 #2880 (#2891)
* WeaverTypes: make imported ReaderExtensions public

* WeaverTypes: import WriterExtensions too

* process reader/writer extensions

* rebase squashed previous ilpostprocessor branch

* adjust to weaver preparations changes

* fix: show strack trace

* better

* readability

* fix file not found cecilx exception

* fix rocks nto found exception

* syntax

* pass Mirror.dll to Weave()

* ILPostProcessorAssemblyResolver from paul

* comments, ifdef, syntax

* ILPostProcessorAssemblyResolver: add logging

* ILPostProcessorAssemblyResolver: add warnings on why Resolve() failed

* comments

* better warning

* rename

* use the custom resolver

* fix: ILPostProcessorReflectionImporter to fix System.Private.CoreLib not being found in Resolver

* add TODO

* comment

* fix Mirror.dll Resolve() issues in ReaderWriterProcessor when resolving from the passed Mirror.dll.
DefaultAssemblyResolver doesn't work with ILPostProcessor.

* fix comment

* check mirror assembly resolve result

* pass resolver to weaver

* fix Mirror.dll resolving Mirror.dll types NullReferenceException

* comments

* syntax

* comments

* readability

* syntax

* forgot to save

* rebase

* write

* fix self referencing Mirror.dll assembly

* disable log

* make tests work again

* comment

* comment

* fix rebase

* fix rebase

* comment

* fix: WeaverAssembler: only invoke weaver manually on mac. ILPP is invoked on windows automatically.

* this too

* remove comment

* ifdef out CompilationFinishedHook

* CompiledAssemblyFromFile

* comments

* tests assembly renamed to access compilationpipeline

* wip

* comments

* handle logs

* move file

* use WeaverTests error handling functions

* ILPP hook: don't log weaving failed errors for consistency with old method, and so that tests still work

* ILPPLogger: don't log prefix

* disable weaving succeeded log

* remove comment

* WeaverAssembly: save result to file

* move

* Weaver tests: compilationpipeline dependencies moved into Unity.Mirror.Weaver.CodeGen assembly.
so Tests assembly is actually weaved.

* disable self reference warning

* CompiledAssemblyFromFile simplified

* remove unused

* comments; run ILPP in all cases not just on mac

* ignore compilermessages on 2020+.
fixes windows tests not running.

* comment

* fix: ILPostProcessor ignore define added so WeaverAssembler can tell it not to run after being invoked by Unity after AssemblyBuilder.Build(). fixes SyncVarSyncList test failing on windows because ILPP was ran on it twice.

* typo

* comment

* comment

* static

* ifdef for 2019 support

* ifdef for 2019
2021-08-29 15:43:20 +08:00
ninjakickja
92965731d1
fix: Fix delayed movement in client authority mode (#2856)
* Fix - From !isLocalPlayer to !hasAuthority

Changed !isLocalPlayer to !hasAuthority because object might not be player object.

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

* Fix - delayed movement in clients in ClientAuthority mode - NetworkTransformBase.cs

Fixed issue where clients experience delayed movement in client authority mode.
Problem: Clients update the server first, server builds buffer then moves object, and then sends server's current snapshot to all the other clients who then build their buffers first before moving. This results in delayed movement in clients.
Changed the process to pass on the snapshot which the authoritative client updates the server onwards to other clients immediately instead and added checks to ensure server only broadcasts when object is on server authority or on host client authority.

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

* Update Assets/Mirror/Components/NetworkTransform2k/NetworkTransformBase.cs

Co-authored-by: vis2k <info@noobtuts.com>
2021-08-28 23:23:57 +08:00
vis2k
aff6a8a9c9 fix: WeaverTests 'type was declared in both UnityEngine.dll and UnityEngine.CoreModule.dll' 2021-08-27 22:38:18 +08:00
vis2k
851ad16a17
breaking: Weaver: add ReaderWriterProcessor [Runtime/InitializeOnLoad] Attributes without Reflection (#2893)
* breaking: Weaver: [InitializeOnLoad] attribute is now added without using Reflection.
(possibly a breaking change according to the comment, although it's not obvious why it would break)

* breaking: Weaver: [RuntimeInitializeOnLoad] attribute is now added without using Reflection.
(possibly a breaking change according to the comment, although it's not obvious why it would break)

* comments

* fix builds
2021-08-27 21:06:22 +08:00
vis2k
e87f1cb6eb Weaver: IsEditorAssembly moved into Helpers 2021-08-26 15:38:24 +08:00
vis2k
67418620fc Weave: WeaveFromFile simplified 2021-08-26 13:16:05 +08:00
vis2k
bf5b0e36ec Weaver: FindMirrorRuntime changed to FindCompilationPipelineAssembly 2021-08-26 13:08:31 +08:00
vis2k
6d1a13fc27 syntax 2021-08-26 13:06:59 +08:00
vis2k
bb8268dd06 typo 2021-08-26 13:05:02 +08:00
Shaun He
56910a1f70
* fix: The type or namespace name 'Exception' could not be found (#2889) 2021-08-25 12:17:02 +08:00
vis2k
95b009a126 Weaver WeaveFromFile: remove unused parameter 2021-08-24 23:15:36 +08:00
vis2k
e8cf20847d Weaver: move writing out of Weave() 2021-08-24 12:45:28 +08:00
vis2k
7088938bb7 Weaver: pass AssemblyResolver to Weave() so ReaderWriterProcessor can resolve Mirror.dll from CurrentAssembly's References instead of passing the AssemblyDefinition / using reflection / opening the file from Weaver / etc.
-> prepares for ILPostProcessor which needs to use the resolver to find it
2021-08-23 19:03:50 +08:00
vis2k
5d629b0fb7 syntax 2021-08-22 21:36:28 +08:00
vis2k
41f1c7abb8 syntax 2021-08-22 21:36:04 +08:00
vis2k
ad107e3b84 comments on why reflection is used 2021-08-22 21:33:19 +08:00
vis2k
46368df7fe rename 2021-08-22 21:30:19 +08:00