Commit Graph

1266 Commits

Author SHA1 Message Date
vis2k
e969fcf26c More #if fixes (again) 2019-01-21 14:38:53 +01:00
petris
15c5926041 Fix #if 2019-01-20 09:28:17 -06:00
vis2k
3396e56133 Telepathy updated to latest version (Stop always returns and .Active is definitely false afterwards) 2019-01-20 14:26:24 +01:00
vis2k
12f0ba6a64 NetworkTransformBase: fix interpolation being applied to a client's object that he had authority over. fixes #273 2019-01-18 17:50:43 +01:00
vis2k
1b90647f72 Pong: only simulate ball physics on server. Fixes #304 2019-01-18 17:34:59 +01:00
vis2k
32ed3cb540 Pong: Use OnStartServer instead of Server and ServerCallback 2019-01-18 17:32:03 +01:00
vis2k
c975d87310 Syntax 2019-01-18 17:30:30 +01:00
vis2k
4e6d44f3f7 Fix typo 2019-01-18 17:30:15 +01:00
vis2k
c0b2a74c11 Move NetworkReader.ReadMessage to the actual ReadMessage function 2019-01-18 13:09:58 +01:00
vis2k
ce8ede3db3
OnServerAddPlayer uses NetworkMessage parameter instead of NetworkReader. Removes last dependency on NetworkReader.ReadMessage (#307) 2019-01-18 13:08:19 +01:00
vis2k
183afac99a
move startOnHeadless to NetworkManager (#309) 2019-01-18 13:04:05 +01:00
vis2k
904535409d Updated Telepathy to latest version (big endian headers) 2019-01-18 13:00:13 +01:00
vis2k
1c83c74da0
Transport components (#308)
* Convert Transport to component; remove websockets property

* Improve warning

* Automatically add default Transport if needed

* Added Transports to scenes

* Move port to Transport

* Detected too late

* Interface

* Virtual transport property just in case

* HUD shows transport.tostring

* LLAPITransport UseWebsockets option

* Remove bindToIp and ServerStart(ip) parameter. let transport handle it if needed.

* TelepathyTransport.ToString

* Remove unused function

* LLAPITransport.ToString

* Don't duplicate ports

remote endpoint already has the port.
If you have ipv6, it will show like this:
```[::]:7777```
[::] is localhost in IPv6

If you have ipv4, it will show like this:
```127.0.0.1:7777```

* Removed unused labels

* Syntax

* Updated Telepathy to latest version

* localendpoint
2019-01-17 18:14:05 +01:00
vis2k
4cf35eb9cd Updated Telepathy to latest version 2019-01-17 18:02:44 +01:00
Paul Pacheco
d8bcbe0c62 Start on Headless is optional 2019-01-16 23:13:05 -06:00
vis2k
0ef7bc2c5a Revert NetworkClient.UpdateClients foreach because it causes an InvalidOperationException when stopping the client. 2019-01-17 01:21:33 +01:00
vis2k
6738d95b28 NetworkConnection: removed unused imports 2019-01-16 22:24:25 +01:00
vis2k
123dbe8cd8 NetworkBehaviour: remove unnecessary 'private' modifiers 2019-01-16 22:23:22 +01:00
vis2k
8844616c33 LocalClient: remove unnecessary 'private' modifiers 2019-01-16 22:17:23 +01:00
vis2k
4ece68d053 OnObjectSpawnFinished message split into OnObjectSpawnStarted + OnObjectSpawnFinished. Saves 2 bytes of bandwidth per client spawn, and makes the code more obvious. 2019-01-16 22:10:08 +01:00
vis2k
7e9ed33448 Use actual type 2019-01-16 22:01:39 +01:00
vis2k
6cea00db0e Use actual type 2019-01-16 22:00:04 +01:00
vis2k
663dedff81 Use foreach 2019-01-16 21:59:13 +01:00
vis2k
6104d5bafe Use actual types 2019-01-16 21:55:24 +01:00
vis2k
c95fc2bf23 Use foreach instead of for-int 2019-01-16 21:52:53 +01:00
vis2k
edd8f99059 Remove unused imports 2019-01-16 21:49:11 +01:00
vis2k
28539c9d2f NetworkClient: m_MessageHandlers made public and renamed to handlers. No need to have a separate property, it can't be nulled anyway. 2019-01-16 21:48:44 +01:00
vis2k
76bd13c789 Changed Boolean to bool 2019-01-16 21:45:15 +01:00
vis2k
03f0355359 DestroyObject moved next to Destroy 2019-01-16 21:38:03 +01:00
vis2k
b2ab752bc0 DestroyObject moved into Destroy. No need to have an internal version anymore because no one can override Destroy anymore. 2019-01-16 20:51:15 +01:00
vis2k
cdd4948eb8 UnSpawnObject moved into UnSpawn because that's the only function that calls it anyway 2019-01-16 20:49:03 +01:00
vis2k
9891916ba0 UnSpawnObject moved into UnSpawn because that's the only function that called it anyway 2019-01-16 20:46:43 +01:00
vis2k
c6cf8aad02 InternalAddPlayerForConnection: call GetCOmponent directly 2019-01-16 20:43:06 +01:00
vis2k
892d894d0f InternalReplacePlayerForConnection: call GetComponent directly. 2019-01-16 20:42:31 +01:00
vis2k
7d439f0c20 SpawnObject: call GetComponent directly 2019-01-16 20:40:41 +01:00
vis2k
bd12048bd9 Update error message 2019-01-16 20:34:19 +01:00
vis2k
297c2974bd NetworkServer.SendToClientOfPlayer uses NetworkIdentity now too 2019-01-16 20:32:30 +01:00
vis2k
5774f725c6 Make NetworkServer fully static. sealed not needed anymore then either. 2019-01-16 20:24:45 +01:00
vis2k
8fe142c1a7 SendToAll: change syntax for consistency with SendToRead/SendToObservers 2019-01-16 19:44:19 +01:00
vis2k
f7fbbee8d1 OnDeserializeSafely: check that correct amount of bytes was read 2019-01-16 19:25:43 +01:00
vis2k
6688bc39c8 SendToObservers uses NetworkIdentity parameter now too 2019-01-16 15:15:56 +01:00
vis2k
6c32dd561d Syntax 2019-01-16 15:07:02 +01:00
vis2k
f95f127ed1 Syntax 2019-01-16 15:05:57 +01:00
vis2k
7e8c330475 SendToReady: removed context==null case where it would send to all ready connections. We never call it with null internally, and no one would assume to pass null there externally. Use SendToAll instead, or if needed we can add SendToAllReady in the future. 2019-01-16 14:49:23 +01:00
vis2k
32f77e41d4 NetworkServer.SendToReady uses NetworkIdentity to avoid two GetComponent calls per SendToReady: one for the old GetComponent<NetworkIdentity>, one for the callers which always used .gameObject before. 2019-01-16 14:47:38 +01:00
vis2k
dc9d12b67d Rename 'uv' to 'identity' 2019-01-16 12:15:45 +01:00
vis2k
59dd73b0f1 NetworkIdentity: no need to wrap the dict as property 2019-01-16 12:12:29 +01:00
vis2k
80ac56a23f Add comment 2019-01-16 12:09:30 +01:00
vis2k
63ac60a38c UNetUpdate: check observers==null because the rest of the code does that too at the moment 2019-01-16 12:09:01 +01:00
vis2k
70f1fe8c5b NetworkIdentity: move update methods next to each other 2019-01-16 12:08:37 +01:00
Paul Pacheco
f32ac7dfe6 Don't serialize the object if there are no observers (#300) 2019-01-16 12:07:59 +01:00
Paul Pacheco
4a8d780718 Do not pollute default namespace with examples 2019-01-15 17:44:17 -06:00
Paul Pacheco
9f06a5b55b Minimum Mirror example 2019-01-15 17:35:53 -06:00
vis2k
76a1407c42 MonoBehaviourProcessor: better variable naming 2019-01-16 00:16:02 +01:00
vis2k
7c1eaf7363 Use actual type 2019-01-16 00:15:36 +01:00
vis2k
0710ce8b8d Syntax 2019-01-16 00:14:25 +01:00
vis2k
0e344d7b3b Syntax 2019-01-16 00:13:31 +01:00
vis2k
1ad865e367 Syntax 2019-01-16 00:10:20 +01:00
vis2k
10ee102399 Fix comment typo 2019-01-16 00:09:43 +01:00
vis2k
4a1129d572 Syntax 2019-01-16 00:08:11 +01:00
vis2k
3fc094ae5d Use actual type 2019-01-16 00:06:43 +01:00
vis2k
324f277724 fix comment typo 2019-01-16 00:06:05 +01:00
vis2k
5633c63029 Helpers: use actual types 2019-01-16 00:04:48 +01:00
vis2k
6271acaec0 Fix comment typos 2019-01-15 23:52:24 +01:00
vis2k
9df0f0526d Better variable names 2019-01-15 23:51:38 +01:00
vis2k
40ea1cfec6 Fix typo 2019-01-15 23:50:55 +01:00
vis2k
7a73bf4d01 Use actual types 2019-01-15 23:49:45 +01:00
vis2k
f57b58a83e Sort modifiers 2019-01-15 23:33:28 +01:00
vis2k
7161126e67 GetReadFunc: use actual types. less magic. 2019-01-15 23:32:20 +01:00
vis2k
2def424a8a GetWriteFunc: use actual types so it's more obvious 2019-01-15 23:31:14 +01:00
vis2k
f816c8f8e0 Sort modifieds 2019-01-15 23:29:41 +01:00
vis2k
a5c0d3fafb Add a comment 2019-01-15 22:09:48 +01:00
Robin Rolf
c4f8b4eb8c Reduce garbage in IsDirty (#290)
* Reduce garbage & Improve performance in NetworkBehaviour.IsDirty

* Update NetworkBehaviour.cs

* Update NetworkBehaviour.cs
2019-01-15 22:07:58 +01:00
vis2k
745233ca99 NetworkAnimator uses parameters array instead of 6 param values 2019-01-15 22:04:31 +01:00
vis2k
3fe93cbe44
Deprecate FindLocalObject. no need to have it in clientscene and networkserver when there is NetworkIdentity.spawned already in one place. (#295) 2019-01-15 21:43:55 +01:00
Ed
c02c852be5 Issue #280 fix (#281) 2019-01-15 21:37:47 +01:00
vis2k
b4fa6f262c NetworkServer.DestroyPlayerForConnection uses NetworkIdentity.spawned instead of FindLocalObject 2019-01-15 16:52:36 +01:00
vis2k
9c672647a2 NetworkConnection.Dispose uses NetworkIdentity.spawned instead of FindLocalObject. Improves performance by avoiding one .gameObject call and one .GetComponent call. 2019-01-15 16:45:48 +01:00
vis2k
b9dca9c5aa NetworkConnection: use actual type instead of var so it's more obvious 2019-01-15 16:44:00 +01:00
vis2k
e1647d766d NetworkReader.ReadTransform uses NetworkIdentity.spawned instead of FindLocalObject 2019-01-15 16:43:14 +01:00
vis2k
434b778aa9 Weaver: removed findLocalObjectReference because it's not needed anymore. 2019-01-15 16:41:03 +01:00
vis2k
c96f44f73f Add a comment 2019-01-15 16:39:09 +01:00
vis2k
695d56af5f replacedEvents and replacementEvents combined into one replaceEvents dictionary. simplifies code and faster lookups. 2019-01-15 16:29:17 +01:00
vis2k
f10ca145b6 replacedMethods and replacementMethods combined into one replaceMethods Dictionary. Simplifies code and significantly speeds up weave time. uMMORPG script reload time in editor before: 7.6s, after: 5.75s (25% improvement). 2019-01-15 16:25:27 +01:00
vis2k
10fb2634c9 Use actual type 2019-01-15 16:06:27 +01:00
vis2k
29d71e6d43 Weaver: removed replacementMethodNames hashset which was only used for caching. Will be able to use a Dictionary<string, method> later. 2019-01-15 16:04:45 +01:00
vis2k
b13ba85f76 Use actual type so it's more obvious 2019-01-15 15:58:42 +01:00
vis2k
d016dc84f8 SyncVarProcessor.ProcessSyncVar: renamed netFieldId to netIdField because that's what it is 2019-01-15 15:57:30 +01:00
vis2k
940808567e Weaver: removed unused netIdFields list 2019-01-15 15:55:40 +01:00
vis2k
57b848cc34 SyncVarProcessor.syncVarNetIds converted to Dictionary for easier usage and to avoid the netIdFieldCounters 2019-01-15 15:54:45 +01:00
vis2k
70048fc380 Use actual types instead of var because it's not obvious 2019-01-15 15:44:20 +01:00
vis2k
83e32dfec7 Add comment 2019-01-15 15:41:20 +01:00
vis2k
a5e3ec35c1 ErrorMessage reuses ByteMessage 2019-01-15 15:39:19 +01:00
vis2k
b2fa2eebed Add ByteMessage 2019-01-15 15:38:30 +01:00
vis2k
2cc91f4b05 Syntax 2019-01-15 15:37:16 +01:00
vis2k
b75d215b2f Syntax 2019-01-15 15:37:03 +01:00
vis2k
80860c40b7 RemoteCallMessage that is reused by Command/Rpc/SyncEvent messages 2019-01-15 15:36:47 +01:00
vis2k
d94b1a2d89 AddPlayerMessage inherits from BytesMessage 2019-01-15 15:32:42 +01:00
vis2k
3fce3ae675 Syntax 2019-01-15 15:30:27 +01:00
vis2k
93c65dcb78 Telepathy updated to latest version (afbdb31) 2019-01-15 14:24:25 +01:00
vis2k
aedf976d4f
NetworkAnimator moved to components. Replace messages with Cmds/Rpcs (#294) 2019-01-15 13:11:36 +01:00
vis2k
853083a132 Forgot to remove TransformMessage 2019-01-15 13:10:29 +01:00
vis2k
ffced61058 NetworkTransform moved into Components folder so it can be weaved. Removed unnecessary messages. 2019-01-15 12:24:29 +01:00
vis2k
0343e829b4 Movement example: speed now based on frame rate 2019-01-15 12:20:50 +01:00
vis2k
8ff2ba74b3 Forgot to enable local player authority in movement example 2019-01-15 12:17:50 +01:00
vis2k
9ecbf40a95 Fix sceneId assignment showing warning for 0 scene objects. 2019-01-15 11:26:23 +01:00
vis2k
60c9cbd99a Fix sceneId assignment if scene not in build settings 2019-01-15 11:20:37 +01:00
vis2k
5b187fe0df Asset Store Examples added 2019-01-15 11:17:58 +01:00
Ed
39da48a740 Changed syncInterval value is not saved - fix (#293)
syncInterval resets back to 0.1f (Value that is set in the NetworkBehaviour class) if changed using the editor. The issue is present when changing both, scene objects as well as prefabs.
2019-01-15 10:07:33 +01:00
vis2k
43baeff444
[SyncVar] GameObjects are now 100% based on their underlying netId field. Fixes #149 (#292)
* fix

* Test file

* Syntax

* NetworkBehaviour.Set/GetSyncVarNetworkIdentity functions added

* add definitions to weaver

* Use them

* add NetworkIdentity cases everywhere else too

* ProcessInstructionSetter/GetterField replaces for OnDeserialize too, so that [SyncVar]GameObjects/NetworkIdentities work with custom On(De)Serialize as well

* Custom on(De)serialize test

* Weaver.ProcessSiteMethod doesn't ignore OnDeserialize anymore either

* [SyncVar] GameObject/NetworkIdentity hooks work again

* testscene

* public gameobject field test

* pass gameobject field to getsyncvargameobject etc.

* GetSyncVarGameObject/NetworkIdentity always returns the field if server, looks up netId otherwise; functions aren't static anymore.

* Use original OnSerialize generation again, so it simply calls writer.Write(go) on server, which sends the netId internally anyway.

* fixed hooks not using 'this.' because getter function isn't static anymore.

* add scene referencing test

* remove tests
2019-01-14 23:39:29 +01:00
Paul Pacheco
3c0ff33c94 Additive sceneloading sceneid fix (#175)
* Fix additive scene loading causing duplicate sceneIds by using an offset per scene.

* TEST: moved SpawnableObjects to NetworkIdentity. OnDisable adds it to the dict. SpawnObject removes it.

* Log if we don't find the spawn scene object

* Fix compilation issues

* Make PrepareToSpawnSceneObjects public
2019-01-14 22:00:13 +01:00
Paul Pacheco
1785039601 2018.3 master prefab changes etc. (#283)
* 2018.3 warning fix. The old way to check if something is a porefab is depricated so needs replacing with new code.

* 2018.3 warning fix. The old way to check if something is a porefab is depricated so needs replacing with new code.

* Bug fix for 2018.3+ where NetworkIdentity GUIDs are set to blank in prefab files and shown as blank in the editor.

* Another 2018.3 warning fix. The old way to check if something is a porefab is depricated so needs replacing with new code.

* Make sure it works in 2017.4

* Change not needed

* Revert "Change not needed"

This reverts commit 13747739df.

* Mark LLAPI as obsolete

* Don't use obsolete api

* Suppress obsolete LLAPI warning for now

* Remove warning

* Make conditional a little clearer
2019-01-14 11:24:30 +01:00
Hertzole
012e1a1885 Fixed scene reload. 2019-01-13 19:19:47 -06:00
vis2k
266f262665 WeaverLists.replacedFields and replacementProperties merged into replacementSetterProperties dict for easier code and more obvious naming. 2019-01-13 21:21:11 +01:00
vis2k
4fa584e72a Weaver.ProcessInstructionField renamed to ProcessInstructionSetterField 2019-01-13 21:19:19 +01:00
Paul Pacheco
524c183294 Source based instead of dll (#277)
* Ignore unity generated files and folders

* Import mirror as source

* Source based does not build dlls anymore

* nuget packages not used in source based

* Produce an archive with the release

* generate archive with Mirror folder to avoid accidents

* Deploy to github releases

* Document new installation procedures
2019-01-13 21:08:54 +01:00