Commit Graph

653 Commits

Author SHA1 Message Date
vis2k
5f7c4d48b4 NetworkServer.AddLocalClient renamed to SetLocalConnection because that's what it does. The connection is created in LocalClient now too, this way NetworkServer doesn't need to depend on LocalClient(!) 2019-03-24 21:15:05 +01:00
vis2k
829da79288 LocalClient.InternalConnectLocalServer sets connectionId to 0 directly instead of getting it from NetworkServer.AddLocalClient (which shows an error message if failed anyway) 2019-03-24 21:07:41 +01:00
vis2k
56c163d9cd NetworkServer.RemoveLocalClient renamed to RemoveLocalConnection because NetworkServer only keeps a local connection, not a local client 2019-03-24 21:07:41 +01:00
uwee
6db11b298b Add the name of the Message back to the debug
The random int representing the Message is less human readable.
2019-03-24 14:50:13 -05:00
vis2k
ca2c72aee8 NetworkServer.s_LocalConnection replaced with .localConnection private setter 2019-03-24 20:46:34 +01:00
Paul Pacheco
48674151f0 perf: don't varint bytes and shorts 2019-03-24 14:45:03 -05:00
vis2k
bdf12c85d0 fix: #640 InternalReplacePlayerForConnection calls SpawnObserversForConnection now too 2019-03-24 19:41:41 +01:00
vis2k
a2d6317642 fix: #573 NullReferenceException because destroyed NetworkIdentities were never removed from sceneIds dict 2019-03-24 19:28:25 +01:00
rodolphito
1e5fc3cde5 Made dirty bits not rely on NetworkWriter position manipulation hackery. (#636)
* Made dirty bits not rely on NetworkWriter position manipulation hackery.

* Renamed GetDirtyBits to NextDirtyBits, as discussed with Paul.

* Expanded one line ifs.
2019-03-24 12:43:39 -05:00
Paul Pacheco
a495f66fc1
refactor: configure frame rate in a virtual method (#638)
Moved frame rate configuration into a virtual method so that people can override it and we reduce StartServer complexity

Fixes #567
2019-03-24 08:58:11 -05:00
vis2k
2d492607c8 pong example: ball is only simulated on server now 2019-03-24 14:38:22 +01:00
vis2k
e521a20052 fix: #573 (part 2) NetworkManager detects additive scene loads and respawns objects on server/client again 2019-03-24 13:24:29 +01:00
vis2k
c1af84e6bf fix: #573 (part 1) NetworkScenePostProcess handles NetworkIdentities of all scenes except DontDestroyOnLoad. this way it works for additively loaded scenes too. 2019-03-24 13:24:29 +01:00
vis2k
603dfa1fe9 don't use continue and improve comments 2019-03-24 13:24:29 +01:00
vis2k
051cd7cf66 add comment 2019-03-24 13:24:29 +01:00
vis2k
bce7c54fa1 NetworkScenePostProcess: only set inactive if this was actually a valid scene object 2019-03-24 13:24:29 +01:00
rodolphito
b3595d3f5d Code simplification and optimization. (#635) 2019-03-24 10:47:14 +01:00
Zac North
7d21bded9a feat(syncvar): Add SyncDictionary (#602)
* Added basic SyncDictionary support, no support for structs yet

* Fixed TryGetValue usage

* Removed extraneous hardcoded SyncDictionary type

* Added a couple basic tests, more coming

* Added 4 more tests

* Added two tests and SyncDictionary now bubbles item to Callback on Remove (both Remove cases)

* Added the remainder of tests

* Added basic documentation about SyncDictionaries on StateSync.md page

* Simplify test syntax

Co-Authored-By: Katori <znorth@gmail.com>

* Simplify test syntax

Co-Authored-By: Katori <znorth@gmail.com>

* Simplify test syntax

Co-Authored-By: Katori <znorth@gmail.com>

* Simplify test syntax

Co-Authored-By: Katori <znorth@gmail.com>

* Remove null-check when setting value directly (and updated expected test behaviour)

* fix: Provide default implementation for SyncDictionary serializers

* feat: Add Weaver support for syncdictionary

* Fix minor issue with Set code and made test use Weaved serialization instead of manual

* Added a new test for bare set (non-overwrite)

* Added another test for BareSetNull and cleaned up some tests

* Updated SyncDictionary documentation on StateSync.md

* Update docs with SyncDictionary info

* Update SyncDictionary docs wording

* docs: document the types and better example

* Add two SyncDictionary constructors

* Removed unnecessary initialization

* Style fixes

* - Merged many operation cases
- Fixed Contains method
- Added new test to test contains (and flag its earlier improper usage)
- Use PackedUInt32 instead of int for Changes and Counts

* - Simplify "default" syntax
- Use Rodol's remove method (faster)
- Don't use var

* Removed unnecessary newline, renamed <B, T> to <K, V> per vis2k, corrected wording of InvalidOperationException on ReadOnly AddOp

* Code simplification, style fixes, docs example style fixes, newly improved implementation for CopyTo that fails gracefully
2019-03-24 10:18:31 +01:00
rodolphito
fea46b801d Remove NetworkAnimatorEditor and animator parameter mask. (#633) 2019-03-24 09:39:51 +01:00
vis2k
67d715fe74 fix: Telepathy updated to latest version: protect against allocation attacks via MaxMessageSize. Can be configured in the TelepathyTransport component now. 2019-03-23 20:34:48 +01:00
Zac North
b0af876221 fix(tests): Added missing SyncListByteValid test file (#634)
* Added missing SyncListByteValid test file (passing)

* Added a missing newline
2019-03-23 18:40:38 +01:00
MichalPetryka
1595fb07b1 PreprocessorDefine rework (#626)
perf: speed up preprocessor define
2019-03-23 06:59:35 -05:00
vis2k
1bf2f9ee56 Update List Server demo text 2019-03-23 12:51:39 +01:00
vis2k
4eb01da0c1 update welcome message 2019-03-22 17:19:05 +01:00
vis2k
fa04185fa8 remove empty line 2019-03-22 14:08:59 +01:00
vis2k
c194771084 ClientScene.DestroyAllClientObjects simplified: use .Values 2019-03-22 14:05:47 +01:00
vis2k
6e11429699 NetworkClient.Shutdown made static too. ShutdownAll made obsolete. 2019-03-22 13:56:43 +01:00
vis2k
1d94464023 NetworkClient.ShutdownAll calls .Shutdown 2019-03-22 13:54:20 +01:00
vis2k
e1e7b3132e NetworkClient.Shutdown: call ClientScene.Shutdown, otherwise it's never called 2019-03-22 13:53:28 +01:00
vis2k
227b0a71d1 tanks example namespaces updated 2019-03-22 13:29:24 +01:00
vis2k
c5b4211ac7 list server examples namespace changed 2019-03-22 13:28:08 +01:00
vis2k
5c00577746
fix: #609 by spawning observers in NetworkServer.AddPlayerForConnection after setting the controller. There is no point in trying to spawn with a null controller in SetReady, because by definition no one can observer something that is null. (#623) 2019-03-22 12:50:35 +01:00
Paul Pacheco
b7e977a7a3
synclist code generator is now reusable (#624)
* refactor: Made serializer generation reusable

* refactor: SyncList code generator is reusable for other structs
2019-03-22 06:44:57 -05:00
vis2k
1d166c699a add comment 2019-03-22 12:24:22 +01:00
vis2k
694185b756 NetworkServer.SpawnObserversForConnection helper function instead of doing it all in SetClientReady 2019-03-22 12:23:33 +01:00
vis2k
009943f368 remove outdated comment 2019-03-22 12:10:13 +01:00
vis2k
c3bd7d6e07 NetworkServer.SetClientReady: get rid of 'continue' 2019-03-22 12:09:22 +01:00
vis2k
400bb91821 NetworkServer.SetClientReady: remove unnecessary null check because we don't have one in the above foreach either, and we don't have them anywhere else for NetworkIdentity.spawned because OnDestroy removes objects from it before they become null. The only way to cause this would be by calling Destroy(GetComponent<NetworkIdentity>()) - which no one does, and if someone does it then it's fine to get an exception here. 2019-03-22 12:08:47 +01:00
vis2k
9567daedba add comments 2019-03-22 12:06:13 +01:00
vis2k
b869e3af99 improve comment 2019-03-22 12:04:25 +01:00
vis2k
c176da7bc3 NetworkServer.SetClientReady: use if+else instead of if + early return 2019-03-22 12:00:16 +01:00
vis2k
0e8b442cad add some ocmments 2019-03-22 11:59:12 +01:00
vis2k
f6a6440294 NetworkServer.SetClientReady: move isReady=true upwards 2019-03-22 11:57:27 +01:00
vis2k
47d5ee976e remove unused variable 2019-03-22 11:53:42 +01:00
Paul Pacheco
6f19489721
feature(synclist): allow SyncList of primitive types (#622)
* feature(synclist): allow SyncList of primitive types

As it turns out this never really worked:
```cs
class SyncListByte : SyncList<byte> {};
```

You had to write your own serializeItem / deserialize item for native types.

This change lifts the restriction, now you can use a synclist of anything that mirror can serialize/deserialize

* fix: fix unit tests error messages
2019-03-22 05:51:20 -05:00
vis2k
aa5e5a104f ClientScene.s_PendingOwnerNetIds converted to HashSet 2019-03-22 10:10:53 +01:00
vis2k
0d6b03989a NetworkServer.InternalAddPlayerForConnection moved into AddPlayerForConnection because there is no reason to keep it in an internal method anymore, since NetworkServer is static now 2019-03-22 10:04:14 +01:00
vis2k
fb2131207c NetworkServer.InternalAddPlayerForConnection: reuse 'identity' for log message 2019-03-22 10:03:00 +01:00
vis2k
4f53f37dc8 NetworkServer.InternalAddPlayerForConnection: rename playerGameObject parameter for consistency 2019-03-22 10:02:30 +01:00
vis2k
75e51513db added the log message again too 2019-03-22 09:58:04 +01:00
vis2k
1a55c3d52d NetworkManager: move OnServerAddPlayerInternal code into OnServerAddPlayer because it was really just the implementation for OnServerAddPlayer moved into another function 2019-03-22 09:53:21 +01:00
vis2k
4b4dd179cc sort regular and obsolete OnServerAddPlayer functions 2019-03-22 09:51:27 +01:00
vis2k
a39954003a NetworkManager.RegisterServerMessages for AddPlayerMessage uses OnServerAddPlayer directly instead of wrapping it with a OnServerAddPlayerMessageInternal function 2019-03-22 09:46:14 +01:00
vis2k
fa4efa6683 syntax 2019-03-21 18:12:34 +01:00
vis2k
155764cea8 simplify NetworkIdentity.RebuildObservers 2019-03-21 17:58:15 +01:00
vis2k
f90cdae3c6 fix #384: duplicating scene objects at runtime is now detected and and error is shown. otherwise the user could instantiate scene objects at runtime, which would then send the sceneId to the client, then the client wouldn't know which of the multiple objects to use for the sceneId, resulting in things getting out of sync. 2019-03-21 11:46:55 +01:00
Zac North
c9eac57ce8 fix: OnClientReady is called and passed the appropriate ready state value in NetworkLobbyPlayer (#618) 2019-03-21 02:27:25 -05:00
Martin Evans
28b067d3cd refactor: Generic IMessageBase to allow struct message types (#619)
* - Added a `IMessageBase` as an interface to `MessageBase`. Existing messages which inherit `MessageBase` (including ones which do not implement Serialize/Deserialize and rely on the weaver) will continue to work in exactly the same way as before!
 - Modified any methods which were generic `T where T : MessageBase` to be `T where T : IMessageBase`. this does not change things at all for all existing usages of the method.

These two changes allow end users to implement IMessageBase as a `struct` instead of `MessageBase` as a `class`, so they are no longer forced to allocate message objects in their own code.

* Update .gitignore

* Update Messages.cs

* Update MessageBaseTests.cs

* Update MessageBaseTests.cs

* Update MessageBaseTests.cs
2019-03-20 19:44:42 -05:00
Paul Pacheco
9d043182bf feature: SyncList now support structs (#614)
Previously, if you wanted a synclist of structures,  you would do:  SyncListSTRUCT<MyStruct>
Now you can use SyncList<MyStruct>
SyncListSTRUCT is left there, but obsolete
2019-03-20 12:45:46 +01:00
vis2k
22640b5e62
Mirror List Server example (#611)
feature: Mirror List Server example
2019-03-20 09:38:53 +01:00
Anthony Eckert
00961ccc9c feature: Add NoRotation to NetworkTransform (#616)
This allows you to leave rotation out of the NetworkTransform if you only need position.
Right now if you don't need sync rotation and set compression to Lots, it can move your object in ways not expected. This forces you to use no compression as a fix. Using more bandwidth for something you don't need. I think this is all that is needed, tested it in my game and it works.
2019-03-19 23:46:33 -05:00
Paul Pacheco
80bce0a626 refactor: rename SyncObjectProcessor -> SyncObjectInitializer
The name SyncObjectProcessor is confusing because it does not process syncobjects.   Instead it initializes syncobjects in a NetworkBehaviour.
this avoids the confusion with SyncListStructProcessor, that does process synclists to add serialization methods
2019-03-19 08:26:03 -05:00
Paul Pacheco
6e51e69e3d refactor: rename SyncListProcessor -> SyncListInitializer
SyncListProcessor is a very confusing name,  it does not process synclists at all,  instead it initializes synclists in the network behaviour.
This is more confusing especially since SyncListStructProcessor  does process the synclists to add serialization methods, and both of them normally work
in tandem in different parts of the code
2019-03-19 08:23:28 -05:00
vis2k
8f8856d320 remove targetrpc first parameter networkconnection test because it's optional now 2019-03-18 13:08:28 +01:00
MichalPetryka
c1707e5917 fix: Don't disconnect host (#608)
* Don't disconnect host

* Update NetworkConnection.cs
2019-03-18 09:38:51 +01:00
vis2k
ed6a93724f tanks: projectiles 2019-03-17 22:23:20 +01:00
vis2k
21327065f2 rename Examples/Movement to Examples/Tank 2019-03-17 21:46:53 +01:00
vis2k
97b4e26d8b movement: add a light to the tank 2019-03-17 21:46:18 +01:00
vis2k
a2165d3278 movement: dirt texture 2019-03-17 21:38:58 +01:00
vis2k
d41c5d0040 movement: adjust camera 2019-03-17 21:31:45 +01:00
vis2k
6a11335050 movement: improve code 2019-03-17 21:30:45 +01:00
vis2k
a773df4905 movement: use animations 2019-03-17 21:30:45 +01:00
vis2k
c0b2d63a8d movement: rename player to tank 2019-03-17 21:18:57 +01:00
vis2k
13717c8b57 movement: rotate camera 2019-03-17 21:17:20 +01:00
vis2k
fbe2895eab movement: delete old model 2019-03-17 21:12:49 +01:00
vis2k
14b63e9d10 movement: add some spawn positions 2019-03-17 21:08:52 +01:00
vis2k
477fe61a14 movement example: fix movement in builds by using navmeshagent; use better model (tank) 2019-03-17 21:05:12 +01:00
MichalPetryka
b67b3e4304 fix: Stop calling ClientDisconnect on host (#597)
* Stop calling ClientDisconnect on host

* Update NetworkConnection.cs

* Update NetworkServer.cs
2019-03-17 19:37:21 +01:00
MrGadget
78504533f3 Fix Scene Handling (#463)
* Fix Scene Handling

Line 361: Passing false prevents the switch to offline scene...pass true instead to forceReload paramater.
Line 588: Never assume Network Manager is in Scene 0 of Build Settings...it often is not.

* Reverted GetActiveScene

Will make separate PR

* Added code to unwind DontDestroyOnLoad

* Fixed typo in comment

* Removed the unwinding of DDOL
2019-03-17 19:32:49 +01:00
vis2k
7efeaa980c not public 2019-03-17 14:35:53 +01:00
vis2k
d72a10b4a9 pong: NetworkManagerPong handles ball spawn and despawn 2019-03-17 14:34:59 +01:00
vis2k
7e9b3efa7d pong: fixed racket spawn position after reconnecting 2019-03-17 14:24:15 +01:00
vis2k
6d8d9f2998 pong: racket uses * Time.fixedDeltaTime 2019-03-17 14:14:22 +01:00
vis2k
a3209add85 pong ball uses continous collision detection and interpolation to fix going through walls 2019-03-17 14:08:08 +01:00
vis2k
f360e5070c pong ball velocity only starts when both players are connected 2019-03-17 14:07:24 +01:00
vis2k
c956148982 pong ball position centered 2019-03-17 14:02:42 +01:00
vis2k
46dd15d4a4 spawn scene object not found message shows sceneID as hex 2019-03-17 09:54:44 +01:00
MrGadget
f64eb8be0b Should be fixedDeltaTime in FixedUpdate (#605) 2019-03-16 13:15:32 -05:00
MrGadget
d09c7cddc0 Fixed typos (#604) 2019-03-16 12:57:17 -05:00
MrGadget
54c964c232 Made Lists available to inheritors (#603)
* Made Lists available to inheritors

* Update NetworkLobbyManager.cs

Made them public
2019-03-16 15:47:33 +01:00
rodolphito
0b83c9feb9 Add scale to spawn payload. (#599) 2019-03-16 11:57:59 +01:00
vis2k
4193574864
[TargetRPC] optional connection parameter for easier usage while still allowing for previous usage (#592)
* [TargetRPC] optional connection parameter for easier usage while still allowing for previous usage

* allow for parameterless targetrpc too

* syntax

* Add Helpers.ReaderParameters change from HLAPI 2019.2 package just to be sure
2019-03-14 14:52:32 +01:00
vis2k
1824e8db80 sceneID buildIndex byte replaced with scenePath hash and sceneID converted to long to fix #571, #577 2019-03-14 11:26:19 +01:00
vis2k
ca69cb9c14 log sceneid as hex 2019-03-14 11:15:51 +01:00
vis2k
de9d31f6b6 syntax 2019-03-14 11:01:42 +01:00
vis2k
e962fd2f35 sceneID random generation excludes 0 because 0 is for random sceneIDs 2019-03-14 11:01:12 +01:00
vis2k
62fc738673 Fix sceneID mismatch bug between build (buildIndex=-1) and editor (buildIndex=0) for projects where the scene was not added to build settings list 2019-03-13 18:36:20 +01:00
vis2k
8642056f21 add comments 2019-03-13 18:27:00 +01:00
MichalPetryka
8c41ee2380 Remove a per packet Encoding allocation (#588)
* Remove a per packet encoding allocation

* Update NetworkReader.cs

* Update NetworkReader.cs

* Update NetworkWriter.cs

* Update NetworkWriter.cs

* Update NetworkReader.cs
2019-03-13 15:53:18 +01:00
MrGadget
ab668962d1 Added Obsoleted Methods (#590) 2019-03-13 15:49:43 +01:00
MrGadget
dc0b8d406a NetworkLobbyManager: Added Obsoleted Method (#591) 2019-03-13 15:49:11 +01:00
vis2k
f17ddfec5f syntax 2019-03-13 14:03:41 +01:00
vis2k
d23facc048 simplify code 2019-03-13 14:01:50 +01:00
vis2k
00a1004b41
Weaver sourcebased hlapi2019.2package (#587)
* move weaver into assets folder

* disable tests for now

* asmdef

* add logs

* Use UNET's WeaverRunner code, slightly modified to find Mirror assembly

* Use UNET's 2019.2 package Weave function changes

* compiler messages error checked moved into separate function

* fix typo

* syntax

* replace 'var'

* rename

* replace var

* fix log

* update comment

* syntax

* rename to assemblyPath. no need for an extra variable.

* remove extra variable

* fix typo

* remove old code

* don't use .Contains to find Mirror dll. that's crazy. would fail for all DLLs in Mirror folder.

* look for 'this' assembly separately

* separate unityEngine assembly search

* add comment

* move null check up

* move null check upwards

* move outputDirectory down

* check process result properly

* use our previous way to find unity engine dll

* rename to unityEngineCoreModuleDLL again

* improve output directory construction

* move unityengine dll finding upwards

* move foundThisAssembly down, where it is used

* add comments

* split dependency code into separate functions

* add TODO

* store this assembly in a variable

* split dependency search depending on if we found assembly or not

* move usesMirror logic into if and out of 'not found' else

* syntax

* improve order

* GetNonDynamicAssemblyDirectories helper function

* check File.Exists instead of exception

* improve comment

* rename HlapiRuntimeAssemblyName to MirrorAssemblyName

* reuse MirrorAssemblyName

* remove telepathy check

* rename to MirrorRuntimeAssemblyName

* add MirrorWeaverAssemblyName

* reuse name consts

* don't use contains to check if assembly depends on Mirror

* add actions for testing again

* make CompilationFinishedHook public so it can be used by tests

* fix typo

* Mirror.Tests.asmdef references weaver asmdef

* reenable tests

* pass error handlers to Weaver Processing for tests to work
2019-03-13 12:17:04 +01:00
Liu
dea7b58792 Fix network animator doesn't sync float value as expected (#589)
Maybe we should do float sync when the Abs of newValue - lastValue > 0.001f
2019-03-13 12:15:34 +01:00
vis2k
b0ef89a0d9 resave scenes because of new sceneIDs 2019-03-12 18:45:42 +01:00
MrGadget
303d0f4b3a Reverted spelling error from #537 (#584) 2019-03-11 18:51:34 -05:00
rodolphito
dd362b18a0 Fixed the NetworkAnimator issue I introduced in the bandwidth fix. This should also further improve bandwidth, too. (#576) 2019-03-11 08:54:46 +01:00
Paul Pacheco
092c5663b6
NetworkReader should enforce read only (#580) 2019-03-10 12:04:45 -05:00
rodolphito
4aa1a4b169 Removed one liner braces from transport files. (#544) 2019-03-10 10:18:11 +01:00
vis2k
98a0e23413
Persistent sceneid (#563)
* add empty line

* persistent scene ids

* never assign scene ids at runtime

* fix warning

* fix 'sceneid is never assigned to' warning in play mode

* simplify bitwise operation

* set dirty even if only scene index byte changed

* improve log message

* assign build index byte in OnPostProcessScene to also work with unopened scenes and build index changes

* add comment

* improve log

* Add sceneid not set check

* Only PostProcess the objects from this scene.

* Interrupt build if there is an unopened scene that still needs sceneId assignments. This makes it 100% fail safe.

* improve comment and error message

* clear build index byte before or-ing into it
2019-03-08 20:24:18 +01:00
vis2k
508ba558fc NetworkManager: headless start moved to Start() because Awake() is for initialization. 2019-03-07 15:30:23 +01:00
vis2k
3a86bd501a headless start doesn't unnecessarily set tick rate anymore. StartServer already takes care of that. 2019-03-07 15:27:15 +01:00
vis2k
8b85e1c846 NetworkIdentityEditor: create GUIContent directly 2019-03-07 13:39:30 +01:00
vis2k
f3738d87d7 NetworkAnimatorEditor: create GUIContent directly 2019-03-07 13:39:30 +01:00
rodolphito
ca7824bbc1 Fixed animator bandwidth problem. (#536)
* Fixed animator bandwidth problem.

* Renamed xShadowCopy to lastXParamters, renamed val to be consistent with the reading value names, renamed newValue to newIntValue to be consistent with newFloatValue and newBoolValue.

* Removed Debug.log which slipped by.
2019-03-06 22:52:26 +01:00
MichalPetryka
9afefbdce7 Adjusted line endings, encoding and trimmed whitespaces at EOL (#561) 2019-03-06 18:08:48 +01:00
rodolphito
896551eb00 Finished replacing comment walls with regions. (#558) 2019-03-06 10:53:35 -06:00
vis2k
17ab8ae30a add empty line 2019-03-06 14:42:22 +01:00
rodolphito
ca57f1180c Removed trailing whitespace (#556) 2019-03-06 09:08:34 +01:00
rodolphito
98284e4253 Removed single line braces from NetworkWriter. (#545)
* Removed single line braces from NetworkWriter.

* Undid alignment.
2019-03-05 18:17:42 -06:00
vis2k
ed64872163 NetworkIdentity.OnValidate: wrap in #if UNITY_EDITOR in case OnValidate is needed at runtime later 2019-03-04 17:43:51 +01:00
vis2k
8eb27ea0af Syntax 2019-03-04 17:42:24 +01:00
rodolphito
f6d89c763f Removed comment divider thingies and used regions where applicable. Reordered a bit of code to make the regions make sense. (#532) 2019-03-04 10:04:54 +01:00
rodolphito
f324c0df94 Removed SetInstanceId by making netId setter internal. (#510)
* Removed SetInstanceId by making netId setter internal.

* Split isServer into multiple lines as per vis' suggestion.
2019-03-04 10:02:00 +01:00
rodolphito
15c3991905 Removed braces from everything else. (#551) 2019-03-04 09:57:27 +01:00
rodolphito
c1179fbd0d Renamed UNetInvokeType to MirrorInvokeType. (#553) 2019-03-04 09:56:59 +01:00
rodolphito
8141c44e50 Brace crunching (#554)
* Made bracing consistent in WeaverTests.

* Made bracing consistent everywhere else.
2019-03-04 08:48:28 +01:00
rodolphito
335ed683a5 Remove one liner braces in NetworkManager. (#547) 2019-03-04 08:47:11 +01:00
rodolphito
0790dd2ac9 Remove one liner braces on NetworkServer. (#548) 2019-03-04 08:46:54 +01:00
rodolphito
b3e6194665 Remove one liner braces. (#550) 2019-03-04 08:44:39 +01:00
rodolphito
45e886e2c4 Removed one liner braces in NetworkIdentity. (#546) 2019-03-04 08:44:27 +01:00
rodolphito
a9deb56282 Remove one liner braces in ClientScene (#549) 2019-03-04 08:43:33 +01:00
Paul Pacheco
70cfe9e8ce Websocket transport should be namespaced (#542) 2019-03-04 08:42:17 +01:00
Paul Pacheco
9a0af7cb55
Allow users to unpack messages too (#543) 2019-03-03 18:06:36 -06:00
Paul Pacheco
4749abd307
Move GetId<T> to MessagePacker (#540)
Now we have the logic of how many bits in just one place and we free up MessageBase for eventually converting to an interface
2019-03-03 14:02:34 -06:00
Paul Pacheco
e4fbbeddc3 Simplify add player extra data (#537)
* Simplify add player extra data

* Pass byte[] in the client too

* Renamed to extra message
2019-03-03 19:53:24 +01:00
vis2k
001cec6d82 NetworkManager.InitializeSingleton: set active transport AFTER setting singleton or destroying self. not before. Otherwise we would set it to a transport that is destroyed a moment later. 2019-03-03 18:19:07 +01:00
vis2k
440a6dfc6f NetworkManager.InitializeSingleton: show warning if destroying self. No need to show an error, since this can be completely normal if we use zones/multiple scenes and switch back to the main scene, which still has a networkmanager. 2019-03-03 18:16:29 +01:00
Paul Pacheco
480bd8c9c6 Transport should be protected so that people can implement their own OnValidate logic (#539) 2019-03-03 16:51:03 +01:00
Paul Pacheco
c7b8f78aae #418 Send messages without id (#422)
* Client can send/receive messages without id

* Server can send and receive messages without id

* Move message id to one common place

* Client use the new send method

* Obsolete the message ids

* Remove player uses the new api

* Refactor AddPlayer with new message api

* Provide a Pack method that gets the message id

* Convert ready message to new api

* Use new api for ObjectDestroy and ObjectHide

* Refactored ready message to new API

* Refactored SpawnSceneObjectMessage to new api

* Convert local authority message to new api

* Convert spawn started message to new api

* Convert spawn finished message to new api

* Convert upate vars message to new api

* Convert owner message to new api

* Convert pong message to new api

* Convert RPC message to new api

* Convert SyncEvent rpc to new api

* Refactor Command to new api

* Refactor Ping to new api

* Convert ErrorMessage to new api

* Convert ErrorMessage to new api

* Use int instead of short for message id to avoid collisions

* Keep only 16 bit hash for message id

* Converted Disconnect Message to new api

* Convert Connect to new message api

* Convert not ready message to new api

* Convert scene message to new api

* the Enum is no longer used for message id

* Add non obsolete version of SendToClient

* Document how to use new API

With this PR,  we no longer use Message id,  document the proper use of the api

* use C# syntax highlight

* Update NetworkMessages.md (#5)

Punctuation changes, added `cs` to code blocks.

* Write message id in short instead of packed int

* Use packer method with id

* Pass the NetworkConnection to the client message handlers
2019-03-03 14:52:35 +01:00
rodolphito
834fab5ba4 Changed several mentions of UNet to instead say Mirror. (#531) 2019-03-03 10:34:23 +01:00
rodolphito
8b2f99b3c4 Made SetDynamicAssetId a setter on the assetId property. (#530)
* Made SetDynamicAssetId a setter on the assetId property.

* Update NetworkIdentity.cs
2019-03-03 10:32:49 +01:00
rodolphito
c0ba0073b2 Removed RequireComponent(Animator) because NetworkAnimator does not have to be on the same game object as the Animator. (#529) 2019-03-03 10:30:59 +01:00
rodolphito
bc9982e187 Remove useless comment (#528) 2019-03-02 23:25:10 -06:00
rodolphito
d9be5cf941 Update tooltip in NetworkTransform. (#527) 2019-03-02 23:13:38 -06:00
MrGadget
24b8003b74
Fixed guidance for hostId
It should be `typeof(NetworkConnection)`
2019-03-02 22:46:12 -05:00
MrGadget
11a755e961 Restored GetConnectionInfo with [Obsolete] (#504)
* Restored GetConnectionInfo with [Obsolete]

* Update Transport.cs

* Update Transport.cs

* Update Transport.cs
2019-03-02 21:03:26 +01:00
vis2k
ce723a62ff Ninja.Websockets license.meta file generated by Unity 2019-03-02 10:27:48 +01:00
vis2k
c4f436d71e Rebuild Weaver.dll 2019-03-02 09:55:37 +01:00
Zac North
7da51e62ff Removed an unused override in the Example NetworkLobbyPlayer (#521) 2019-03-02 09:53:36 +01:00
vis2k
cfc5a0888f Rebuild Weaver.dll 2019-03-02 09:46:26 +01:00
c6burns
92596de38a Weaver follow on pr to 490 (#519)
* removed workaround from previous cecil version that now causes sharing violation console warning

* fixed language feature error -- null prop op is C#4 but .sln target is net35

* separated editor logging (required) from console logging (optional)

* fix issue introduced by flipping boolean property meaning in 9895bff

* added updated weaver assembly

* updated to release assembly - wrong assembly in ef0c903

* commenting weave target debug log to retain prev behaviour (oops)
2019-03-02 09:45:38 +01:00
vis2k
400382be76 ProximityChecker NonAlloc to avoid GC (see https://github.com/vis2k/Mirror/pull/228/) 2019-03-01 22:51:49 +01:00
Zac North
d41701e0c5 Added a license for Ninja.WebSockets (#518) 2019-03-01 21:29:02 +01:00
vis2k
32b9fcc987 Remove old comment 2019-03-01 15:30:20 +01:00
vis2k
0e5181f26a NetworkClient: move PrepareForConnect code into Connect 2019-03-01 15:29:55 +01:00
rodolphito
6b6d2b00a5 Spaces around equal signs. (#515) 2019-03-01 15:26:20 +01:00
rodolphito
4d40ddb891 Minor style fixes. (#514) 2019-03-01 15:01:42 +01:00
rodolphito
5a9f10ec47 Made member accessor debug logs consistent. (#513) 2019-03-01 07:29:38 -06:00
rodolphito
1e13ef5c31 Made it more clear that the checkboxes on the NetworkAnimator are referring to whether the parameter should be synced or not. (#512) 2019-03-01 11:45:01 +01:00
vis2k
fcc3f06feb
move RegisterSystemHandlers from ClientScene to NetworkClient. There is no reason why it should be in ClientScene, especially since it passes a NetworkClient, which is very strange. Additionally, not all delegates are in ClientScene anyway (like NetworkTime) (#473) 2019-03-01 11:38:00 +01:00
rodolphito
e30ec76581 Made client authority setter internal to remove internal setter method. (#508) 2019-03-01 01:18:20 -06:00
Paul Pacheco
32c89f4f33 Use property setter instead of custom setter 2019-03-01 01:11:46 -06:00
rodolphito
848e9cfbe9 Removed unused line. (#506) 2019-03-01 01:07:08 -06:00
Zac North
fbada30e01 Changed WebSockets default port to 7778 in case we add Multiplex (#503) 2019-02-28 22:55:12 +01:00
Zac North
8f041331de Fix WebSocket transport default port (#502) 2019-02-28 22:13:34 +01:00
Zac North
abf95651e2 Added modified version of Paul's 2018 WebSockets transport (#369)
* Added modified version of Paul's 2018 WebSockets transport, modifications include:
- Basic support for WSS
- Event format converted to master event format (UnityEvents)

* Fixed indentation and added support for Available()

* Manually merged in Paul's changes for latest version of Transport

* Added comment to CertVerificationCallback to reflect new research done in live environment.

* Added NoDelay option and merged in some minor renames from 2018 branch version
2019-02-28 20:53:22 +01:00
MrGadget
c8a12eb12e Update Readme.txt (#498)
Removed GitHub link
Added notice to restart unity after import
2019-02-28 18:38:01 +01:00
Lymdun
73f822d9b7 Weaver - My kingdom for some tests (#490)
* Added custom assembly compiler for easier testing

* Added weaver tests

* Added controls to silence Weaver logging and collect logs

* Update weaver dll

* Added new weaver test fixture and tests

* Connected WeaveFailed property to weave result status

* Removed useless meta files

* Removed useless comment

* Fix artifacts deletion

* Moved to [SetUp]

* Removed logs noise
2019-02-28 17:22:18 +01:00
vis2k
a28355d771 Weaver: remove unused ULocalConnectionToClientType 2019-02-28 15:44:18 +01:00
vis2k
cbeea38298
move Command NetworkClient.active check out of weaver (#494) 2019-02-28 15:23:04 +01:00
vis2k
9f0c485b7d
move TargetRpc NetworkServer.active and conn is ULocalConnectionToServer check out of weaver (#492) (#491) 2019-02-28 15:21:07 +01:00
vis2k
d7b6c8556f
move TargetRpc NetworkServer.active and conn is ULocalConnectionToServer check out of weaver (#492) 2019-02-28 15:18:52 +01:00
vis2k
8d96dd77cd Fix trailing whitespace 2019-02-28 13:57:46 +01:00
MichalPetryka
5ac23dd231 More using cleanup (#489) 2019-02-28 12:36:21 +01:00
MichalPetryka
97fc7aca4c Use type keywords (#472)
* Use type keywords

* Update
2019-02-28 12:21:27 +01:00
SuperCables
2b429c9b3a This doesn't sync slow rotating objects (#428)
* This doesn't sync slow rotating objects

The function sets lastRotation to the current rotation every frame, regardless of whether or not it detected a change. Because comparing two similar, but different Quaternions return true, only quickly rotating objects will return true; slow turning objects will return false, and the rotation will not be synced. By not updating lastRotation until a difference is spotted, any rotation will be synced.
This fix allowed my slow rotating spaceship to sync rotation.
TL;DR
lastRotation should be the last time this function returned true, not the rotation last frame.

* Update NetworkTransformBase.cs
2019-02-28 12:19:09 +01:00
rodolphito
7ecd66d6ec Transport.activeTransport instead of NetworkManager.singleton.transport (#479)
* Created Transport.activeTransport to decrease NetworkManager god status.

* Fixed NetworkManagerHUD. (I forgot I had deleted it temporarily for testing)
2019-02-28 11:58:37 +01:00
MichalPetryka
c33c72e720 Using cleanup (#452) 2019-02-28 11:44:55 +01:00
rodolphito
c13f4bd13b Used Expression Body Members to make code smaller and nicer in NetworkIdentity. (#486) 2019-02-28 10:20:57 +01:00
rodolphito
2d37a9e87c First pass of moving stuff out of UNetwork. (#481) 2019-02-28 09:42:03 +01:00
Paul Pacheco
d39f999f0f Simplify with auto property 2019-02-27 22:12:19 -06:00
rodolphito
51458762d4 Split Utils into FloatBytePacker and NetworkManager. (#483) 2019-02-27 21:47:37 -06:00
rodolphito
96133d1583 Removed useless proxy methods and substituted in direct property modification. (#454) 2019-02-27 18:33:10 -06:00
rodolphito
82535b0a8c Moved SceneAttribute into CustomAttribute. (#470) 2019-02-27 18:32:13 -06:00
MichalPetryka
f746ba8b08 Hide obsolete warnings (#476) 2019-02-27 17:06:13 +01:00
MrGadget
e7e890988d Re-applied GetActiveScene (#474) 2019-02-27 15:57:33 +01:00
vis2k
732111c1b9 add obsolete hostId again for easier transition from UNET 2019-02-27 15:43:35 +01:00
vis2k
26a9b5670d NetworkClient.allClients added as obsolete 2019-02-27 15:24:44 +01:00
rodolphito
dbd5f57e96 Remove List.ForEach on hot path. (#467)
* Remove LINQ on hot path.

* Fixed erroneous classification of List.ForEach as LINQ.

* Added back using so that it could be removed by #452.
2019-02-27 15:11:52 +01:00
rodolphito
d9a64c62b7 Move NetworkProximityChecker to ../Components/. (#471) 2019-02-27 14:39:44 +01:00
MichalPetryka
a3a10e82f2 Use string interpolation expressions (#469) 2019-02-27 14:37:54 +01:00
vis2k
6630b0bdbf
Move NetworkIdentity.UNetStaticUpdate to NetworkManager.Update. There is no reason why it should be in NetworkIdentity. (#457) 2019-02-27 14:36:53 +01:00
vis2k
b1c028a067 Rename Protocol to MessagePacker(#444) 2019-02-27 14:36:09 +01:00
vis2k
07a5cca725 NetworkConnection.isConnected obsolete 2019-02-27 14:32:15 +01:00
MichalPetryka
ffda610f0d Use nameof expression (#468) 2019-02-27 14:27:52 +01:00
rodolphito
0114a36fe1 Expanded symbols in test comments to english. (#465) 2019-02-27 09:42:50 +01:00
vis2k
81d031c6a1 Rebuild weaver.dll 2019-02-27 09:39:53 +01:00
Lymdun
cb432a12fb Weaver aesthetic (#455)
* Renamed lists to WeaveList

* Renamed scriptDef to CurrentAssembly

* Renamed corLib to CorLibModule

* Renamed m_UnityAssemblyDefinition to UnityAssembly

* Renamed m_UNetAssemblyDefinition to NetAssembly

* Renamed MaxRecursionCount  to m_kMaxRecursionCount

* Renamed s_RecursionCount to m_recursionCount

* Renamed m_DebugFlag to m_debugLogEnabled

* Moved properties & fixed comment

* Renamed fail to WeavingFailed

* Renamed generateLogErros to GenerateLogErrors

* Removed UNET references

* Updated dll

* WeaveLists better than WeaveList

* Removed m_ prefix

* Updated dll
2019-02-27 09:38:17 +01:00