Commit Graph

166 Commits

Author SHA1 Message Date
vis2k
a4cce5b3c5 Removed NetworkClient.m_MsgReader because it wasn't used anymore 2018-08-06 20:16:49 +02:00
vis2k
96f48fdbba NetworkWriter.SeekZero/StartMessage/FinishMessage removed because they aren't needed anymore after protocol update 2018-08-06 18:53:24 +02:00
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
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
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
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
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
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
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
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
fc4080535b SendWriter functions removed to avoid redundancy with SendBytes. Simply call SendBytes(writer.ToArray()) instead. 2018-07-20 12:42:39 +02:00
vis2k
2e9dc82e0e Removed numBytes parameter from all Send/SendBytes functions. Uses bytes.Length instead. 2018-07-20 12:29:51 +02:00
vis2k
e804fd71b0 NetworkTransform: removed NetworkWriter caching to simplify code and reduce state. 2018-07-20 11:50:30 +02:00
vis2k
38ca71ffde NetworkTransformChild: removed NetworkWriter caching to simplify code and reduce state. 2018-07-20 11:48:33 +02:00
vis2k
9852923982 LocalConnection.Send/SendUnreliable reuse SendByChannel function 2018-07-20 11:35:20 +02:00
vis2k
daaa9f6d17 NetworkDiscovery.OnGUI improved. Uses GUILayout now instead of manually spacing y. 2018-07-20 11:16:00 +02:00
vis2k
565e5560f9 NetworkManagerHUD improved: OnGUI uses GUILayout instead of manually spacing y. Update hotkeys removed because they didn't really offer anything of value. [SerializeField] removed from public fields because it's redundant. 2018-07-20 11:09:24 +02:00
vis2k
06f0967eda MsgType: removed unused messages 2018-07-20 00:57:32 +02:00
vis2k
ee2d0373eb UNetwork.MsgType converted to Enum. Easier + faster string conversion and more flexible code. 2018-07-19 21:03:00 +02:00
vis2k
7cea90460f NetworkMessageHandlers class removed because it was just a wrapper around a Dictionary with the added bonus of not allowing us to overwrite internal message handlers from the outside, which sucks. NetworkClient, NetworkServer, NetworkConnection all use a simple Dictionary now. 2018-07-19 20:48:37 +02:00
vis2k
00b1bc119d NetworkConnection: removed m_MessageInfo caching to simplify code and reduce state 2018-07-19 20:29:41 +02:00
vis2k
0e4f905a72 NetworkConnection.InvokeHandler error messages are now shown if handler not found for msgType instead of failing silently 2018-07-19 20:28:29 +02:00
Paul Pacheco
c5263ed7ac Merged in paulpach/hlapi-community-edition/norandombytes (pull request #38)
Don't allow end user to send random bytes
2018-07-19 16:14:16 +00:00