Commit Graph

23 Commits

Author SHA1 Message Date
Paul Pacheco
8f44c9aabb Fix #11, clear dirty bits only during synchronization, not during spawn (#12) 2018-08-04 15:50:59 +02:00
vis2k
14fcafda0c NetworkIdentity.UNetUpdate uses UpdateVarsMessage to reduce depencies on SendBytes 2018-07-26 20:30:47 +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
fc4080535b SendWriter functions removed to avoid redundancy with SendBytes. Simply call SendBytes(writer.ToArray()) instead. 2018-07-20 12:42:39 +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
dc10b8f9d6 NetworkHash128 simplified and comments added 2018-07-16 15:24:24 +02:00
Paul Pacheco
a6b62f1608 Simplify authority assignment 2018-07-03 07:35:09 -05:00
vis2k
59cc34eaa8 NetworkServer made entirely static, there was no real reason to have an instance since only one was active anyway. Reduces complexity, simplifies code. 2018-06-22 20:34:35 +02:00
vis2k
3a3f4267d5 NetworkServer.localConnections and localConnectionsFakeList replaced with .localConnection. The old lists were only for downwards compatibility, HLAPI didn't even use local connection lists anymore - it always contained only the m_localConnection entry. 2018-06-22 12:14:41 +02:00
vis2k
0a34efbaf4 NetworkReader/Writer use C#'s built in BinaryReader/Writer; removed NetworkBuffer; removed redundant .AsArray()/AsArraySegment() functions; removed unnecessary constructors 2018-06-22 09:32:19 +02:00
vis2k
a9d87b512e NetworkIdentity: removed static NetworkWriter caching to simplify code 2018-06-22 09:32:19 +02:00
vis2k
d8d3ee677e NetworkIdentity: syntax improvements to simplify code 2018-06-22 09:32:19 +02:00
vis2k
d976add1f8 NetworkIdentity.OnStartClient: isClient is set to true without checking if it's false 2018-06-12 22:32:04 +02:00
vis2k
3fe7e56ff5 NetworkIdentity.isServer simplified 2018-06-12 22:31:00 +02:00
vis2k
7fd77a0e4b NetworkWriter.Position type changed from 'short' to 'int' to fix a bug where writing >32kb into NetworkWriter would result in negative .Position 2018-06-08 15:30:54 +02:00
vis2k
de27baa1b4 Applied HLAPI 2018.1 downwards compatible improvements 2018-06-08 14:23:59 +02:00
vis2k
9980e5e713 OnSerializeSafely & OnDeserializeSafely, independent of sibling components and with detailed errors to avoid out of range exceptions if any one component failed or didn't read/write the expected amount 2018-06-08 10:45:24 +02:00
vis2k
1e77e191b3 HLAPI 2017.4 (from https://bitbucket.org/Unity-Technologies/networking/src 2017.3, which is the same for 2017.4) 2018-06-07 15:41:08 +02:00