Commit Graph

1495 Commits

Author SHA1 Message Date
Paul Pacheco
b7e977a7a3
synclist code generator is now reusable (#624)
* refactor: Made serializer generation reusable

* refactor: SyncList code generator is reusable for other structs
2019-03-22 06:44:57 -05:00
vis2k
1d166c699a add comment 2019-03-22 12:24:22 +01:00
vis2k
694185b756 NetworkServer.SpawnObserversForConnection helper function instead of doing it all in SetClientReady 2019-03-22 12:23:33 +01:00
vis2k
009943f368 remove outdated comment 2019-03-22 12:10:13 +01:00
vis2k
c3bd7d6e07 NetworkServer.SetClientReady: get rid of 'continue' 2019-03-22 12:09:22 +01:00
vis2k
400bb91821 NetworkServer.SetClientReady: remove unnecessary null check because we don't have one in the above foreach either, and we don't have them anywhere else for NetworkIdentity.spawned because OnDestroy removes objects from it before they become null. The only way to cause this would be by calling Destroy(GetComponent<NetworkIdentity>()) - which no one does, and if someone does it then it's fine to get an exception here. 2019-03-22 12:08:47 +01:00
vis2k
9567daedba add comments 2019-03-22 12:06:13 +01:00
vis2k
b869e3af99 improve comment 2019-03-22 12:04:25 +01:00
vis2k
c176da7bc3 NetworkServer.SetClientReady: use if+else instead of if + early return 2019-03-22 12:00:16 +01:00
vis2k
0e8b442cad add some ocmments 2019-03-22 11:59:12 +01:00
vis2k
f6a6440294 NetworkServer.SetClientReady: move isReady=true upwards 2019-03-22 11:57:27 +01:00
vis2k
47d5ee976e remove unused variable 2019-03-22 11:53:42 +01:00
Paul Pacheco
6f19489721
feature(synclist): allow SyncList of primitive types (#622)
* feature(synclist): allow SyncList of primitive types

As it turns out this never really worked:
```cs
class SyncListByte : SyncList<byte> {};
```

You had to write your own serializeItem / deserialize item for native types.

This change lifts the restriction, now you can use a synclist of anything that mirror can serialize/deserialize

* fix: fix unit tests error messages
2019-03-22 05:51:20 -05:00
vis2k
aa5e5a104f ClientScene.s_PendingOwnerNetIds converted to HashSet 2019-03-22 10:10:53 +01:00
vis2k
0d6b03989a NetworkServer.InternalAddPlayerForConnection moved into AddPlayerForConnection because there is no reason to keep it in an internal method anymore, since NetworkServer is static now 2019-03-22 10:04:14 +01:00
vis2k
fb2131207c NetworkServer.InternalAddPlayerForConnection: reuse 'identity' for log message 2019-03-22 10:03:00 +01:00
vis2k
4f53f37dc8 NetworkServer.InternalAddPlayerForConnection: rename playerGameObject parameter for consistency 2019-03-22 10:02:30 +01:00
vis2k
75e51513db added the log message again too 2019-03-22 09:58:04 +01:00
vis2k
1a55c3d52d NetworkManager: move OnServerAddPlayerInternal code into OnServerAddPlayer because it was really just the implementation for OnServerAddPlayer moved into another function 2019-03-22 09:53:21 +01:00
vis2k
4b4dd179cc sort regular and obsolete OnServerAddPlayer functions 2019-03-22 09:51:27 +01:00
vis2k
a39954003a NetworkManager.RegisterServerMessages for AddPlayerMessage uses OnServerAddPlayer directly instead of wrapping it with a OnServerAddPlayerMessageInternal function 2019-03-22 09:46:14 +01:00
vis2k
fa4efa6683 syntax 2019-03-21 18:12:34 +01:00
vis2k
155764cea8 simplify NetworkIdentity.RebuildObservers 2019-03-21 17:58:15 +01:00
MrGadget
f0dd7549e6
Update ChangeLog.md 2019-03-21 09:47:08 -04:00
MrGadget
4ec42b564e
Update ChangeLog.md 2019-03-21 09:46:41 -04:00
MrGadget
f7db1100b3
Update ChangeLog.md 2019-03-21 09:35:27 -04:00
MrGadget
408896ef69
Update ChangeLog.md 2019-03-21 09:06:03 -04:00
vis2k
f90cdae3c6 fix #384: duplicating scene objects at runtime is now detected and and error is shown. otherwise the user could instantiate scene objects at runtime, which would then send the sceneId to the client, then the client wouldn't know which of the multiple objects to use for the sceneId, resulting in things getting out of sync. 2019-03-21 11:46:55 +01:00
Zac North
c9eac57ce8 fix: OnClientReady is called and passed the appropriate ready state value in NetworkLobbyPlayer (#618) 2019-03-21 02:27:25 -05:00
Martin Evans
28b067d3cd refactor: Generic IMessageBase to allow struct message types (#619)
* - Added a `IMessageBase` as an interface to `MessageBase`. Existing messages which inherit `MessageBase` (including ones which do not implement Serialize/Deserialize and rely on the weaver) will continue to work in exactly the same way as before!
 - Modified any methods which were generic `T where T : MessageBase` to be `T where T : IMessageBase`. this does not change things at all for all existing usages of the method.

These two changes allow end users to implement IMessageBase as a `struct` instead of `MessageBase` as a `class`, so they are no longer forced to allocate message objects in their own code.

* Update .gitignore

* Update Messages.cs

* Update MessageBaseTests.cs

* Update MessageBaseTests.cs

* Update MessageBaseTests.cs
2019-03-20 19:44:42 -05:00
Paul Pacheco
0fc408b3ea docs: document synclists 2019-03-20 06:49:27 -05:00
Paul Pacheco
9d043182bf feature: SyncList now support structs (#614)
Previously, if you wanted a synclist of structures,  you would do:  SyncListSTRUCT<MyStruct>
Now you can use SyncList<MyStruct>
SyncListSTRUCT is left there, but obsolete
2019-03-20 12:45:46 +01:00
vis2k
22640b5e62
Mirror List Server example (#611)
feature: Mirror List Server example
2019-03-20 09:38:53 +01:00
MrGadget
c2d16c6a5a
Update ChangeLog.md 2019-03-20 00:50:34 -04:00
Anthony Eckert
00961ccc9c feature: Add NoRotation to NetworkTransform (#616)
This allows you to leave rotation out of the NetworkTransform if you only need position.
Right now if you don't need sync rotation and set compression to Lots, it can move your object in ways not expected. This forces you to use no compression as a fix. Using more bandwidth for something you don't need. I think this is all that is needed, tested it in my game and it works.
2019-03-19 23:46:33 -05:00
Paul Pacheco
65a136b938
docs: test.md no longer needed 2019-03-19 18:01:15 -05:00
MrGadget
f54f0fbf12
Update ChangeLog.md 2019-03-19 13:24:11 -04:00
MrGadget
3d10f81c4e
Update ChangeLog.md 2019-03-19 13:23:41 -04:00
MrGadget
b004bccc2d
Update ChangeLog.md 2019-03-19 13:22:23 -04:00
Paul Pacheco
29d6111819 CI: Implement semantic versioning (#601)
* Semantic versioning

* Access env variable correctly

* Invoke semantic release

* Not an npm package

* fix(pencil): Testing making a patch release

* c: support feature and breaking as tags
2019-03-19 16:44:43 +01:00
MrGadget
5a1157fe4d
Update Showcase.md 2019-03-19 11:30:12 -04:00
MrGadget
2cf4312cb5
Added samutale image for showcase 2019-03-19 11:27:55 -04:00
Paul Pacheco
80bce0a626 refactor: rename SyncObjectProcessor -> SyncObjectInitializer
The name SyncObjectProcessor is confusing because it does not process syncobjects.   Instead it initializes syncobjects in a NetworkBehaviour.
this avoids the confusion with SyncListStructProcessor, that does process synclists to add serialization methods
2019-03-19 08:26:03 -05:00
Paul Pacheco
6e51e69e3d refactor: rename SyncListProcessor -> SyncListInitializer
SyncListProcessor is a very confusing name,  it does not process synclists at all,  instead it initializes synclists in the network behaviour.
This is more confusing especially since SyncListStructProcessor  does process the synclists to add serialization methods, and both of them normally work
in tandem in different parts of the code
2019-03-19 08:23:28 -05:00
vis2k
8f8856d320 remove targetrpc first parameter networkconnection test because it's optional now 2019-03-18 13:08:28 +01:00
Paul Pacheco
672711637f docs: fix #598 github link 2019-03-18 06:53:09 -05:00
MichalPetryka
c1707e5917 fix: Don't disconnect host (#608)
* Don't disconnect host

* Update NetworkConnection.cs
2019-03-18 09:38:51 +01:00
vis2k
ed6a93724f tanks: projectiles 2019-03-17 22:23:20 +01:00
vis2k
21327065f2 rename Examples/Movement to Examples/Tank 2019-03-17 21:46:53 +01:00
vis2k
97b4e26d8b movement: add a light to the tank 2019-03-17 21:46:18 +01:00