Commit Graph

408 Commits

Author SHA1 Message Date
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