Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Competitive multiplayer game without ECS?

Discussion in 'NetCode for ECS' started by PG13park, May 30, 2023.

  1. PG13park

    PG13park

    Joined:
    Apr 25, 2022
    Posts:
    18
    Is it possible for me to make a competitive multiplayer game that uses multiplay/game server hosting and matchmaker without having to learn ECS? It seems like I would have to use netcode for entities, but would I have to use ECS also? Also can someone tell me the reason netcode for Gameobjects could not be used to make a competitive experience?
     
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    882
    The reason Netcode for Gameobject cannot currently used for competitive multiplier (i.e FPS) is because it does not have a full support for client-side prediction, rollback, server-rewind/lag-compensation and many other little details.

    At the moment you need to learn Entities in order to proper use Netcode for Entities, that will make it possible to leverage a solution that is close/on-par with other offering (like Photon-Fusion), while tailored and meant to even larger scale games.
     
  3. PG13park

    PG13park

    Joined:
    Apr 25, 2022
    Posts:
    18
    Can you still use Game Server Hosting with netcode for Gameobjects if your game doesn’t need prediction, rollback, or lag compensation. Also is it possible to use both ECS and Mono behaviors in your game as long as you keep their interactions separate? One last thing are there ways around issues like roll back, like saving all transforms in the scene every couple minutes? And how would I even use client side prediction in a VR game?
     
  4. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    882
    If you don't need prediction, lag-compensation or other feature you can use Netcode for GameObject without problem.
    You can use ECS and Monobehavior (you need in all cases up to certain extent because of animation, sound etc etc) but in general:
    - your simulation code and simulation state should run in Entities (so systems). It is possible to use Monobehavior for that but requires extra logic and syncing that are not provided by default.
    - you can use Monobehavior and GameObject for presentation purpose (so animation, rendering, audio, etc)

    First of all: there people in the forum that are making VR games using Netcode for Entities (i.e @Occuros), so rest assured you can.

    You can use client-side prediction for you player character (and in particular the hands) and having even client-authority over the hand positions (so they are sent as part of the command to the server) for a better handling of and feeling of hand movement (that are never corrected by the server).
    All other players and entities can be still interpolated (so in the past) and smooth.

    If you don't want client-side prediction, you can configure you entity to be allays interpolated. And accept the fact the player have "latency" when issues command (like moving etc). That is not a great feeling for VR though.
    You always want you character to respond 1:1 to the player commands (well, some latency can be acceptable) so at least, head orientation, hand position etc must by "predicted", to let's say at least anticipated.

    In that case, you need to have a way to restore/overrides certain data received from the server in order to have it in sync with the player. Or, because they are client authoritative, they can be configured to be never sync back to the owner client, but to the other players. That give you the ability to avoid storing the backup.
     
  5. PG13park

    PG13park

    Joined:
    Apr 25, 2022
    Posts:
    18
    I will probably just make my first game with netcode for Gameobjects, because it’s a co-op and the next one with entities, hopefully their are more learning resources by then. Also I am trying to use locomotions that are not joystick based so idk how I would compensate for lag, I don’t think gorilla tag does.