Commit Graph

1406 Commits

Author SHA1 Message Date
vis2k
54d5ede3e7 UNetwork.Protocol handles message packing and unpacking in one place now, so that we don't construct/deconstruct size/type headers manually everywhere. This way we can change the header any time without worrying about missing it somewhere. 2018-08-06 18:50:11 +02:00
vis2k
f8618d216f NetworkConnection.HandleBytes: removed message processing loop because always exactly 1 message is processed when NetworkServer/NetworkClient call HandleBytes. This is why there are NetworkTransport.Receive while loops in NetworkServer/NetworkClient.Update already. 2018-08-06 16:20:23 +02:00
vis2k
372f628d42 NetworkConnection.HandleReader removed and code put into HandleBytes, because that's what HandleBytes does and we don't need that extra HandleBytes/HandleReader redundancy 2018-08-06 15:41:27 +02:00
vis2k
8dc9cc2ee8 LocalClient.InvokeHandlerOnClient removed because it wasn't used anymore after removing LocalClients redundancies before 2018-08-06 15:23:07 +02:00
vis2k
398fec3890 NetworkManager: removed some unnecessary empty white spaces 2018-08-06 15:20:16 +02:00
vis2k
16477bad12 NetworkWriter: removed some unnecessary empty spaces 2018-08-06 14:58:28 +02:00
vis2k
028a6c8e78 NetworkAnimator: removed NetworkWriter caching to reduce dependencies on NetworkWriter.SeekZero 2018-08-06 14:55:10 +02:00
vis2k
7751244048 NetworkManager greeting message updated from HLAPI Pro to HLAPI CE 2018-08-06 12:41:00 +02:00
vis2k
4384a7115a Removed some unnecessary whitespaces 2018-08-06 12:40:31 +02:00
vis2k
9fb8b071c6 LocalConnections: removed redundant functions. no need to overwrite SendByChannel, as NetworkConnection.SendByChannel calls SendBytes anyway. Also removed NetworkServer.InvokeHandler since it's not needed anymore. InvokeBytes is the way to go. 2018-08-06 12:36:02 +02:00
Paul Pacheco
8f44c9aabb Fix #11, clear dirty bits only during synchronization, not during spawn (#12) 2018-08-04 15:50:59 +02:00
Paul Pacheco
29bcd247fe
Merge pull request #14 from Lymdun/patch-2
Fix discord invite (other branches)
2018-08-04 08:07:00 -05:00
Lymdun
7d3cd6c3c3
Fix discord invite (other branches) 2018-08-04 15:03:53 +02:00
vis2k
ddc53e27cc NetworkConnection message logging improved: uses BitConverter instead of reinventing the wheel and always logs the complete message. Logging partial messages would cause a lot of problems when debugging. If we expected a message with length 20 and HLAPI shows only up to length 18, then this will be really difficult to debug. Also removed k_MaxMessageLogSize because it's not needed anymore. 2018-08-02 14:51:00 +02:00
vis2k
ee22bde50b Gitignore Rider 2018-08-01 12:40:33 +02:00
vis2k
6c80b054ac SendToTransport failed. error:WrongConnection error isn't shown anymore if someone disconnects, since this is expected behaviour and totally normal. 2018-07-28 15:54:56 +02:00
Paul Pacheco
d9418b1c84 Simplify OnSerialize generation
* Simplify generated serializer
* Add some comments to better understand what the weaver is generating
2018-07-27 16:22:43 +02:00
Paul Pacheco
497c6c5246 Provide a guideline for contributing code 2018-07-26 12:49:11 -07:00
vis2k
0ed342ecb8 NetworkConnection.SendBytes is now protected so that outside classes can't send random bytes to the client anymore. This is better & safer design and allows us to remove the redundant SendBytesToReady function 2018-07-26 21:09:59 +02:00
vis2k
3ceebaec78 SyncList uses SyncListMessage to reduce dependencies on SendBytes 2018-07-26 21:07:34 +02:00
vis2k
14fcafda0c NetworkIdentity.UNetUpdate uses UpdateVarsMessage to reduce depencies on SendBytes 2018-07-26 20:30:47 +02:00
vis2k
2b54665915 Weaver SyncEvent code doesn't manually construct the message anymore. The NetworkWriter is now passed to NetworkBehaviour.SendEventInternal, where the message is properly constructed. Reduces dependencies on NetworkConnection.SendBytes and avoids expensive GetComponent calls that the Weaver previously generated. 2018-07-26 20:09:51 +02:00
vis2k
83927f27b0 Weaver TargetRpc code doesn't manually construct the message anymore. The NetworkWriter is now passed to NetworkBehaviour.SendTargetRPCInternal, where the message is properly constructed. Reduces dependencies on NetworkConnection.SendBytes and avoids expensive GetComponent calls that the Weaver previously generated. 2018-07-26 19:33:38 +02:00
vis2k
1097d000ff Weaver Rpc code doesn't manually construct the message anymore. The NetworkWriter is now passed to NetworkBehaviour.SendRPCInternal, where the message is properly constructed. Reduces dependencies on NetworkConnection.SendBytes and avoids expensive GetComponent calls that the Weaver previously generated. 2018-07-26 19:15:42 +02:00
vis2k
75351927c1 Weaver Command code doesn't manually construct the message anymore. The NetworkWriter is now passed to NetworkBehaviour.SendCommandInternal, where the message is properly constructed. Reduces depencies on NetworkConnection.SendBytes and avoids expensive GetComponent calls that the Weaver previously generated. 2018-07-26 14:19:29 +02:00
vis2k
d7539fcef3 NetworkBehaviour.IsDirty: removed some empty trailing spaces 2018-07-26 12:54:18 +02:00
vis2k
2148351799 UNetBehaviourProcessor WriteMessage comments added to make this more obvious in the future. 2018-07-26 12:51:36 +02:00
vis2k
4b339931c5 UNetBehaviourProcessor: WriteCreateWriter Ldloc_0 call moved to WriteMessageSize. All kinds of WriteMessageX functions always load the writer, push the variable on the stack and then write it. Except WriteCreateWriter which didn't load the writer, they decided to do this in WriteCreateWriter right after it was created. This was terrible code because removing WriteMessageSize calls anywhere would break all following calls, since WriteCreateWriter already called Ldloc_0 and the next call like WriteMessageId would call Ldloc_0 again. 2018-07-26 12:36:44 +02:00
vis2k
74b830a696 NetworkTransform uses readyConnection.SendByChannel(msg) instead of manually constructing and finishing the message and sending raw bytes. 2018-07-25 18:26:35 +02:00
vis2k
b27da84e81 NetworkTransformChild uses readyConnection.SendByChannel(msg) instead of manually constructing and finishing the message and sending raw bytes. 2018-07-25 18:23:30 +02:00
vis2k
d7cf9dc95c AddPlayerMessage, RemovePlayerMessage read and write playerControllerId via packet int to save bandwidth and for consistency with OwnerMessage, which does it too. This is the best way to save playerControllerId bandwidth. The type should have been 'byte' everywhere, but changing it now would break compatibility with the original HLAPI. 2018-07-24 10:19:09 +02:00
vis2k
97af671924 Removed LobbyReadyToBeginMessage because it wasn't used anymore 2018-07-24 10:03:39 +02:00
vis2k
22729edf6e
Merge pull request #5 from paulpach/isdirty
Separate dirtiness and network channel
2018-07-23 22:11:07 +02:00
Paul Pacheco
ec92854058 Separate dirtiness and network channel. These are independent of each other 2018-07-23 09:46:32 -05:00
vis2k
9e4f074bca NetworkIdentity.OnSerializeAll/OnDeserializeAll uses a dirtyComponents bitmask so only the dirty ones are serialized and send over the network. NetworkIdentity.UNetUpdate uses new OnSerializeAll function. Previously UNetUpdate would serialize all components for all channels if any of the components for a given channelId was dirty. For 2 channels, UNetUpdate would serialize all components twice, for 3 channels it would serialize all components three times, etc. And instead of only serializing the dirty components, any one dirty component would cause serialization of all components in that channel. So for example, NetworkTime synchronization would trigger OnSerialize to be called for movement, health, etc. too. Not serializing everything for each channel should cut Bandwidth in half for most projects that use the regular Reliable/Unreliable channels. Only serializing the actual dirty components should reduce bandwidth even further. 2018-07-22 12:52:42 +02:00
vis2k
53bf414ff7 NetworkIdentity.UNetSerializeAllVars removed. NetworkServer.SendSpawnMessage uses OnSerializeAllSafely instead. 2018-07-22 12:52:42 +02:00
vis2k
2b06bcf5c0 NetworkIdentity: OnSerializeAllSafely/OnSerializeSafely/OnDeserializeAllSafely/OnDeserializeSafely (split into 'all' and 'one' components functions) 2018-07-22 12:52:42 +02:00
Paul Pacheco
910f01f837 Deploy artifacts to github releases 2018-07-21 11:56:44 -05:00
vis2k
9227eacbbf NetworkIdentity.UNetUpdate: component serialization size check moved to OnSerializeSafely so that it happens for both calling functions (UNetSerializeAllVars and UNetUpdate). Also simplifies UNetUpdate code and removes dependency on NetworkWriter.Position. 2018-07-21 15:38:53 +02:00
vis2k
b76680dfda NetworkIdentity.UNetUpdate: 'is any component with this channel dirty' code simplified 2018-07-21 15:38:53 +02:00
Paul Pacheco
9a3cb91ff9
Update appveyor link for github project 2018-07-21 08:27:04 -05:00
Paul Pacheco
250ea5c1f4
Merge pull request #2 from paulpach/artifacts
Zip up the output folder
2018-07-20 15:30:19 -05:00
Paul Pacheco
567b048a24 Zip up the output folder 2018-07-20 15:22:09 -05:00
Paul Pacheco
6c15378f90 Link branches to github instead of bitbucket 2018-07-20 14:13:54 -05:00
vis2k
2dd907fb28 MsgType.ObjectSpawn renamed to SpawnPrefab, ObjectSpawnScene renamed to SpawnSceneObject. Messages.ObjectSpawnMessage renamed to SpawnPrefabMessage, etc. to make it perfectly clear what the messages do in order to avoid any confusion. 2018-07-20 16:37:05 +02:00
vis2k
e0a2a373ed Syntax 2018-07-20 16:06:37 +02:00
vis2k
93309d563a NetworkServer.SendSpawnMessage: fixed a bug where the server would send the spawn packet with the wrong MsgType (ObjectSpawn instead of ObjectSpawnScene) for cases where NetworkManager.OnServerAddPlayer was overwritten to spawn a player object from the scene, instead of from a prefab, resulting in Client deserializaton NetworkReader bugs (failed to read past end of stream, etc.). Also added more comments to explain the control flow of the function. 2018-07-20 15:25:49 +02:00
vis2k
7c4eefa5f9 NetworkServer.SendSpawnMessage: removed unnecessary writer.Position > 0 check 2018-07-20 12:57:15 +02:00
vis2k
0f2b4db3aa Added unit test for NetworkWriter.ToArray() behaviour, because it's different from BinaryWriter.ToArray() behaviour. 2018-07-20 12:49:44 +02:00
vis2k
fc4080535b SendWriter functions removed to avoid redundancy with SendBytes. Simply call SendBytes(writer.ToArray()) instead. 2018-07-20 12:42:39 +02:00