Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport Rewrite #679

Closed
wants to merge 40 commits into from
Closed

Transport Rewrite #679

wants to merge 40 commits into from

Conversation

James-Frowen
Copy link
Member

@James-Frowen James-Frowen commented Mar 9, 2021

Todo:

  • multithread support
  • validate new connections
    • key/phrase
    • hashcash
  • decide on Key for Connection (replaces EndPoint)

This needs to split into smaller PR:

  • Rename NetworkConnection To NetworkPlayer (refactor: renaming NetworkConnection to NetworkPlayer #684)
    • Update uses of NetworkPlayer
  • Remove INetworkPlayer, use smaller interfaces instead
    • Split INetworkPlayer
  • Remove Nofity from NetworkConnection
  • Replace Transport with Peer
  • Replacce ObjectManagers with World
  • Remove Channels (use bool instead?)

Resources:

Concepts

World

  • List of NetworkIdentities
  • List of Player
  • Handles message

InterestManagerment (AOI)

  • uses List of NetworkIdentities and List of Player
  • decides which player can see which Identity

Player

  • owns NetworkIdentities
  • views NetworkIdentities (controled by AOI/Visbility)
  • has a connection (optional)

Peer

  • gate keeper
  • has list of connections

ISocket

  • gate to outside World

connections

  • has list of players
  • can send and receive data (raw byte)
    • can be reliable/unreliable/notify

messages

  • unpacked/deserialized form of raw byte
  • has message Id
  • messages are sent between Machines, no sending remote message to local handlers

Machines

  • unity instance

RPC

  • function that exists on GameObjects
  • Rpc target players
  • if player has no connection, invoke locally
  • if player has connection, invoke remotely
  • if "send to all" repeat above for each player

/// <para>Should be called after Poll</para>
/// </summary>
/// <param name="data">recieved data</param>
void Recieve(byte[] data, ref EndPoint endPoint, out int bytesReceived);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
void Recieve(byte[] data, ref EndPoint endPoint, out int bytesReceived);
int Recieve(byte[] data, ref EndPoint endPoint);

no out parameters please

@sonarcloud
Copy link

sonarcloud bot commented Mar 11, 2021

James-Frowen added a commit that referenced this pull request Mar 12, 2021
part of Transport rewrite #679

BREAKING CHANGE: renaming NetworkConnection to NetworkPlayer
James-Frowen added a commit that referenced this pull request Mar 12, 2021
* refactor: renaming NetworkConnection to NetworkPlayer

part of Transport rewrite #679

BREAKING CHANGE: renaming NetworkConnection to NetworkPlayer

* renaming types in weaver tests

* fixing test message

* fixing xref in docs
@James-Frowen James-Frowen changed the title perf: rewriting transport Architecture Rewrite Mar 12, 2021
/// <para>Should be called after Poll</para>
/// </summary>
/// <param name="data">recieved data</param>
void Recieve(byte[] data, ref EndPoint endPoint, out int bytesReceived);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a typo. It should be Receive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this, I'll make sure fix this soon

@James-Frowen James-Frowen changed the title Architecture Rewrite Transport Rewrite Mar 23, 2021
Squashed commit of the following:

commit b82b889
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 25 16:31:39 2021 +0000

    removing localplayer field until it is moved

commit ba048f5
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 25 02:08:18 2021 +0000

    moving Time back to Server/Client

commit a4260fc
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 25 01:06:35 2021 +0000

    adding after applying spawn payload, and only if new object

commit 8be19f9
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 23:56:05 2021 +0000

    fixing null

commit 6c85f7f
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 23:54:55 2021 +0000

    fixing tests

commit 63b8f7b
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 23:54:50 2021 +0000

    creating NetworkWorld

    - creating netwokrworld for object collection
    - moving collection from objectmanager to networkworld
    - moving events from collection to networkworld
    - adding add and remove methods to network world

commit 9e1391d
Merge: c6907cd 2d181b0
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 16:02:18 2021 +0000

    Merge branch 'network-world-5' into temp1

commit c6907cd
Merge: 5e578ee 826c675
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 16:02:16 2021 +0000

    Merge branch 'network-world-4' into temp1

commit 5e578ee
Merge: 94d2869 89ff2aa
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 16:02:15 2021 +0000

    Merge branch 'network-world-3' into temp1

commit 2d181b0
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 24 00:20:26 2021 +0000

    using SyncVarReceiver from com

commit d2e24ef
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 16:05:18 2021 +0000

    refactor: moving syncvar recieve to its own class

commit 826c675
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 19:21:22 2021 +0000

    yielding before calling start

commit 65c2ee8
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 15:54:00 2021 +0000

    renaming ServerUpdate to UpdateVars

commit d082f8c
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 15:52:13 2021 +0000

    refactor: moving syncvar sending to its own class

    BREAKING CHANGE: Dirty object collection is now inside SyncVarSender

commit 89ff2aa
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 18:31:30 2021 +0000

    adding properties to interface

commit 57222bb
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 18:28:13 2021 +0000

    fixing null check

commit dd09f60
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 15:41:04 2021 +0000

    refactor: using interface instead of network server

    BREAKING CHANGE: fields and parameters using NetworkServer are now using INetworkServer Instead

commit 94d2869
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 23 15:38:16 2021 +0000

    refactor: using interface instead of network client

    BREAKING CHANGE: fields and parameters using NetworkClient are now using INetworkClient Instead
Squashed commit of the following:

commit f4482f0
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 25 18:13:10 2021 +0000

    fixing compile errors

commit 3671187
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 18 23:52:02 2021 +0000

    using field instead of new references to server/client

commit 087fa7c
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 18 17:13:45 2021 +0000

    fixing use of arg

commit f613f07
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 18 17:04:15 2021 +0000

    fixing handler snot being called

commit f2ecca2
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Thu Mar 18 16:21:00 2021 +0000

    fixing weaver not registering messages

commit 9bfee51
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 16:12:32 2021 +0000

    using interface

commit 03aba30
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 16:12:18 2021 +0000

    marking player as sealed

commit ff750b3
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 14:34:05 2021 +0000

    fixing hostmode

commit a80c56a
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 14:34:01 2021 +0000

    adding test to check setup passes

commit e8f9675
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 14:16:20 2021 +0000

    fixing compile errors in editor tests

commit 0e97990
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 14:08:27 2021 +0000

    fixing compile errors in weaver

commit 1f933a6
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 14:08:12 2021 +0000

    fixing compile errrors in examples

commit 4fc79de
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 14:06:39 2021 +0000

    fixing compile errors in tests

commit 6e4e9da
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 13:56:33 2021 +0000

    adding use of message broke to authenticator

commit d94df03
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:46:05 2021 +0000

    fixing setup

commit 133fe5c
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:37:21 2021 +0000

    renaming test file

commit 75993f7
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:36:47 2021 +0000

    converting NetworkConnection to MessageBroker tests

commit 2b72d81
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:36:16 2021 +0000

    adding Substitute for message handler to test connections

commit 2346172
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:25:53 2021 +0000

    using message handler instead of player

commit b82addc
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:24:46 2021 +0000

    fixing property name

commit 6ffafcb
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:23:45 2021 +0000

    adding MessageHandler to NetworkClient and NetworkServer

commit e6a067b
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 02:11:10 2021 +0000

    adding send passthrough methods to player

commit 5b9094c
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Wed Mar 17 01:54:37 2021 +0000

    fixing compile errors in MessageBroker

    moving MessageBroker to its own file

commit 00dd029
Author: James Frowen <jamesfrowendev@gmail.com>
Date:   Tue Mar 16 18:07:04 2021 +0000

    refactor: moving message sendinng handler to new class

    BREAKING CHANGE: todo

commit 2bccd16
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Wed Mar 24 21:36:44 2021 +0000

    chore(release): 84.0.0 [skip ci]

    * using interface instead of network server ([#722](#722)) ([7312bd8](7312bd8))

    * fields and parameters using NetworkServer are now using INetworkServer Instead

commit 7312bd8
Author: James Frowen <jamesfrowen5@gmail.com>
Date:   Wed Mar 24 21:24:04 2021 +0000

    refactor: using interface instead of network server (#722)

    BREAKING CHANGE: fields and parameters using NetworkServer are now using INetworkServer Instead

commit 4ff53ec
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date:   Wed Mar 24 21:21:02 2021 +0000

    chore(release): 83.0.0 [skip ci]

    * using interface instead of network client ([#721](#721)) ([703596a](703596a))

    * fields and parameters using NetworkClient are now using INetworkClient Instead

commit 703596a
Author: James Frowen <jamesfrowen5@gmail.com>
Date:   Wed Mar 24 21:06:14 2021 +0000

    refactor: using interface instead of network client (#721)

    BREAKING CHANGE: fields and parameters using NetworkClient are now using INetworkClient Instead

commit 5be7c6a
Author: James Frowen <jamesfrowen5@gmail.com>
Date:   Wed Mar 24 20:08:04 2021 +0000

    refactor: resetting Id on stop server (#717)

    keep ids small if server is stoped and started

commit 913c423
Author: James Frowen <jamesfrowen5@gmail.com>
Date:   Wed Mar 24 20:06:57 2021 +0000

    refactor: adding checked to GetNextNetworkId (#716)

    if id wraps it will cause problems. max value should never be reached but throw incase it does rather than warpping silently
@James-Frowen
Copy link
Member Author

new branch #749

@James-Frowen James-Frowen deleted the transport-v2 branch March 30, 2021 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants