Skip to content

test: sending multiple clients RPC messages in various combinations for RPC Queue validation purposes #635

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

Merged
merged 25 commits into from
Mar 24, 2021

Conversation

NoelStephensUnity
Copy link
Collaborator

@NoelStephensUnity NoelStephensUnity commented Mar 16, 2021

The following test can be used to verify that the RPC Queue allows for the sending of ClientRpcs to specific clients.
It has several "direct" methods of sending as is defined in the enum ClientCounterBehaviour.ClientRpcDirectTestingModes:

  • Single: This will send to a single client at a time
  • Striped: This will send to alternating client pairs at a time
  • Unified: This sends to all clients at the same time

Each direct testing mode sends a count value starting at 0 up to 100.
Each direct testing mode sends to all clients at least once during testing (sometimes twice in striped)
During direct testing mode the following is also tested:

  • all clients are updating the server with a continually growing counter
  • the server is updating all clients with a global counter

During all tests the following additional Rpc Tests are performed:

  • Send client to server no parameters and then multiple parameters
  • Send server to client no parameters and then multiple parameters

This removes the NetworkManager.Singleton dependencies from within the RpcQueueContainer and RpcQueueProcessor classes.
This further strengthens the RPC Queue system as a whole, will allow for multiple instances if RpcQueueContainer, removes a limitation I set in NetworkWriter.ReadAndWrite,  and provides unit testing capabilities required for new RPC Queue unit Tests.
The new rpc queue tests without all of the extra files associated with them.
Added some additional prefabs to make creating a new scene simpler.
Added a ManualTests folder where manual tests can live.
Added ClientRpcTesting scene that tests sending to one client, multiple clients, and all clients in many different combinations.
@NoelStephensUnity NoelStephensUnity marked this pull request as draft March 16, 2021 19:54
/// This creates a NetworkManger,
/// </summary>
/// <returns></returns>
public static bool StartNetworkManager()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit but this should probably be clear that it's starting a network manager as host

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added the capability for one to start the NetworkManager in Host, Server, or client mode. You should be able to switch modes during testing if one needed to test specific aspects of the Server or Client modes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please review adjustment.

Noticed there was an empty GameObject in the testing scene, so I removed it.
@NoelStephensUnity NoelStephensUnity marked this pull request as ready for review March 17, 2021 00:24
Condensed the initialization process.
Adjusted the comments to better match the user story (testing and what is being tested).
Adjusted-polished up some UI related items like the visual name or concept relating to a specific counter, etc.
Minor LF adjustment and permissions declaration for m_GlobalCounterOffset property
Just renamed the Rpc Test scene to better reflect that it tests client and server rpcs.
Added 4 new tests that send no parameters and multiple parameters both directions (server to client and vice versa).
@NoelStephensUnity NoelStephensUnity requested review from jeffreyrainy and removed request for LukeStampfli March 22, 2021 15:55
/// </summary>
public class ClientCounterBehaviour : NetworkBehaviour
{
private const float k_ProgressBarDivisor = 1.0f/200.0f;
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
private const float k_ProgressBarDivisor = 1.0f/200.0f;
private const float k_ProgressBarDivider = 1.0f/200.0f;

divider vs divisor? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually in this case it's neither, it's a scale-down factor ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually, it is used as a divisor in the code base... it just handles dividing into zero without having to check.
Divisor: a number by which another number is to be divided.

Comment on lines 40 to 63
private bool m_MutliParameterCanSend;

private int m_MutliParameterIntValue;
private int m_MutliParameterValuesCount;
private int m_MutliParameterNoneCount;
private int m_RpcMessagesSent;
private int m_GlobalCounter;
private int m_GlobalDirectCounter;
private int m_GlobalDirectCurrentClientIdIndex;
private int m_localClientCounter;
private int m_GlobalCounterOffset;
private int m_RpcPerSecond;
private int m_GlobalDirectScale;

private long m_MutliParameterLongValue;
private ulong m_LocalClientId;

private float m_MutliParameterFloatValue;
private float m_GlobalCounterDelay;
private float m_DirectGlobalCounterDelay;
private float m_LocalCounterDelay;
private float m_LocalMultiDelay;
private float m_RpcPerSecondTimer;
private float m_GlobalDirectFrequency;
Copy link
Contributor

@0xFA11 0xFA11 Mar 23, 2021

Choose a reason for hiding this comment

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

Suggested change
private bool m_MutliParameterCanSend;
private int m_MutliParameterIntValue;
private int m_MutliParameterValuesCount;
private int m_MutliParameterNoneCount;
private int m_RpcMessagesSent;
private int m_GlobalCounter;
private int m_GlobalDirectCounter;
private int m_GlobalDirectCurrentClientIdIndex;
private int m_localClientCounter;
private int m_GlobalCounterOffset;
private int m_RpcPerSecond;
private int m_GlobalDirectScale;
private long m_MutliParameterLongValue;
private ulong m_LocalClientId;
private float m_MutliParameterFloatValue;
private float m_GlobalCounterDelay;
private float m_DirectGlobalCounterDelay;
private float m_LocalCounterDelay;
private float m_LocalMultiDelay;
private float m_RpcPerSecondTimer;
private float m_GlobalDirectFrequency;
private bool m_MultiParameterCanSend;
private int m_MultiParameterIntValue;
private int m_MultiParameterValuesCount;
private int m_MultiParameterNoneCount;
private int m_RpcMessagesSent;
private int m_GlobalCounter;
private int m_GlobalDirectCounter;
private int m_GlobalDirectCurrentClientIdIndex;
private int m_LocalClientCounter;
private int m_GlobalCounterOffset;
private int m_RpcPerSecond;
private int m_GlobalDirectScale;
private long m_MultiParameterLongValue;
private ulong m_LocalClientId;
private float m_MultiParameterFloatValue;
private float m_GlobalCounterDelay;
private float m_DirectGlobalCounterDelay;
private float m_LocalCounterDelay;
private float m_LocalMultiDelay;
private float m_RpcPerSecondTimer;
private float m_GlobalDirectFrequency;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I applied this update in b798e82 which included all references to said variables.

mattwalsh-unity and others added 12 commits March 23, 2021 15:57
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Co-authored-by: M. Fatih MAR <mfatihmar@gmail.com>
Changed all occurrences of Mutli to Multi
Replaced all occurrences of Mutli to Multi
private int m_GlobalCounter;
private int m_GlobalDirectCounter;
private int m_GlobalDirectCurrentClientIdIndex;
private int m_localClientCounter;
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
private int m_localClientCounter;
private int m_LocalClientCounter;

😛

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

commit 50815a8 resolves this issue.

Copy link
Contributor

@0xFA11 0xFA11 left a comment

Choose a reason for hiding this comment

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

spaceship-it-to-the-moon 🚀

Minor PascalCase adjustment for private property m_LocalClientCounter.
@NoelStephensUnity NoelStephensUnity merged commit 1700973 into develop Mar 24, 2021
@NoelStephensUnity NoelStephensUnity deleted the test/multiclienttests branch March 24, 2021 20:50
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.

4 participants