Search Unity

Testing network multiplayer game

Discussion in 'Testing & Automation' started by abegue, Jul 3, 2020.

  1. abegue


    Jan 28, 2019

    I am trying to figure how I could create automation test for a network multiplayer game (actually, also in VR but maybe I could replace with some fake players without VR).

    I am searching for existing tool or a way to create my own if they doesn't exist.
    The only way I see right now is to create a build to launch multiple Unity instances and try to play an automatized game, making some checks. But it seems to be a pretty tedious way.

    I already met the issue a long time ago and I've created a system to build and run multiple instances (starting as a server and clients from command line arguments), but as I said... tedious.

    Be able to use Unity Unit Tests should be great, but I would have to create multiple Unity isolated scene instances. Could not find anything about it, but I am not even sure what words I should search for.
    Is that a possible thing? Or a least simulate, by re-creating an "engine play loop" ?

    In a more global view, how network multiplayer games are tested?
  2. superpig


    Drink more water! Unity Technologies

    Jan 16, 2011
    Unfortunately, I think there isn't a much better option in regular Unity unless you have done a lot to structure your project so that it can support it - e.g. using multiple scenes for the 'multiple scene instances' and making sure that everything you write is appropriately isolated. Building and puppeteering multiple instances of the player might be the best choice.

    In DOTS, we do support the concept of multiple 'worlds', specifically for things like isolating data from different players in a multiplayer scenario.
    ModLunar likes this.
  3. abegue


    Jan 28, 2019
    Thank you for your reply!

    I am at the really beginning of the project so maybe I could start the structure to support multiple scenes.
    But I am not really sure to understand about the multiple scenes method. Should it be like:
    - create a main scene (containing the server logic for example)
    - load additive scene for each client
    - simulate network behavior (if client A spawn GameObject O, then server spawn O' in all additive scenes and synchronize them). Kind of mock network system?

    After all, if I can test that the mock network system match correctly the real network system, then all tests that result from it should be ok too.
    And so, I could make really simple test environments and have a better control on my tests (control how much clients I want, simulate everything, debug with Inspector and stuff.
    I could create like 6 copies of the same environment, add one agent representing a player, automatizing its actions/scenarios and watch if everything is okay. Could be a great way to test.
    I have to think more about it and see if our custom network solution could implement that "mock network system".

    Thanks again!